WorkException wex = new WorkRejectedException("TaskExecutor rejected Work because of timeout: " + work, ex); wex.setErrorCode(WorkException.START_TIMED_OUT); workListenerToUse.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, wex)); WorkException wex = new WorkRejectedException("TaskExecutor rejected Work: " + work, ex); wex.setErrorCode(WorkException.INTERNAL); workListenerToUse.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, wex));
if (WorkException.START_TIMED_OUT.equals(ex.getErrorCode())) { throw new TaskTimeoutException("JCA WorkManager rejected task because of timeout: " + task, ex);
if (ec != null && transactionContext != ec) { WorkRejectedException wre = new WorkRejectedException(); wre.setErrorCode(WorkContextErrorCodes.CONTEXT_SETUP_FAILED); logger.log(Level.WARNING, RAR_EXECUTION_CONTEXT_CONFLICT, new Object[]{ec, transactionContext, work, wre});
WorkException wex = new WorkRejectedException("TaskExecutor rejected Work because of timeout: " + work, ex); wex.setErrorCode(WorkException.START_TIMED_OUT); workListenerToUse.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, wex)); WorkException wex = new WorkRejectedException("TaskExecutor rejected Work: " + work, ex); wex.setErrorCode(WorkException.INTERNAL); workListenerToUse.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, wex));
if (WorkException.START_TIMED_OUT.equals(ex.getErrorCode())) { throw new TaskTimeoutException("JCA WorkManager rejected task because of timeout: " + task, ex);
throw new WorkRejectedException("Execution context provided but Work implements WorkContextProvider");
if (WorkException.START_TIMED_OUT.equals(ex.getErrorCode())) { throw new TaskTimeoutException("JCA WorkManager rejected task because of timeout: " + task, ex);
/** * Do first checks for work starting methods * @param work to check * @param startTimeout to check * @param execContext to check * @throws WorkException in case of check don't pass */ public void doFirstChecks(Work work, long startTimeout, ExecutionContext execContext) throws WorkException { if (isShutdown()) throw new WorkRejectedException(bundle.workmanagerShutdown()); if (work == null) throw new WorkRejectedException(bundle.workIsNull()); if (startTimeout < 0) throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout)); checkAndVerifyWork(work, execContext); }
if (WorkException.START_TIMED_OUT.equals(ex.getErrorCode())) { throw new TaskTimeoutException("JCA WorkManager rejected task because of timeout: " + task, ex);
workException = new WorkRejectedException(this + " has timed out.", WorkException.START_TIMED_OUT); workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, worker, workException)); return true;
workException = new WorkRejectedException(this + " has timed out.", WorkException.START_TIMED_OUT); workListener.workRejected(new WorkEvent(this,
/** * Check and verify work before submitting. * @param work the work instance * @param executionContext any execution context that is passed by apadater * @throws WorkException if any exception occurs */ private void checkAndVerifyWork(Work work, ExecutionContext executionContext) throws WorkException { if (specCompliant) { verifyWork(work); } if (work instanceof WorkContextProvider) { //Implements WorkContextProvider and not-null ExecutionContext if (executionContext != null) { throw new WorkRejectedException(bundle.workExecutionContextMustNullImplementsWorkContextProvider()); } } }
throw new WorkRejectedException("Work is null"); throw new WorkRejectedException("StartTimeout is negative: " + startTimeout); exception = new WorkRejectedException(etoe); exception.setErrorCode(WorkRejectedException.START_TIMED_OUT); exception = new WorkRejectedException(ree); exception = new WorkRejectedException("Interrupted while requesting permit");
throw new WorkRejectedException("Work is null"); throw new WorkRejectedException("StartTimeout is negative: " + startTimeout); exception = new WorkRejectedException(etoe); exception.setErrorCode(WorkRejectedException.START_TIMED_OUT); exception = new WorkRejectedException(ree); exception = new WorkRejectedException("Interrupted while requesting permit");
/** * {@link Work}の実行を開始します. * <p> * 実行開始前にタイムアウト時間が経過していた場合は<code>false</code>を返します. * </p> * * @return {@link Work}の実行を開始した場合は<code>true</code> */ protected boolean start() { try { if (isTimedout()) { exception = new WorkRejectedException(); exception.setErrorCode(WorkException.START_TIMED_OUT); fireWorkRejectedEvent(); return false; } fireWorkStartedEvent(); return true; } finally { latch.countDown(); } }
throw new WorkRejectedException("Work is null"); throw new WorkRejectedException("StartTimeout is negative: " + startTimeout); exception = new WorkRejectedException(etoe); exception.setErrorCode(WorkRejectedException.START_TIMED_OUT); exception = new WorkRejectedException(ree); exception = new WorkRejectedException("Interrupted while requesting permit");
public void run() { try { // check if we have started within the specified limit startDelay = System.currentTimeMillis() - created; if (startDelay > startTimeout) { workException = new WorkRejectedException("Work not started within specified timeout " + startTimeout + "ms", WorkException.START_TIMED_OUT); workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, workException, startTimeout)); return; } // notify listener that work has been started workListener.workStarted(new WorkEvent(SimpleWorkManager.this, WorkEvent.WORK_STARTED, work, null)); // officially started started.countDown(); // execute the real work workException = null; try { work.run(); } catch (final Throwable e) { workException = new WorkCompletedException(e); } finally { // notify listener that work completed (with an optional exception) workListener.workCompleted(new WorkEvent(SimpleWorkManager.this, WorkEvent.WORK_COMPLETED, work, workException)); } } finally { // assure that threads waiting for start are released started.countDown(); // Done completed.countDown(); } }
public void run() { try { // check if we have started within the specified limit startDelay = System.currentTimeMillis() - created; if (startDelay > startTimeout) { workException = new WorkRejectedException("Work not started within specified timeout " + startTimeout + "ms", WorkException.START_TIMED_OUT); workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, work, workException, startTimeout)); return; } // notify listener that work has been started workListener.workStarted(new WorkEvent(SimpleWorkManager.this, WorkEvent.WORK_STARTED, work, null)); // officially started started.countDown(); // execute the real work workException = null; try { work.run(); } catch (final Throwable e) { workException = new WorkCompletedException(e); } finally { // notify listener that work completed (with an optional exception) workListener.workCompleted(new WorkEvent(SimpleWorkManager.this, WorkEvent.WORK_COMPLETED, work, workException)); } } finally { // assure that threads waiting for start are released started.countDown(); // Done completed.countDown(); } }
public void run() { try { // check if we have started within the specified limit startDelay = System.currentTimeMillis() - created; if (startDelay > startTimeout) { workException = new WorkRejectedException("Work not started within specified timeout " + startTimeout + "ms", START_TIMED_OUT); workListener.workRejected(new WorkEvent(this, WORK_REJECTED, work, workException, startTimeout)); return; } // notify listener that work has been started workListener.workStarted(new WorkEvent(SimpleWorkManager.this, WORK_STARTED, work, null)); // officially started started.countDown(); // execute the real work workException = null; try { work.run(); } catch (Throwable e) { workException = new WorkCompletedException(e); } finally { // notify listener that work completed (with an optional exception) workListener.workCompleted(new WorkEvent(SimpleWorkManager.this, WORK_COMPLETED, work, workException)); } } finally { // assure that threads waiting for start are released started.countDown(); // Done completed.countDown(); } }
/** * Times out the thread */ private void workTimedOut() { setState(TIMEDOUT); exception = new WorkRejectedException(); exception.setErrorCode(WorkException.START_TIMED_OUT); if (listener != null) { listener.workRejected( new WorkEvent(this, WorkEvent.WORK_REJECTED, work, exception)); } if (probeProvider != null) { probeProvider.workTimedOut(raName); } }