| Method from org.jboss.resource.adapter.jdbc.xa.XAManagedConnection Detail: |
public void begin() throws ResourceException {
lock();
try
{
synchronized (stateLock)
{
if (inManagedTransaction == false)
{
try
{
if (underlyingAutoCommit)
{
underlyingAutoCommit = false;
con.setAutoCommit(false);
}
checkState();
inManagedTransaction = true;
}
catch (SQLException e)
{
checkException(e);
}
}
else
throw new JBossResourceException("Trying to begin a nested local tx");
}
}
finally
{
unlock();
}
}
|
protected void broadcastConnectionError(SQLException e) {
super.broadcastConnectionError(e);
}
|
public void commit() throws ResourceException {
lock();
try
{
synchronized (stateLock)
{
if (inManagedTransaction)
inManagedTransaction = false;
}
try
{
con.commit();
}
catch (SQLException e)
{
checkException(e);
}
}
finally
{
unlock();
}
}
|
public void commit(Xid xid,
boolean onePhase) throws XAException {
lock();
try
{
xaResource.commit(xid, onePhase);
}
finally
{
unlock();
}
}
|
public void destroy() throws ResourceException {
try
{
super.destroy();
}
finally
{
try
{
xaConnection.close();
}
catch (SQLException e)
{
checkException(e);
}
}
}
|
public void end(Xid xid,
int flags) throws XAException {
lock();
try
{
try
{
xaResource.end(xid, flags);
}
catch(XAException e)
{
broadcastConnectionError(e);
throw e;
}
//we want to allow ending transactions that are not the current
//one. When one does this, inManagedTransaction is still true.
synchronized (stateLock)
{
if (currentXid != null && currentXid.equals(xid))
{
inManagedTransaction = false;
currentXid = null;
}
}
}
finally
{
unlock();
}
}
|
public void forget(Xid xid) throws XAException {
xaResource.forget(xid);
}
|
public LocalTransaction getLocalTransaction() throws ResourceException {
return this;
}
|
public int getTransactionTimeout() throws XAException {
return xaResource.getTransactionTimeout();
}
|
public XAResource getXAResource() throws ResourceException {
return this;
}
|
public boolean isSameRM(XAResource other) throws XAException {
Boolean overrideValue = ((XAManagedConnectionFactory) mcf).getIsSameRMOverrideValue();
if (overrideValue != null)
{
return overrideValue.booleanValue();
}
// compare apples to apples
return (other instanceof XAManagedConnection)
? xaResource.isSameRM(((XAManagedConnection) other).xaResource)
: xaResource.isSameRM(other);
}
|
public int prepare(Xid xid) throws XAException {
lock();
try
{
return xaResource.prepare(xid);
}
finally
{
unlock();
}
}
|
public Xid[] recover(int flag) throws XAException {
return xaResource.recover(flag);
}
|
public void rollback() throws ResourceException {
lock();
try
{
synchronized (stateLock)
{
if (inManagedTransaction)
inManagedTransaction = false;
}
try
{
con.rollback();
}
catch (SQLException e)
{
try
{
checkException(e);
}
catch (Exception e2)
{
}
}
}
finally
{
unlock();
}
}
|
public void rollback(Xid xid) throws XAException {
lock();
try
{
xaResource.rollback(xid);
}
finally
{
unlock();
}
}
|
public boolean setTransactionTimeout(int seconds) throws XAException {
return xaResource.setTransactionTimeout(seconds);
}
|
public void start(Xid xid,
int flags) throws XAException {
lock();
try
{
try
{
checkState();
}
catch (SQLException e)
{
getLog().warn("Error setting state ", e);
}
try
{
xaResource.start(xid, flags);
}
catch(XAException e)
{
//JBAS-3336 Connections that fail in enlistment should not be returned
//to the pool
if(isFailedXA(e.errorCode))
{
broadcastConnectionError(e);
}
throw e;
}
synchronized (stateLock)
{
currentXid = xid;
inManagedTransaction = true;
}
}
finally
{
unlock();
}
}
|