Methods Summary |
---|
private static void | assert_prejdk14(boolean value)a simple assertion mechanism that print stack trace
if assertion fails
if (!value) {
Exception e = new Exception();
_logger.log(Level.WARNING,"jts.assert",e);
}
|
public void | commit()Complete the transaction represented by this Transaction object
try {
if (Configuration.isLocalFactory()) {
((ControlImpl) control).get_localTerminator().commit(true);
} else {
control.get_terminator().commit(true);
}
} catch (TRANSACTION_ROLLEDBACK ex) {
throw new RollbackException();
} catch (INVALID_TRANSACTION ex) {
throw new IllegalStateException();
} catch (HeuristicMixed ex) {
throw new HeuristicMixedException();
} catch (HeuristicHazard ex) {
throw new HeuristicMixedException();
} catch (NO_PERMISSION ex) {
throw new SecurityException();
} catch (Unavailable ex) {
SystemException sException = new SystemException();
sException.initCause(ex);
throw sException;
} catch (Exception ex) {
SystemException sException = new SystemException();
sException.initCause(ex);
throw sException;
}
|
public boolean | delistResource(javax.transaction.xa.XAResource res, int flags)
/*
int status = getStatus();
if (status != javax.transaction.Status.STATUS_ACTIVE &&
status != javax.transaction.Status.STATUS_MARKED_ROLLBACK) {
throw new IllegalStateException();
}
*/
try {
// TransactionState tranState = tm.getTransactionState(gtid, this);
if (tranState == null) {
// transaction has completed
throw new IllegalStateException();
}
if (tranState.containsXAResource(res) == false) {
throw new IllegalStateException();
}
tranState.endAssociation(res, flags);
if ((flags & XAResource.TMFAIL) != 0) {
// set transaction to rollback only if TMFAIL used
setRollbackOnly();
}
return true;
} catch (XAException ex) {
setRollbackOnly();
throw new SystemException();
}
|
public boolean | enlistResource(javax.transaction.xa.XAResource res)enlist a resource with the current transaction
If a transaction is marked as rollback, enlistment will
succeed if the resource has been enlisted before. Otherwise,
enlistment will fail. In both cases, a RollbackException will
be thrown.
int status = getStatus();
if (status != javax.transaction.Status.STATUS_ACTIVE &&
status != javax.transaction.Status.STATUS_MARKED_ROLLBACK) {
throw new IllegalStateException();
}
//START IASRI 4706150
try{
if(tm.getXAResourceTimeOut() > 0)
res.setTransactionTimeout(tm.getXAResourceTimeOut());
}catch(Exception ex){
_logger.log(Level.WARNING,"jts.error_while_setting_xares_txn_timeout",ex);
}
//END IASRI 4706150
try {
if (tranState == null) {
tranState = new TransactionState(gtid, this);
// Synchronization sync = new SynchronizationListener(tranState);
// registerSynchronization(sync);
}
tranState.startAssociation(res, control, status);
if (status == javax.transaction.Status.STATUS_MARKED_ROLLBACK) {
throw new RollbackException();
}
return true;
} catch (XAException ex) {
_logger.log(Level.WARNING,"jts.resource_outside_transaction",ex);
if (ex.errorCode == XAException.XAER_OUTSIDE) {
throw new IllegalStateException();
}
// XXX FIXME should throw rollback exception on XARB_*
// for now just throw SystemException
throw new SystemException();
}
|
public boolean | equals(java.lang.Object object)
if ((object instanceof TransactionImpl) == false) {
return false;
} else if (object == this) {
return true;
} else {
return gtid.equals(((TransactionImpl) object).gtid);
}
|
Control | getControl()return the OTS Control object for this transaction.
return control;
|
public long | getStartTime()
return startTime;
|
public int | getStatus()
// XXX what should getStatus return on exception?
Status status;
try {
if (Configuration.isLocalFactory()) {
status = ((ControlImpl) control).get_localCoordinator().get_status();
} else {
status = control.get_coordinator().get_status();
}
return TransactionManagerImpl.mapStatus(status);
} catch (TRANSACTION_ROLLEDBACK ex) {
return javax.transaction.Status.STATUS_NO_TRANSACTION;
} catch (INVALID_TRANSACTION ex) {
return javax.transaction.Status.STATUS_NO_TRANSACTION;
} catch (Unavailable ex) {
return javax.transaction.Status.STATUS_NO_TRANSACTION;
} catch (Exception ex) {
_logger.log(Level.WARNING,"jts.unexpected_error_in_getstatus",ex);
throw new SystemException();
}
|
public java.lang.String | getTransactionId()
return gtid.toString();
|
public int | hashCode()
return gtid.hashCode();
|
public void | registerInterposedSynchronization(javax.transaction.Synchronization sync)
int status = getStatus();
if (status == javax.transaction.Status.STATUS_MARKED_ROLLBACK) {
throw new RollbackException();
}
if (status != javax.transaction.Status.STATUS_ACTIVE) {
throw new IllegalStateException();
}
if (tranState == null) {
tranState = new TransactionState(gtid, this);
}
tranState.registerSynchronization(sync, control, true);
|
public void | registerSynchronization(javax.transaction.Synchronization sync)
int status = getStatus();
if (status == javax.transaction.Status.STATUS_MARKED_ROLLBACK) {
throw new RollbackException();
}
if (status != javax.transaction.Status.STATUS_ACTIVE) {
throw new IllegalStateException();
}
if (tranState == null) {
tranState = new TransactionState(gtid, this);
}
tranState.registerSynchronization(sync, control, false);
|
public void | rollback()Rollback the transaction represented by this Transaction object.
try {
if (Configuration.isLocalFactory()) {
((ControlImpl) control).get_localTerminator().rollback();
} else {
control.get_terminator().rollback();
}
} catch (INVALID_TRANSACTION ex) {
throw new IllegalStateException();
} catch (TRANSACTION_ROLLEDBACK ex) {
throw new IllegalStateException();
} catch (Unavailable ex) {
SystemException sException = new SystemException();
sException.initCause(ex);
throw sException;
} catch (Exception ex) {
SystemException sException = new SystemException();
sException.initCause(ex);
throw sException;
}
|
public void | setRollbackOnly()
int status = getStatus();
if (status != javax.transaction.Status.STATUS_MARKED_ROLLBACK &&
status != javax.transaction.Status.STATUS_ACTIVE) {
throw new IllegalStateException();
}
try {
if (Configuration.isLocalFactory()) {
((ControlImpl) control).get_localCoordinator().rollback_only();
} else {
control.get_coordinator().rollback_only();
}
} catch (Unavailable ex) {
throw new SystemException();
} catch (Inactive ex) {
throw new IllegalStateException();
} catch (Exception ex) {
throw new SystemException();
}
|