Package java.util.concurrent

Examples of java.util.concurrent.RejectedExecutionException


    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        final ScheduledExecutorService badService = new ScheduledThreadPoolExecutor(1) {
            @Override
            public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
                throw new RejectedExecutionException();
            }
        };

        return new RouteBuilder() {
            @Override
View Full Code Here


    }

    public boolean process(final Exchange exchange, AsyncCallback callback) {
        if (!isRunAllowed()) {
            if (exchange.getException() == null) {
                exchange.setException(new RejectedExecutionException());
            }
            callback.done(true);
            return true;
        }
View Full Code Here

                   }
                }

                String emsg = _jbr.getKString(_jbr.W_ASYNC_CMD_IN_PROCESS, newreq, oldreq);
                _logger.log(Level.WARNING, emsg);
                throw new RejectedExecutionException(emsg);
            }
            return;
        }
    }
View Full Code Here

  private boolean shutdownCalled = false;

  @Override
  public void execute(Runnable command) throws RejectedExecutionException {
    if (shutdownCalled) {
      throw new RejectedExecutionException();
    }
    thingsToExecute.add(command);
    numTasks.release();
  }
View Full Code Here

    private void addToQueue(Runnable command, long timeout, TimeUnit unit) {
        try {
            boolean added = executor.getQueue().offer(command, timeout, unit);
            if (!added) {
                throw new RejectedExecutionException();
            }
        } catch (InterruptedException e) {
            throw new RejectedExecutionException(e);
        }
    }
View Full Code Here

        public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) throws RejectedExecutionException {
            try {
                executor.getQueue().put(r);
            }
            catch (InterruptedException e) {
                throw new RejectedExecutionException(e);
            }
        }
View Full Code Here

        public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
            try {
                final Thread t = new Thread(r, "Temporary task executor");
                t.start();
            } catch (Throwable e) {
                throw new RejectedExecutionException(
                        "Failed to start a new thread", e);
            }
        }
View Full Code Here

     */
    private void startTask() {
      lock.lock();
      try {
        if (isShutdown()) {
          throw new RejectedExecutionException("Executor already shutdown");
        }
        runningTasks++;
      } finally {
        lock.unlock();
      }
View Full Code Here

         {
            executor.getQueue().put(r);
         }
         catch (InterruptedException e)
         {
            throw new RejectedExecutionException(e);
         }
      }
View Full Code Here

                    "Command was not Serializable or Streamable - "
                            + serializeCheck);
            }
        }
        else {
            throw new RejectedExecutionException();
        }
    }
View Full Code Here

TOP

Related Classes of java.util.concurrent.RejectedExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.