本文整理匯總了Java中bitronix.tm.resource.common.XAResourceProducer.startRecovery方法的典型用法代碼示例。如果您正苦於以下問題:Java XAResourceProducer.startRecovery方法的具體用法?Java XAResourceProducer.startRecovery怎麽用?Java XAResourceProducer.startRecovery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bitronix.tm.resource.common.XAResourceProducer
的用法示例。
在下文中一共展示了XAResourceProducer.startRecovery方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerBlockingProducer
import bitronix.tm.resource.common.XAResourceProducer; //導入方法依賴的package包/類
private Future registerBlockingProducer(final XAResourceProducer producer, final CountDownLatch border) throws RecoveryException {
final XAResourceHolderState resourceHolderState = producer.startRecovery();
when(producer.startRecovery()).thenAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock invocation) throws Throwable {
border.await();
return resourceHolderState;
}
});
return executorService.submit(new Callable<Object>() {
public Object call() throws Exception {
ResourceRegistrar.register(producer);
return null;
}
});
}
示例2: recover
import bitronix.tm.resource.common.XAResourceProducer; //導入方法依賴的package包/類
/**
* Run the recovery process on the target resource.
* Step 1.
* @return a Set of BitronixXids.
* @param producer the {@link XAResourceProducer} to recover.
* @throws javax.transaction.xa.XAException if {@link XAResource#recover(int)} call fails.
* @throws RecoveryException if an error preventing recovery happened.
*/
private Set<BitronixXid> recover(XAResourceProducer producer) throws XAException, RecoveryException {
if (producer == null)
throw new IllegalArgumentException("recoverable resource cannot be null");
try {
if (log.isDebugEnabled()) { log.debug("running recovery on " + producer); }
XAResourceHolderState xaResourceHolderState = producer.startRecovery();
return RecoveryHelper.recover(xaResourceHolderState);
} finally {
producer.endRecovery();
}
}
示例3: commit
import bitronix.tm.resource.common.XAResourceProducer; //導入方法依賴的package包/類
/**
* Commit the specified branch of a dangling transaction.
* Step 2.
* @param uniqueName the unique name of the resource on which the commit should be done.
* @param xid the {@link Xid} to commit.
* @return true when commit was successful.
* @throws RecoveryException if an error preventing recovery happened.
*/
private boolean commit(String uniqueName, Xid xid) throws RecoveryException {
XAResourceProducer producer = registeredResources.get(uniqueName);
try {
XAResourceHolderState xaResourceHolderState = producer.startRecovery();
return RecoveryHelper.commit(xaResourceHolderState, xid);
} finally {
producer.endRecovery();
}
}
示例4: rollback
import bitronix.tm.resource.common.XAResourceProducer; //導入方法依賴的package包/類
/**
* Rollback the specified branch of a dangling transaction.
* Step 3.
* @param uniqueName the unique name of the resource on which to rollback branches.
* @param xid the {@link Xid} to rollback.
* @return true when rollback was successful.
* @throws RecoveryException if an error preventing recovery happened.
*/
private boolean rollback(String uniqueName, Xid xid) throws RecoveryException {
XAResourceProducer producer = registeredResources.get(uniqueName);
if (producer == null) {
if (log.isDebugEnabled()) { log.debug("resource " + uniqueName + " has not recovered, skipping rollback"); }
return false;
}
try {
XAResourceHolderState xaResourceHolderState = producer.startRecovery();
return RecoveryHelper.rollback(xaResourceHolderState, xid);
} finally {
producer.endRecovery();
}
}