/** * Add a task to the task queue, or throws a {@link RejectedExecutionException} if this instance was shutdown * before. */ protected void addTask(Runnable task) { if (task == null) { throw new NullPointerException("task"); } if (!offerTask(task)) { reject(task); } }
/** * Add a task to the task queue, or throws a {@link RejectedExecutionException} if this instance was shutdown * before. */ protected void addTask(Runnable task) { if (task == null) { throw new NullPointerException("task"); } if (!offerTask(task)) { reject(task); } }
/** * Add a task to the task queue, or throws a {@link RejectedExecutionException} if this instance was shutdown * before. */ protected void addTask(Runnable task) { if (task == null) { throw new NullPointerException("task"); } if (!offerTask(task)) { reject(task); } }
@Override public void rejected(Runnable task, SingleThreadEventExecutor executor) { if (!executor.inEventLoop()) { for (int i = 0; i < retries; i++) { // Try to wake up the executor so it will empty its task queue. executor.wakeup(false); LockSupport.parkNanos(backOffNanos); if (executor.offerTask(task)) { return; } } } // Either we tried to add the task from within the EventLoop or we was not able to add it even with // backoff. throw new RejectedExecutionException(); } };
@Override public void rejected(Runnable task, SingleThreadEventExecutor executor) { if (!executor.inEventLoop()) { for (int i = 0; i < retries; i++) { // Try to wake up the executor so it will empty its task queue. executor.wakeup(false); LockSupport.parkNanos(backOffNanos); if (executor.offerTask(task)) { return; } } } // Either we tried to add the task from within the EventLoop or we was not able to add it even with // backoff. throw new RejectedExecutionException(); } };
@Override public void rejected(Runnable task, SingleThreadEventExecutor executor) { if (!executor.inEventLoop()) { for (int i = 0; i < retries; i++) { // Try to wake up the executor so it will empty its task queue. executor.wakeup(false); LockSupport.parkNanos(backOffNanos); if (executor.offerTask(task)) { return; } } } // Either we tried to add the task from within the EventLoop or we was not able to add it even with // backoff. throw new RejectedExecutionException(); } };
/** * Add a task to the task queue, or throws a {@link RejectedExecutionException} if this instance was shutdown * before. */ protected void addTask(Runnable task) { if (task == null) { throw new NullPointerException("task"); } if (!offerTask(task)) { reject(task); } }
@Override public void rejected(Runnable task, SingleThreadEventExecutor executor) { if (!executor.inEventLoop()) { for (int i = 0; i < retries; i++) { // Try to wake up the executor so it will empty its task queue. executor.wakeup(false); LockSupport.parkNanos(backOffNanos); if (executor.offerTask(task)) { return; } } } // Either we tried to add the task from within the EventLoop or we was not able to add it even with // backoff. throw new RejectedExecutionException(); } };
/** * Add a task to the task queue, or throws a {@link RejectedExecutionException} if this instance was shutdown * before. */ protected void addTask(Runnable task) { if (task == null) { throw new NullPointerException("task"); } if (!offerTask(task)) { reject(task); } }
/** * Add a task to the task queue, or throws a {@link RejectedExecutionException} if this instance was shutdown * before. */ protected void addTask(Runnable task) { if (task == null) { throw new NullPointerException("task"); } if (!offerTask(task)) { reject(task); } }
/** * Add a task to the task queue, or throws a {@link RejectedExecutionException} if this instance was shutdown * before. */ protected void addTask(Runnable task) { if (task == null) { throw new NullPointerException("task"); } if (!offerTask(task)) { reject(task); } }
@Override public void rejected(Runnable task, SingleThreadEventExecutor executor) { if (!executor.inEventLoop()) { for (int i = 0; i < retries; i++) { // Try to wake up the executor so it will empty its task queue. executor.wakeup(false); LockSupport.parkNanos(backOffNanos); if (executor.offerTask(task)) { return; } } } // Either we tried to add the task from within the EventLoop or we was not able to add it even with // backoff. throw new RejectedExecutionException(); } };
@Override public void rejected(Runnable task, SingleThreadEventExecutor executor) { if (!executor.inEventLoop()) { for (int i = 0; i < retries; i++) { // Try to wake up the executor so it will empty its task queue. executor.wakeup(false); LockSupport.parkNanos(backOffNanos); if (executor.offerTask(task)) { return; } } } // Either we tried to add the task from within the EventLoop or we was not able to add it even with // backoff. throw new RejectedExecutionException(); } };
@Override public void rejected(Runnable task, SingleThreadEventExecutor executor) { if (!executor.inEventLoop()) { for (int i = 0; i < retries; i++) { // Try to wake up the executor so it will empty its task queue. executor.wakeup(false); LockSupport.parkNanos(backOffNanos); if (executor.offerTask(task)) { return; } } } // Either we tried to add the task from within the EventLoop or we was not able to add it even with // backoff. throw new RejectedExecutionException(); } };