本文整理汇总了Java中javax.transaction.xa.Xid.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Xid.equals方法的具体用法?Java Xid.equals怎么用?Java Xid.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.transaction.xa.Xid
的用法示例。
在下文中一共展示了Xid.equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateXid
import javax.transaction.xa.Xid; //导入方法依赖的package包/类
/**
*
* @throws XAException if the given Xid is the not the Xid of the current
* transaction for this XAResource object.
* @param xid Xid
*/
private void validateXid(Xid xid) throws XAException {
if (xid == null) {
throw new XAException("Null Xid");
}
if (this.xid == null) {
throw new XAException(
"There is no live transaction for this XAResource");
}
if (!xid.equals(this.xid)) {
throw new XAException(
"Given Xid is not that associated with this XAResource object");
}
}
示例2: validateXid
import javax.transaction.xa.Xid; //导入方法依赖的package包/类
/**
* @throws XAException if the given Xid is the not the Xid of the
* current transaction for this XAResource object.
*/
private void validateXid(Xid xid) throws XAException {
if (xid == null) {
throw new XAException("Null Xid");
}
if (this.xid == null) {
throw new XAException(
"There is no live transaction for this XAResource");
}
if (!xid.equals(this.xid)) {
throw new XAException(
"Given Xid is not that associated with this XAResource object");
}
}
示例3: switchToXid
import javax.transaction.xa.Xid; //导入方法依赖的package包/类
private synchronized void switchToXid(Xid xid) throws XAException {
if (xid == null) {
throw new XAException();
}
try {
if (!xid.equals(this.currentXid)) {
XAConnection toSwitchTo = findConnectionForXid(this.underlyingConnection, xid);
this.currentXAConnection = toSwitchTo;
this.currentXid = xid;
this.currentXAResource = toSwitchTo.getXAResource();
}
} catch (SQLException sqlEx) {
throw new XAException();
}
}
示例4: commit
import javax.transaction.xa.Xid; //导入方法依赖的package包/类
@Override
public void commit(Xid xid, boolean onePhase) throws XAException {
if ( xid == null || !xid.equals( currentXid ) ) {
throw new XAException( "Invalid xid to transactionCommit" );
}
currentXid = null;
try {
connection.transactionCommit();
connection.transactionEnd();
} catch ( Exception t ) {
throw new XAException( "Error trying to transactionCommit local transaction: " + t.getMessage() );
}
}
示例5: rollback
import javax.transaction.xa.Xid; //导入方法依赖的package包/类
@Override
public void rollback(Xid xid) throws XAException {
if ( xid == null || !xid.equals( currentXid ) ) {
throw new XAException( "Invalid xid to transactionRollback" );
}
currentXid = null;
try {
connection.transactionRollback();
connection.transactionEnd();
} catch ( Exception t ) {
throw new XAException( "Error trying to transactionRollback local transaction: " + t.getMessage() );
}
}
示例6: start
import javax.transaction.xa.Xid; //导入方法依赖的package包/类
public void start(Xid xid, int flags) throws XAException {
// Comment out following debug statement before public release:
/*
System.err.println("STARTING NEW Xid: " + xid);
*/
if (state != XA_STATE_INITIAL && state != XA_STATE_DISPOSED
&& state != XA_STATE_ENDED) {
throw new XAException("Invalid XAResource state");
}
if (xaDataSource == null) {
throw new XAException(
"JDBCXAResource has not been associated with a XADataSource");
}
if (xid == null) {
// This block asserts that all JDBCXAResources with state
// >= XA_STATE_STARTED have a non-null xid.
throw new XAException("Null Xid");
}
try {
if (connection.getAutoCommit()) {
originalAutoCommitMode = true; // real/phys.
connection.setAutoCommit(false); // real/phys.
}
} catch (SQLException se) {
throw new XAException(se.toString());
}
if (!xid.equals(this.xid)) {
this.xid = xid;
xaDataSource.addResource(this.xid, this);
}
state = XA_STATE_STARTED;
// N.b. The DataSource does not have this XAResource in its list
// until right here. We can't tell DataSource before our start()
// method, because we don't know our Xid before now.
}
示例7: end
import javax.transaction.xa.Xid; //导入方法依赖的package包/类
@Override
public void end(Xid xid, int flags) throws XAException {
if ( xid == null || !xid.equals( currentXid ) ) {
throw new XAException( "Invalid xid to transactionEnd" );
}
}