Code example for ScheduledFuture

Methods: cancel

0
 
    private ScheduledFuture<Object> mFlushFuture;
 
    private void removeAnyScheduledFlush() { 
        if (mFlushFuture != null) {
            mFlushFuture.cancel(false);
            mFlushFuture = null;
        } 
    } 
 
    private void scheduleFlush() { 
        removeAnyScheduledFlush(); 
        mFlushFuture = mExecutor.schedule(mFlushCallable, FLUSH_DELAY_IN_MS, TimeUnit.MILLISECONDS);
    } 
 
    /** 
     * Queues up {@code logUnit} to be published in the background. 
     * 
     * @param logUnit the {@link LogUnit} to be published 
     * @param canIncludePrivateData whether private data in the LogUnit should be included 
     */