Package java.util.concurrent

Examples of java.util.concurrent.RejectedExecutionException


                executor.execute(command);
            } catch (RejectedExecutionException rx) {
                //there could have been contention around the queue
                if ( !( (TaskQueue) executor.getQueue()).force(command) ) {
                  submittedTasksCount.decrementAndGet();
                  throw new RejectedExecutionException("Work queue full.");
                }
            }
        } else throw new IllegalStateException("StandardThreadPool not started.");
    }
View Full Code Here


        public void setParent(ThreadPoolExecutor tp) {
            parent = tp;
        }
       
        public boolean force(Runnable o) {
            if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
            return super.offer(o); //forces the item onto the queue, to be used if the task is rejected
        }
View Full Code Here

            if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
            return super.offer(o); //forces the item onto the queue, to be used if the task is rejected
        }

        public boolean force(Runnable o, long timeout, TimeUnit unit) throws InterruptedException {
            if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
            return super.offer(o,timeout,unit); //forces the item onto the queue, to be used if the task is rejected
        }
View Full Code Here

    }

    public Exchange receive() {
        // must be started
        if (!isRunAllowed() || !isStarted()) {
            throw new RejectedExecutionException(this + " is not started, but in state: " + getStatus().name());
        }

        while (isRunAllowed()) {
            try {
                beforePoll(0);
View Full Code Here

    }

    public Exchange receive(long timeout) {
        // must be started
        if (!isRunAllowed() || !isStarted()) {
            throw new RejectedExecutionException(this + " is not started, but in state: " + getStatus().name());
        }

        try {
            // use the timeout value returned from beforePoll
            timeout = beforePoll(timeout);
View Full Code Here

                        return;
                    }

                    try {
                        if (!tpe.getQueue().offer(r, 30, TimeUnit.SECONDS)) {
                            throw new RejectedExecutionException("Timeout waiting for executor slot");
                        }
                    } catch (InterruptedException e) {
                        throw new RejectedExecutionException("Interrupted waiting for executor slot");
                    }
                }
            }
            );
            ((ThreadPoolExecutor) this.executor).allowCoreThreadTimeOut(true);
View Full Code Here

                executor.execute(command);
            } catch (RejectedExecutionException rx) {
                //there could have been contention around the queue
                if ( !( (TaskQueue) executor.getQueue()).force(command) ) {
                  submittedTasksCount.decrementAndGet();
                  throw new RejectedExecutionException();
                }
            }
        } else throw new IllegalStateException("StandardThreadPool not started.");
    }
View Full Code Here

        public void setParent(ThreadPoolExecutor tp) {
            parent = tp;
        }
       
        public boolean force(Runnable o) {
            if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
            return super.offer(o); //forces the item onto the queue, to be used if the task is rejected
        }
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

        // determine if we can still run, or the camel context is forcing a shutdown
        boolean forceShutdown = exchange.getContext().getShutdownStrategy().forceShutdown(this);
        if (forceShutdown) {
            LOG.debug("Run not allowed as ShutdownStrategy is forcing shutting down, will reject executing exchange: {}", exchange);
            if (exchange.getException() == null) {
                exchange.setException(new RejectedExecutionException());
            }
            return false;
        }

        // yes we can continue
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.