@Override public void execute(Runnable command) { Runnable decorated = taskDecorator.decorate(command); if (decorated != command) { decoratedTaskMap.put(decorated, command); } super.execute(decorated); } };
/** * Actually execute the given {@code Runnable} (which may be a user-supplied task * or a wrapper around a user-supplied task) with the given executor. * @param concurrentExecutor the underlying JDK concurrent executor to delegate to * @param taskDecorator the specified decorator to be applied, if any * @param runnable the runnable to execute * @throws RejectedExecutionException if the given runnable cannot be accepted * @since 4.3 */ protected void doExecute(Executor concurrentExecutor, @Nullable TaskDecorator taskDecorator, Runnable runnable) throws RejectedExecutionException{ concurrentExecutor.execute(taskDecorator != null ? taskDecorator.decorate(runnable) : runnable); }
@Override public void execute(Runnable command) { Runnable decorated = taskDecorator.decorate(command); if (decorated != command) { decoratedTaskMap.put(decorated, command); } super.execute(decorated); } };
/** * Actually execute the given {@code Runnable} (which may be a user-supplied task * or a wrapper around a user-supplied task) with the given executor. * @param concurrentExecutor the underlying JDK concurrent executor to delegate to * @param taskDecorator the specified decorator to be applied, if any * @param runnable the runnable to execute * @throws RejectedExecutionException if the given runnable cannot be accepted * @since 4.3 */ protected void doExecute(Executor concurrentExecutor, @Nullable TaskDecorator taskDecorator, Runnable runnable) throws RejectedExecutionException{ concurrentExecutor.execute(taskDecorator != null ? taskDecorator.decorate(runnable) : runnable); }
/** * Executes the given task, within a concurrency throttle * if configured (through the superclass's settings). * <p>Executes urgent tasks (with 'immediate' timeout) directly, * bypassing the concurrency throttle (if active). All other * tasks are subject to throttling. * @see #TIMEOUT_IMMEDIATE * @see #doExecute(Runnable) */ @Override public void execute(Runnable task, long startTimeout) { Assert.notNull(task, "Runnable must not be null"); Runnable taskToUse = (this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); if (isThrottleActive() && startTimeout > TIMEOUT_IMMEDIATE) { this.concurrencyThrottle.beforeAccess(); doExecute(new ConcurrencyThrottlingRunnable(taskToUse)); } else { doExecute(taskToUse); } }
/** * Executes the given task, within a concurrency throttle * if configured (through the superclass's settings). * <p>Executes urgent tasks (with 'immediate' timeout) directly, * bypassing the concurrency throttle (if active). All other * tasks are subject to throttling. * @see #TIMEOUT_IMMEDIATE * @see #doExecute(Runnable) */ @Override public void execute(Runnable task, long startTimeout) { Assert.notNull(task, "Runnable must not be null"); Runnable taskToUse = (this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); if (isThrottleActive() && startTimeout > TIMEOUT_IMMEDIATE) { this.concurrencyThrottle.beforeAccess(); doExecute(new ConcurrencyThrottlingRunnable(taskToUse)); } else { doExecute(taskToUse); } }
@Override public void execute(Runnable task) { Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); try { if (this.workListener != null) { obtainWorkManager().schedule(work, this.workListener); } else { obtainWorkManager().schedule(work); } } catch (WorkRejectedException ex) { throw new TaskRejectedException("CommonJ WorkManager did not accept task: " + task, ex); } catch (WorkException ex) { throw new SchedulingException("Could not schedule task on CommonJ WorkManager", ex); } }
@Override public void execute(Runnable task) { Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); try { if (this.workListener != null) { obtainWorkManager().schedule(work, this.workListener); } else { obtainWorkManager().schedule(work); } } catch (WorkRejectedException ex) { throw new TaskRejectedException("CommonJ WorkManager did not accept task: " + task, ex); } catch (WorkException ex) { throw new SchedulingException("Could not schedule task on CommonJ WorkManager", ex); } }
@Override public void execute(Runnable task, long startTimeout) { Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); try { if (this.blockUntilCompleted) {
@Override public void execute(Runnable task, long startTimeout) { Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); try { if (this.blockUntilCompleted) {
/** * Actually execute the given {@code Runnable} (which may be a user-supplied task * or a wrapper around a user-supplied task) with the given executor. * @param concurrentExecutor the underlying JDK concurrent executor to delegate to * @param taskDecorator the specified decorator to be applied, if any * @param runnable the runnable to execute * @throws RejectedExecutionException if the given runnable cannot be accepted * @since 4.3 */ protected void doExecute(Executor concurrentExecutor, @Nullable TaskDecorator taskDecorator, Runnable runnable) throws RejectedExecutionException{ concurrentExecutor.execute(taskDecorator != null ? taskDecorator.decorate(runnable) : runnable); }
@Override public void execute(Runnable command) { Runnable decorated = taskDecorator.decorate(command); if (decorated != command) { decoratedTaskMap.put(decorated, command); } super.execute(decorated); } };
/** * Actually execute the given {@code Runnable} (which may be a user-supplied task * or a wrapper around a user-supplied task) with the given executor. * @param concurrentExecutor the underlying JDK concurrent executor to delegate to * @param taskDecorator the specified decorator to be applied, if any * @param runnable the runnable to execute * @throws RejectedExecutionException if the given runnable cannot be accepted * @since 4.3 */ protected void doExecute(Executor concurrentExecutor, @Nullable TaskDecorator taskDecorator, Runnable runnable) throws RejectedExecutionException{ concurrentExecutor.execute(taskDecorator != null ? taskDecorator.decorate(runnable) : runnable); }
/** * Executes the given task, within a concurrency throttle * if configured (through the superclass's settings). * <p>Executes urgent tasks (with 'immediate' timeout) directly, * bypassing the concurrency throttle (if active). All other * tasks are subject to throttling. * @see #TIMEOUT_IMMEDIATE * @see #doExecute(Runnable) */ @Override public void execute(Runnable task, long startTimeout) { Assert.notNull(task, "Runnable must not be null"); Runnable taskToUse = (this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); if (isThrottleActive() && startTimeout > TIMEOUT_IMMEDIATE) { this.concurrencyThrottle.beforeAccess(); doExecute(new ConcurrencyThrottlingRunnable(taskToUse)); } else { doExecute(taskToUse); } }
/** * Executes the given task, within a concurrency throttle * if configured (through the superclass's settings). * <p>Executes urgent tasks (with 'immediate' timeout) directly, * bypassing the concurrency throttle (if active). All other * tasks are subject to throttling. * @see #TIMEOUT_IMMEDIATE * @see #doExecute(Runnable) */ @Override public void execute(Runnable task, long startTimeout) { Assert.notNull(task, "Runnable must not be null"); Runnable taskToUse = (this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); if (isThrottleActive() && startTimeout > TIMEOUT_IMMEDIATE) { this.concurrencyThrottle.beforeAccess(); doExecute(new ConcurrencyThrottlingRunnable(taskToUse)); } else { doExecute(taskToUse); } }
public void execute(Runnable task) { Assert.state(this.workManager != null, "No WorkManager specified"); Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); try { if (this.workListener != null) {
@Override public void execute(Runnable task, long startTimeout) { Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); try { if (this.blockUntilCompleted) {
@Override public void execute(Runnable task, long startTimeout) { Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); try { if (this.blockUntilCompleted) {