bitronix.tm.resource.ehcache.EhCacheXAResourceHolder Maven / Gradle / Ivy
package bitronix.tm.resource.ehcache;
import bitronix.tm.resource.common.AbstractXAResourceHolder;
import bitronix.tm.resource.common.ResourceBean;
import javax.transaction.xa.XAResource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* EHCache implementation of BTM's XAResourceHolder.
*
* Copyright 2003-2010 Terracotta, Inc.
*
* @author lorban
*/
public class EhCacheXAResourceHolder extends AbstractXAResourceHolder {
private final XAResource resource;
private final ResourceBean bean;
/**
* Create a new EhCacheXAResourceHolder for a particular XAResource
* @param resource the required XAResource
* @param bean the required ResourceBean
*/
public EhCacheXAResourceHolder(XAResource resource, ResourceBean bean) {
this.resource = resource;
this.bean = bean;
}
/**
* {@inheritDoc}
*/
public XAResource getXAResource() {
return resource;
}
/**
* {@inheritDoc}
*/
public ResourceBean getResourceBean() {
return bean;
}
/**
* {@inheritDoc}
*/
public void close() throws Exception {
throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
}
/**
* {@inheritDoc}
*/
public Object getConnectionHandle() throws Exception {
throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
}
/**
* {@inheritDoc}
*/
public Date getLastReleaseDate() {
throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
}
/**
* {@inheritDoc}
*/
public List getXAResourceHolders() {
List xaResourceHolders = new ArrayList(1);
xaResourceHolders.add(this);
return xaResourceHolders;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy