本文整理了Java中org.bytesoft.transaction.supports.resource.XAResourceDescriptor
类的一些代码示例,展示了XAResourceDescriptor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XAResourceDescriptor
类的具体详情如下:
包路径:org.bytesoft.transaction.supports.resource.XAResourceDescriptor
类名称:XAResourceDescriptor
暂无
代码示例来源:origin: liuyangming/ByteTCC
if (CommonResourceDescriptor.class.isInstance(descriptor)) {
typeByte = (byte) 0x1;
identifierByteArray = descriptor.getIdentifier().getBytes();
} else if (RemoteResourceDescriptor.class.isInstance(descriptor)) {
typeByte = (byte) 0x2;
identifierByteArray = descriptor.getIdentifier().getBytes();
} else if (LocalXAResourceDescriptor.class.isInstance(descriptor)) {
typeByte = (byte) 0x3;
identifierByteArray = descriptor.getIdentifier().getBytes();
代码示例来源:origin: liuyangming/ByteTCC
try {
XAResourceDescriptor descriptor = resourceDeserializer.deserialize(identifier);
RecoveredResource resource = (RecoveredResource) descriptor.getDelegate();
resource.recoverable(current.getCompensableXid());
代码示例来源:origin: org.bytesoft/bytejta-core
XAResourceArchive archive = null;
XAResourceArchive element = this.participantMap.get(descriptor.getIdentifier()); // dubbo: old identifier
if (element != null) {
XAResourceDescriptor xard = element.getDescriptor();
try {
archive = xard.isSameRM(descriptor) ? element : archive;
} catch (Exception ex) {
logger.debug(ex.getMessage(), ex);
descriptor.setTransactionTimeoutQuietly(this.transactionTimeout);
XAResourceDescriptor lro = this.participant.getDescriptor();
try {
if (lro.isSameRM(descriptor) == false) {
throw new SystemException("Only one non-XA resource is allowed to participate in global transaction.");
} finally {
if (success) {
String identifier = descriptor.getIdentifier(); // dubbo: new identifier
代码示例来源:origin: org.bytesoft/bytejta-core
public void forget(Xid ignore) throws XAException {
descriptor.forget(xid);
}
代码示例来源:origin: liuyangming/ByteJTA
public void commit(Xid ignore, boolean onePhase) throws XAException {
if (this.readonly) {
// ignore
} else if (this.committed) {
// ignore
} else if (this.rolledback) {
throw new XAException(XAException.XA_HEURRB);
} else {
descriptor.commit(xid, onePhase);
}
}
代码示例来源:origin: org.bytesoft/bytejta-core
public int getTransactionTimeout() throws XAException {
return descriptor.getTransactionTimeout();
}
代码示例来源:origin: liuyangming/ByteJTA
public void end(Xid ignore, int flags) throws XAException {
descriptor.end(xid, flags);
}
代码示例来源:origin: liuyangming/ByteJTA
XAResourceDescriptor xard = enlisted.getDescriptor();
try {
archive = xard.isSameRM(descriptor) ? enlisted : archive;
} catch (Exception ex) {
logger.debug(ex.getMessage(), ex);
descriptor.setTransactionTimeoutQuietly(this.transactionTimeout);
XAResourceDescriptor lro = this.participant.getDescriptor();
try {
if (lro.isSameRM(descriptor) == false) {
throw new SystemException("Only one non-XA resource is allowed to participate in global transaction.");
} finally {
if (success) {
String identifier = descriptor.getIdentifier(); // dubbo: new identifier
代码示例来源:origin: liuyangming/ByteJTA
public void forget(Xid ignore) throws XAException {
descriptor.forget(xid);
}
代码示例来源:origin: org.bytesoft/bytejta-core
public void commit(Xid ignore, boolean onePhase) throws XAException {
if (this.readonly) {
// ignore
} else if (this.committed) {
// ignore
} else if (this.rolledback) {
throw new XAException(XAException.XA_HEURRB);
} else {
descriptor.commit(xid, onePhase);
}
}
代码示例来源:origin: liuyangming/ByteJTA
public int getTransactionTimeout() throws XAException {
return descriptor.getTransactionTimeout();
}
代码示例来源:origin: org.bytesoft/bytejta-core
public void end(Xid ignore, int flags) throws XAException {
descriptor.end(xid, flags);
}
代码示例来源:origin: liuyangming/ByteTCC
String identifier = descriptor.getIdentifier();
applicationEnlisted = true;
代码示例来源:origin: org.bytesoft/bytejta-supports
public Connection getConnection(String username, String password) throws SQLException {
try {
Transaction transaction = (Transaction) this.transactionManager.getTransaction();
if (transaction == null) {
return this.dataSource.getConnection(username, password);
}
XAResourceDescriptor descriptor = transaction.getResourceDescriptor(this.beanName);
LocalXAResource resource = descriptor == null ? null : (LocalXAResource) descriptor.getDelegate();
LocalXAConnection xacon = resource == null ? null : resource.getManagedConnection();
if (xacon != null) {
return xacon.getConnection();
}
xacon = this.getXAConnection(username, password);
LogicalConnection connection = xacon.getConnection();
descriptor = xacon.getXAResource();
LocalXAResource localXARes = (LocalXAResource) descriptor.getDelegate();
TransactionContext transactionContext = transaction.getTransactionContext();
boolean loggingRequired = LocalXACompatible.class.isInstance(transactionContext) //
? ((LocalXACompatible) transactionContext).compatibleLoggingLRO() : false;
localXARes.setLoggingRequired(loggingRequired);
transaction.enlistResource(descriptor);
return connection;
} catch (SystemException ex) {
throw new SQLException(ex);
} catch (RollbackException ex) {
throw new SQLException(ex);
} catch (RuntimeException ex) {
throw new SQLException(ex);
}
}
代码示例来源:origin: liuyangming/ByteJTA
public void forgetQuietly(Xid ignore) {
try {
descriptor.forget(xid);
} catch (XAException ex) {
logger.warn("Error occurred while forgeting xa-resource.", xid);
}
}
代码示例来源:origin: liuyangming/ByteTCC
public void onEnlistResource(Xid xid, XAResource xares) {
String resourceKey = null;
if (XAResourceDescriptor.class.isInstance(xares)) {
XAResourceDescriptor descriptor = (XAResourceDescriptor) xares;
resourceKey = descriptor.getIdentifier();
} else if (XAResourceArchive.class.isInstance(xares)) {
XAResourceArchive resourceArchive = (XAResourceArchive) xares;
XAResourceDescriptor descriptor = resourceArchive.getDescriptor();
resourceKey = descriptor == null ? null : descriptor.getIdentifier();
}
CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger();
if (this.transactionContext.isCompensating()) {
// this.archive.setCompensableXid(xid); // preset the compensable-xid.
this.archive.setCompensableResourceKey(resourceKey);
compensableLogger.updateCompensable(this.archive);
} else {
for (int i = 0; i < this.currentArchiveList.size(); i++) {
CompensableArchive compensableArchive = this.currentArchiveList.get(i);
compensableArchive.setTransactionXid(xid);
compensableArchive.setTransactionResourceKey(resourceKey);
XidFactory transactionXidFactory = this.beanFactory.getTransactionXidFactory();
TransactionXid globalXid = transactionXidFactory.createGlobalXid(xid.getGlobalTransactionId());
TransactionXid branchXid = transactionXidFactory.createBranchXid(globalXid);
compensableArchive.setCompensableXid(branchXid); // preset the compensable-xid.
compensableLogger.createCompensable(compensableArchive);
}
}
}
代码示例来源:origin: liuyangming/ByteJTA
public Connection getConnection() throws SQLException {
try {
Transaction transaction = (Transaction) this.transactionManager.getTransaction();
if (transaction == null) {
return this.dataSource.getConnection();
}
XAResourceDescriptor descriptor = transaction.getResourceDescriptor(this.beanName);
LocalXAResource resource = descriptor == null ? null : (LocalXAResource) descriptor.getDelegate();
LocalXAConnection xacon = resource == null ? null : resource.getManagedConnection();
if (xacon != null) {
return xacon.getConnection();
}
xacon = this.getXAConnection();
LogicalConnection connection = xacon.getConnection();
descriptor = xacon.getXAResource();
LocalXAResource localXARes = (LocalXAResource) descriptor.getDelegate();
TransactionContext transactionContext = transaction.getTransactionContext();
boolean loggingRequired = LocalXACompatible.class.isInstance(transactionContext) //
? ((LocalXACompatible) transactionContext).compatibleLoggingLRO() : false;
localXARes.setLoggingRequired(loggingRequired);
transaction.enlistResource(descriptor);
return connection;
} catch (SystemException ex) {
throw new SQLException(ex);
} catch (RollbackException ex) {
throw new SQLException(ex);
} catch (RuntimeException ex) {
throw new SQLException(ex);
}
}
代码示例来源:origin: org.bytesoft/bytejta-core
public void forgetQuietly(Xid ignore) {
try {
descriptor.forget(xid);
} catch (XAException ex) {
logger.warn("Error occurred while forgeting xa-resource.", xid);
}
}
代码示例来源:origin: liuyangming/ByteTCC
XAResourceDescriptor descriptor = archive.getDescriptor();
String descriptorType = descriptor.getClass().getName();
String descriptorKey = descriptor.getIdentifier();
代码示例来源:origin: org.bytesoft/bytejta-supports
public Connection getConnection() throws SQLException {
try {
Transaction transaction = (Transaction) this.transactionManager.getTransaction();
if (transaction == null) {
return this.dataSource.getConnection();
}
XAResourceDescriptor descriptor = transaction.getResourceDescriptor(this.beanName);
LocalXAResource resource = descriptor == null ? null : (LocalXAResource) descriptor.getDelegate();
LocalXAConnection xacon = resource == null ? null : resource.getManagedConnection();
if (xacon != null) {
return xacon.getConnection();
}
xacon = this.getXAConnection();
LogicalConnection connection = xacon.getConnection();
descriptor = xacon.getXAResource();
LocalXAResource localXARes = (LocalXAResource) descriptor.getDelegate();
TransactionContext transactionContext = transaction.getTransactionContext();
boolean loggingRequired = LocalXACompatible.class.isInstance(transactionContext) //
? ((LocalXACompatible) transactionContext).compatibleLoggingLRO() : false;
localXARes.setLoggingRequired(loggingRequired);
transaction.enlistResource(descriptor);
return connection;
} catch (SystemException ex) {
throw new SQLException(ex);
} catch (RollbackException ex) {
throw new SQLException(ex);
} catch (RuntimeException ex) {
throw new SQLException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!