/** * sets the execution context for the work (traditional, 1.5 way) * * @param ec ExecutionContext * @throws WorkException when unable to setup the execution context */ private void setupExecutionContext(ExecutionContext ec) throws WorkException { JavaEETransactionManager tm = runtime.getTransactionManager(); if (ec != null && ec.getXid() != null) { tm.recreate(ec.getXid(), ec.getTransactionTimeout()); } }
execContext = new ExecutionContext();
final ExecutionContext ec = new ExecutionContext(); ec.setXid(txn.getXid());
/** * String representation * @return The string */ public String toString() { StringBuilder buffer = new StringBuilder(100); buffer.append("WorkWrapper@").append(Integer.toHexString(System.identityHashCode(this))); buffer.append("[workManger=").append(workManager); buffer.append(" work=").append(work); if (executionContext != null && executionContext.getXid() != null) { buffer.append(" xid=").append(executionContext.getXid()); buffer.append(" txTimeout=").append(executionContext.getTransactionTimeout()); } if (workListener != null) buffer.append(" workListener=").append(workListener); if (exception != null) buffer.append(" exception=").append(exception); buffer.append("]"); return buffer.toString(); } }
execContext = new ExecutionContext();
/** * String representation * @return The string */ public String toString() { StringBuilder buffer = new StringBuilder(100); buffer.append("WorkWrapper@").append(Integer.toHexString(System.identityHashCode(this))); buffer.append("[workManger=").append(workManager); buffer.append(" work=").append(work); if (executionContext != null && executionContext.getXid() != null) { buffer.append(" xid=").append(executionContext.getXid()); buffer.append(" txTimeout=").append(executionContext.getTransactionTimeout()); } buffer.append(" workListener=").append(workListener); buffer.append(" workContexts=").append(workContexts); buffer.append(" exception=").append(exception); buffer.append("]"); return buffer.toString(); } }
execContext = new ExecutionContext();
Xid xid = ctx.getXid(); if (xid != null) long timeout = (ctx.getTransactionTimeout() * 1000); workManager.getXATerminator().registerWork(work, xid, timeout); Xid xid = ctx.getXid(); if (xid != null)
/** * Cancel */ protected void cancel() { if (trace) log.trace("Cancel work " + this); ExecutionContext ctx = getExecutionContext(); if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().cancelWork(work, xid); } } if (trace) log.trace("Canceled work " + this); }
execContext = new ExecutionContext();
TransactionContext txWorkContext = new TransactionContext(); try { txWorkContext.setTransactionTimeout(executionContext.getTransactionTimeout()); } catch (NotSupportedException e) { txWorkContext.setXid(executionContext.getXid()); workContexts = Collections.<WorkContext>singletonList(txWorkContext); log.info("Translated ExecutionContext to TransactionContext");
/** * End */ protected void end() { if (trace) { log.trace("Ending work " + this); } ExecutionContext ctx = getExecutionContext(); if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().endWork(work, xid); } } if (trace) { log.trace("Ended work " + this); } }
execContext = new ExecutionContext();
final Xid xid = ec.getXid(); if (null == xid) Tr.error(tc, "WTRN0091_ASSOCIATE_FAILED", new Object[] { ec, ec.getTransactionTimeout()}); if (tc.isEntryEnabled()) Tr.exit(tc, "associate", "Invalid Xid"); throw wce; Tr.error(tc, "WTRN0091_ASSOCIATE_FAILED", new Object[] { ec, ec.getTransactionTimeout()}); if (tc.isEntryEnabled()) Tr.exit(tc, "associate", wce); throw wce; Tr.error(tc, "WTRN0091_ASSOCIATE_FAILED", new Object[] { ec, ec.getTransactionTimeout()}); if (tc.isEntryEnabled()) Tr.exit(tc, "associate", "Invalid providerId: " + providerId); throw wce; try txWrapper = findTxWrapper((int) ec.getTransactionTimeout(), xid, providerId); Tr.error(tc, "WTRN0091_ASSOCIATE_FAILED", new Object[] { ec, ec.getTransactionTimeout()}); if (tc.isEntryEnabled()) Tr.exit(tc, "associate", "resume threw InvalidTransactionException"); throw wce; Tr.error(tc, "WTRN0091_ASSOCIATE_FAILED", new Object[] { ec, ec.getTransactionTimeout()}); if (tc.isEntryEnabled()) Tr.exit(tc, "associate", "resume threw IllegalStateException"); throw wce;
execContext = new ExecutionContext();
Xid xid = ctx.getXid(); if (xid != null) long timeout = (ctx.getTransactionTimeout() * 1000); workManager.getXATerminator().registerWork(work, xid, timeout); Xid xid = ctx.getXid(); if (xid != null)