Code example for ScheduledThreadPoolExecutor

Methods: schedule

0
    @Override 
    public Future<?> execute(Runnable r, long initDelay, long period) {
         
        if(period == 0)
        { 
            return execService.schedule(r, initDelay,TimeUnit.MILLISECONDS);
        } 
        else 
        { 
            return execService.scheduleAtFixedRate(r, initDelay, period, TimeUnit.MILLISECONDS);
        } 
    } 
 
    @Override 
    public Future<?> execute(Runnable r, long period) {
        return execute(r,0,period);
    } 
 
    @Override 
    public Future<?> execute(Runnable r) {
        return execute(r,0,0);