public synchronized void stop(final StopContext context) { if (inboundBridgeRecoveryManager != null) { try { inboundBridgeRecoveryManager.stop(); } catch (Exception e) { // ignore? } } } }
/** * Tidy up the Transaction/Thread association before faults are thrown back to the client. * * @param messageContext unused * @return true on success, false on error */ public boolean handleFault(MessageContext messageContext) { txbridgeLogger.logger.trace("JaxWSTxInboundBridgeHandler.handleFault()"); return suspendTransaction(); }
/** * Perform afterCompletion cleanup activities such as releasing resources. * * Caution: may not be invoked in crash recovery situations. */ public void rollback() throws WrongStateException, SystemException { txbridgeLogger.logger.trace("BridgeVolatileParticipant.rollback(Xid="+xid+")"); afterCompletion(Status.STATUS_ROLLEDBACK); }
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); } }
/** * Process inbound messages by mapping the WS transaction context * to a JTA one and associating the latter to the current Thread. * * @param msgContext unused * @return true on success, false on error */ protected boolean handleInbound(MessageContext msgContext) { txbridgeLogger.logger.trace("JaxWSTxInboundBridgeHandler.handleInbound()"); try { inboundBridge = org.jboss.jbossts.txbridge.inbound.InboundBridgeManager.getInboundBridge(); inboundBridge.start(); } catch (Exception e) { txbridgeLogger.logger.error(e); return false; } return true; }
BridgeDurableParticipant bridgeDurableParticipant = new BridgeDurableParticipant(externalTxId, xid); BridgeVolatileParticipant bridgeVolatileParticipant = new BridgeVolatileParticipant(externalTxId, xid); transactionManager.enlistForVolatileTwoPhase(bridgeVolatileParticipant, new Uid().toString()); inboundBridgeMappings.put(externalTxId, new InboundBridge(xid));
/** * Break the association between the JTA transaction context and the calling Thread. * * @return true on success, false on error */ private boolean suspendTransaction() { txbridgeLogger.logger.trace("JaxWSTxInboundBridgeHandler.suspendTransaction()"); try { inboundBridge.stop(); } catch (Exception e) { txbridgeLogger.logger.error(e); return false; } return true; } }
/** * Process a message. Determines if it is inbound or outbound and dispatches accordingly. * * @param msgContext the context to process * @return true on success, false on error */ public boolean handleMessage(MessageContext msgContext) { txbridgeLogger.logger.trace("JaxWSTxInboundBridgeHandler.handleMessage()"); Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outbound == null) throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY); return outbound ? handleOutbound(msgContext) : handleInbound(msgContext); }
@Override public synchronized void start(final StartContext context) throws StartException { // XTS expects the TCCL to be set to something that will locate the XTS service implementation classes. final ClassLoader loader = TxBridgeInboundRecoveryService.class.getClassLoader(); WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(loader); try { InboundBridgeRecoveryManager service = new InboundBridgeRecoveryManager(); try { service.start(); } catch (Exception e) { throw XtsAsLogger.ROOT_LOGGER.txBridgeInboundRecoveryServiceFailedToStart(); } inboundBridgeRecoveryManager = service; } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged((ClassLoader) null); } }
/** * Create a new InboundBridge to manage the given subordinate JTA transaction. * * @param xid the subordinate transaction id * @throws XAException * @throws SystemException */ InboundBridge(Xid xid) throws XAException, SystemException { txbridgeLogger.logger.trace("InboundBridge.<ctor>(Xid="+xid+")"); this.xid = xid; getTransaction(); // ensures transaction is initialized }
/** * MC lifecycle callback, used to unregister components from the recovery manager. */ public void stop() { txbridgeLogger.i18NLogger.info_ibrm_stop(); xtsATRecoveryManager.unregisterRecoveryModule(this); acRecoveryManager.removeModule(this, false); XARecoveryModule xaRecoveryModule = getXARecoveryModule(); xaRecoveryModule.removeXAResourceOrphanFilter(this); }
private void cleanupRefs() { txbridgeLogger.logger.trace("BridgeDurableParticipant.cleanupRefs()"); org.jboss.jbossts.txbridge.inbound.InboundBridgeManager.removeMapping(externalTxId); isAwaitingRecovery = false; } }
/** * Release any BridgeDurableParticipant instances that have been driven * through to completion by their parent XTS transaction. */ private void cleanupRecoveredParticipants() { txbridgeLogger.logger.trace("InboundBridgeRecoveryManager.cleanupRecoveredParticipants()"); synchronized(participantsAwaitingRecovery) { Iterator<org.jboss.jbossts.txbridge.inbound.BridgeDurableParticipant> iter = participantsAwaitingRecovery.iterator(); while(iter.hasNext()) { BridgeDurableParticipant participant = iter.next(); if(!participant.isAwaitingRecovery()) { iter.remove(); } } } }
/** * Return an InboundBridge instance that maps the current Thread's WS transaction context * to a JTA context. Control of the latter is provided by the returned instance. * * @return an InboundBridge corresponding to the calling Thread's current WS-AT transaction context. * @throws WrongStateException * @throws UnknownTransactionException * @throws com.arjuna.wst.SystemException * @throws AlreadyRegisteredException */ public static InboundBridge getInboundBridge() throws XAException, WrongStateException, UnknownTransactionException, com.arjuna.wst.SystemException, javax.transaction.SystemException, AlreadyRegisteredException { txbridgeLogger.logger.trace("InboundBridgeManager.getInboundBridge()"); String externalTxId = UserTransactionFactory.userTransaction().toString(); if(!inboundBridgeMappings.containsKey(externalTxId)) { createMapping(externalTxId); } return inboundBridgeMappings.get(externalTxId); }
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); } }
public void setRollbackOnly() throws XAException, SystemException { txbridgeLogger.logger.trace("InboundBridge.setRollbackOnly("+xid+")"); getTransaction().setRollbackOnly(); }
/** * Tidy up the Transaction/Thread association before returning a message to the client. * * @param msgContext unused * @return true on success, false on error */ protected boolean handleOutbound(MessageContext msgContext) { txbridgeLogger.logger.trace("JaxWSTxInboundBridgeHandler.handleOutbound()"); return suspendTransaction(); }
/** * Perform afterCompletion cleanup activities such as releasing resources. * * Caution: may not be invoked in crash recovery situations. */ public void commit() throws WrongStateException, SystemException { txbridgeLogger.logger.trace("BridgeVolatileParticipant.commit(Xid="+xid+")"); afterCompletion(Status.STATUS_COMMITTED); }
/** * MC lifecycle callback, used to register components with the recovery manager. */ public void start() { txbridgeLogger.i18NLogger.info_ibrm_start(); xtsATRecoveryManager.registerRecoveryModule(this); acRecoveryManager.addModule(this); XARecoveryModule xaRecoveryModule = getXARecoveryModule(); xaRecoveryModule.addXAResourceOrphanFilter(this); }
/** * Associate the JTA transaction to the current Thread. * Typically used by a server side inbound handler. * * @throws XAException * @throws SystemException * @throws InvalidTransactionException */ public void start() throws XAException, SystemException, InvalidTransactionException { txbridgeLogger.logger.trace("InboundBridge.start(Xid="+xid+")"); Transaction tx = getTransaction(); TransactionManager.transactionManager().resume(tx); }