/** * 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()); } }
/** * 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(); } }
/** * 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(); } }
/** * 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); }
/** * 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); } }
txWorkContext.setXid(executionContext.getXid()); workContexts = Collections.<WorkContext>singletonList(txWorkContext); log.info("Translated ExecutionContext to TransactionContext");
/** * End */ protected void end() { log.tracef("Ending work: %s", this); ExecutionContext ctx = getWorkContext(TransactionContext.class); if (ctx == null) { ctx = getExecutionContext(); } if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().endWork(work, xid); } } log.tracef("Ended work: %s", this); }
/** * Cancel */ protected void cancel() { log.tracef("Cancel work: %s", this); ExecutionContext ctx = getWorkContext(TransactionContext.class); if (ctx == null) { ctx = getExecutionContext(); } if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().cancelWork(work, xid); } } log.tracef("Canceled work: %s", this); }
if (executionContext != null && executionContext.getXid() != null) { final WorkRejectedException workRejectedException = new WorkRejectedException("SimpleWorkManager can not import an XID", WorkException.TX_RECREATE_FAILED); workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, workRejectedException));
if (executionContext != null && executionContext.getXid() != null) { final WorkRejectedException workRejectedException = new WorkRejectedException("SimpleWorkManager can not import an XID", WorkException.TX_RECREATE_FAILED); workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, workRejectedException));
if (executionContext != null && executionContext.getXid() != null) { WorkRejectedException workRejectedException = new WorkRejectedException("SimpleWorkManager can not import an XID", WorkException.TX_RECREATE_FAILED); workListener.workRejected(new WorkEvent(this, WORK_REJECTED, work, workRejectedException));
final Xid xid = ec.getXid(); if (null == xid)