Created
August 27, 2015 13:54
-
-
Save clebertsuconic/780b73e81b79ac110709 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The ASF licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
package org.apache.activemq.artemis.service.extensions.xa; | |
import javax.transaction.xa.XAException; | |
import javax.transaction.xa.XAResource; | |
import javax.transaction.xa.Xid; | |
import java.util.Map; | |
public class ActiveMQXAResourceWrapperImpl implements ActiveMQXAResourceWrapper { | |
private final XAResource xaResource; | |
// The EIS Name | |
private final String productName; | |
// The EIS Version | |
private final String productVersion; | |
// A composite of NodeID + JNDIName that allows administrator looking at an XAResource to determine it's origin. | |
private final Map<String, Object> properties; | |
/** | |
* Creates a new XAResourceWrapper. PRODUCT_NAME, productVersion and jndiName are useful for log output in the | |
* Transaction Manager. For ActiveMQ Artemis only the resourceManagerID is required to allow Transaction Manager to recover | |
* from relevant recovery scenarios. | |
* | |
* @param xaResource | |
* @param properties | |
*/ | |
public ActiveMQXAResourceWrapperImpl(XAResource xaResource, Map<String, Object> properties) { | |
this.xaResource = xaResource; | |
//this.productName = ActiveMQResourceAdapter.PRODUCT_NAME; | |
this.productName = (String) properties.get(ACTIVEMQ_PRODUCT_NAME); | |
//this.productVersion = VersionLoader.getVersion().getFullVersion(); | |
this.productVersion = (String) properties.get(ACTIVEMQ_PRODUCT_VERSION); | |
this.properties = properties; | |
} | |
public XAResource getResource() { | |
return xaResource; | |
} | |
public String getProductName() { | |
return productName; | |
} | |
public String getProductVersion() { | |
return productVersion; | |
} | |
public Map<String, Object> getProperties() { | |
return properties; | |
} | |
@Override | |
public void commit(Xid xid, boolean b) throws XAException { | |
getResource().commit(xid, b); | |
} | |
@Override | |
public void end(Xid xid, int i) throws XAException { | |
getResource().end(xid, i); | |
} | |
@Override | |
public void forget(Xid xid) throws XAException { | |
getResource().forget(xid); | |
} | |
@Override | |
public int getTransactionTimeout() throws XAException { | |
return getResource().getTransactionTimeout(); | |
} | |
@Override | |
public boolean isSameRM(XAResource xaResource) throws XAException { | |
return getResource().isSameRM(xaResource); | |
} | |
@Override | |
public int prepare(Xid xid) throws XAException { | |
return getResource().prepare(xid); | |
} | |
@Override | |
public Xid[] recover(int i) throws XAException { | |
return getResource().recover(i); | |
} | |
@Override | |
public void rollback(Xid xid) throws XAException { | |
getResource().rollback(xid); | |
} | |
@Override | |
public boolean setTransactionTimeout(int i) throws XAException { | |
return getResource().setTransactionTimeout(i); | |
} | |
@Override | |
public void start(Xid xid, int i) throws XAException { | |
getResource().start(xid, i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment