本文整理汇总了Java中com.arjuna.mw.wst11.TransactionManagerFactory.transactionManager方法的典型用法代码示例。如果您正苦于以下问题:Java TransactionManagerFactory.transactionManager方法的具体用法?Java TransactionManagerFactory.transactionManager怎么用?Java TransactionManagerFactory.transactionManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.arjuna.mw.wst11.TransactionManagerFactory
的用法示例。
在下文中一共展示了TransactionManagerFactory.transactionManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeBooking
import com.arjuna.mw.wst11.TransactionManagerFactory; //导入方法依赖的package包/类
/**
* Book a number of seats in the restaurant. Enrols a Participant, then passes the call through to the business logic.
*/
@WebMethod
public void makeBooking() throws RestaurantException {
System.out.println("[SERVICE] Restaurant service invoked to make a booking");
String transactionId;
try {
// get the transaction ID associated with this thread
transactionId = UserTransactionFactory.userTransaction().toString();
// enlist the Participant for this service:
RestaurantParticipant restaurantParticipant = new RestaurantParticipant(transactionId);
TransactionManager transactionManager = TransactionManagerFactory.transactionManager();
System.out.println("[SERVICE] Enlisting a Durable2PC participant into the AT");
transactionManager.enlistForDurableTwoPhase(restaurantParticipant, "restaurantServiceAT:" + UUID.randomUUID());
} catch (Exception e) {
throw new RestaurantException("Error when enlisting participant", e);
}
// invoke the backend business logic:
System.out.println("[SERVICE] Invoking the back-end business logic");
mockRestaurantManager.makeBooking(transactionId);
}
示例2: bridgeOutgoingTransaction
import com.arjuna.mw.wst11.TransactionManagerFactory; //导入方法依赖的package包/类
private void bridgeOutgoingTransaction() {
try {
// disassociate subordinate JTA transaction
InboundBridge txInboundBridge = InboundBridgeManager.getInboundBridge();
txInboundBridge.stop();
// disassociate WS-AT transaction
final com.arjuna.mw.wst11.TransactionManager wsatManager = TransactionManagerFactory.transactionManager();
if (wsatManager != null) {
wsatManager.suspend();
}
} catch (final Throwable th) {
throw new SwitchYardException(th);
}
}
示例3: bridgeOutgoingTransaction
import com.arjuna.mw.wst11.TransactionManagerFactory; //导入方法依赖的package包/类
private boolean bridgeOutgoingTransaction(RemoteMessage request) throws HandlerException {
if (_disableRemoteTransaction) {
return false;
}
Transaction currentTransaction = null;
try {
currentTransaction = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
} catch (Throwable t) {
if (_log.isDebugEnabled()) {
_log.debug(t);
}
}
if (currentTransaction == null) {
return false;
}
try {
// create/resume subordinate WS-AT transaction
OutboundBridge txOutboundBridge = OutboundBridgeManager.getOutboundBridge();
if (txOutboundBridge == null) {
return false;
}
txOutboundBridge.start();
// embed WS-AT transaction context into request header
final com.arjuna.mw.wst11.TransactionManager wsatManager = TransactionManagerFactory.transactionManager();
CoordinationContextType coordinationContext = null;
if (wsatManager != null) {
final TxContextImple txContext = (TxContextImple)wsatManager.currentTransaction();
if (txContext != null) {
coordinationContext = txContext.context().getCoordinationContext();
}
}
if (coordinationContext != null) {
String txContextString = _txSerializer.serialise(coordinationContext);
if (_log.isDebugEnabled()) {
_log.debug("Embedding transaction context into request header: " + txContextString);
}
request.getContext()
.setProperty(TransactionContextSerializer.HEADER_TXCONTEXT, txContextString)
.addLabels(BehaviorLabel.TRANSIENT.label(), HttpInvokerLabel.HEADER.label());
}
return true;
} catch (final Throwable th) {
throw createHandlerException(th);
}
}