Package java.util.concurrent

Examples of java.util.concurrent.RejectedExecutionException


    public void execute(Runnable command) {
        try {
            semaphore.acquire();
        } catch (InterruptedException e) {
            throw new RejectedExecutionException(e);
        }
        try {
            executor.execute(command);
        } catch (RejectedExecutionException ree) {
            throw ree;
View Full Code Here


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

    });
  }

  private void checkForTermination() {
    if (terminated) {
      throw new RejectedExecutionException();
    }
  }
View Full Code Here

  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    Action action = getAction(method);
    if (action == null) {
      String msg = "无法获取" + proxy.getClass() + "." + method.getName() + "方法声明的Action实例。";
      log.error(msg);
      throw new RejectedExecutionException(msg);
    } else {
      ActionContext context = action.getContext();
      context.setAction(action);
      return context.execute(method, args);
    }
View Full Code Here

            if(!executor.isShutdown()) {
                try {
                    executor.getQueue().put(r);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw new RejectedExecutionException(e);
                }
            }
        }
View Full Code Here

            execute(work);
        } catch (RejectedExecutionException ree) {
            try {
                getQueue().offer(work, timeout, TimeUnit.MILLISECONDS);
            } catch (InterruptedException ie) {
                throw new RejectedExecutionException(ie);
            }
        }   
    }
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

      {
         exec.execute(command);
         return;
      }
     
      throw new RejectedExecutionException("No executor available in " + this.getClass().getName());
   }
View Full Code Here

                }
                catch (Throwable t) {
                    logger.warn("failed to resume resource: " + resource, t);
                }
            } else if (policy == POLICY.REJECT) {
                throw new RejectedExecutionException(String.format("Maximum suspended AtmosphereResources %s", maxSuspendResource));
            }
        }

        if (resources.contains(r)) {
            return r;
View Full Code Here

        // can we still run
        if (!isRunAllowed()) {
            log.trace("Run not allowed, will reject executing exchange: {}", exchange);
            if (exchange.getException() == null) {
                exchange.setException(new RejectedExecutionException("Run is not allowed"));
            }
            callback.done(true);
            return true;
        }

        if (failures.get() >= threshold && System.currentTimeMillis() - lastFailure < halfOpenAfter) {
            exchange.setException(new RejectedExecutionException("CircuitBreaker Open: failures: " + failures + ", lastFailure: " + lastFailure));
            /*
             * If the circuit opens, we have to prevent the execution of any processor.
             * The failures count can be set to 0.
             */
            failures.set(0);
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.