Code example for ScheduledThreadPoolExecutor

Methods: setRemoveOnCancelPolicy

0
 
        @Override 
        protected void doStart() 
                throws Exceptionscheduler = new ScheduledThreadPoolExecutor(1, new ThreadFactory()
            { 
                @Override 
                public Thread newThread(Runnable runnable)
                { 
                    Thread thread = new Thread(threadGroup, runnable);
                    thread.setName(name + "-" + thread.getId());
                    thread.setDaemon(true);
                    return thread;
                } 
            }); 
            scheduler.setRemoveOnCancelPolicy(true);
            super.doStart(); 
        } 
 
        @Override 
        protected void doStop() 
Experience pair programming with AI  Get Codota for Java