Code example for ExecutorService

Methods: awaitTermination, execute, shutdown

0
        } 
    } 
 
    protected final void postSurfaceDestroyed() { 
        if (mExecutor != null) {
            mExecutor.execute(new Runnable() {
                public void run() { 
                    onSurfaceDestroyed(); 
                } 
            }); 
 
            try { 
                mExecutor.shutdown();
                mExecutor.awaitTermination(-1, TimeUnit.SECONDS);
            } catch (InterruptedException ex) {
                Log.w(LOG_TAG, "", ex);
            } finally { 
                mExecutor = null;
            } 
        } 
    }