Code example for RejectedExecutionException

0
        if ( executor != null ) {
            try { 
                executor.execute(command);
            } catch (RejectedExecutionException rx) {
                //there could have been contention around the queue 
                if ( !( (TaskQueue) executor.getQueue()).force(command) ) throw new RejectedExecutionException("Work queue full.");
            } 
        } else throw new IllegalStateException("StandardThreadPool not started.");
    } 
     
    public void contextStopping() { 
        if (executor != null) {
            executor.contextStopping();
        } 
    } 
 
    public int getThreadPriority() { 
        return threadPriority;
    } 
 
    public boolean isDaemon() {