Code example for ScheduledThreadPoolExecutor

Methods: shutdownNow

0
        }); 
    } 
 
    @Override 
    public void onDestroy() { 
    	executor.shutdownNow();
    	super.onDestroy(); 
    } 
     
    private void initTimer(int timeoutInSeconds) {
        if (executor == null) {
            executor = new ScheduledThreadPoolExecutor(1);
        } 
		 
        checker = new LogoutChecker(executor, timeoutInSeconds, TimeUnit.SECONDS);
        checker.reset();
        checker.reschedule(TimeUnit.SECONDS.toMillis(timeoutInSeconds));
		 
        if (DEBUG) Log.d(LOG_TAG, "checker initialized, callback: "+callback);
    } 
Connect your IDE to all the code out there  Get Codota for Java