Code example for AtomicBoolean

Methods: get

0
     */ 
    private void sayLater(final String speech, final long delay) {
        speechHandler.postDelayed(new Runnable() {
            public void run() { 
                try { 
                    if (!isShutdown.get()) {
                        if (ttsLatch.await(10, TimeUnit.MILLISECONDS)) {
                            tts.speak(speech, TextToSpeech.QUEUE_FLUSH, null);
                        } else { 
                            sayLater(speech, 100L);
                        } 
                    } 
                } catch (InterruptedException e) {
                    // restore interrupt 
                    Thread.currentThread().interrupt();
                } 
            } 
        }, delay);
    } 
 
    /**