Code example for ScheduledExecutorService

Methods: awaitTermination

0
    } 
 
    @UsedForTesting 
    public void awaitTermination(final long delay, final TimeUnit timeUnit) {
        try { 
            if (!mExecutor.awaitTermination(delay, timeUnit)) {
                Log.e(TAG, "ResearchLog executor timed out while awaiting terminaion");
            } 
        } catch (final InterruptedException e) {
            Log.e(TAG, "ResearchLog executor interrupted while awaiting terminaion", e);
        } 
    } 
 
    /* package */ synchronized void flush() { 
        removeAnyScheduledFlush(); 
        mExecutor.submit(mFlushCallable);
    } 
 
    private final Callable<Object> mFlushCallable = new Callable<Object>() {
        @Override 
        public Object call() throws Exception {