protected static boolean runRejectedTask ( Runnable runnable , ThreadPoolExecutor executor ) { // Runs the task directly in the calling thread of the {@code execute} method, // unless the executor has been shut down, in which case the task // is discarded. if ( ! executor . isShutdown ( ) ) { runnable . run ( ) ; return true ; } return false ; }
Run the given task within the current thread if the executor is not shut down . The task is not run by the given executor . The executor is used for checking if the executor service is shut down .