2
* Copyright 2003-2010 Terracotta, Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
16
package net.sf.ehcache.transaction.manager.btm;
18
import bitronix.tm.resource.common.AbstractXAResourceHolder;
19
import bitronix.tm.resource.common.ResourceBean;
21
import javax.transaction.xa.XAResource;
22
import java.util.ArrayList;
23
import java.util.Date;
24
import java.util.List;
27
* EHCache implementation of BTM's XAResourceHolder
31
public class EhCacheXAResourceHolder extends AbstractXAResourceHolder {
33
private final XAResource resource;
34
private final ResourceBean bean;
37
* Create a new EhCacheXAResourceHolder for a particular XAResource
38
* @param resource the required XAResource
39
* @param bean the required ResourceBean
41
public EhCacheXAResourceHolder(XAResource resource, ResourceBean bean) {
42
this.resource = resource;
49
public XAResource getXAResource() {
54
* Method is only there to remain compatible with pre-2.0.0 version of BTM
55
* @return the ResourceBean associated with this Resource
56
* @deprecated for compatibility with pre-2.0.0 version of BTM
59
public ResourceBean getResourceBean() {
66
public void close() throws Exception {
67
throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
73
public Object getConnectionHandle() throws Exception {
74
throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
80
public Date getLastReleaseDate() {
81
throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
87
public List getXAResourceHolders() {
88
List xaResourceHolders = new ArrayList(1);
89
xaResourceHolders.add(this);
90
return xaResourceHolders;