@ Override public boolean close ( ) { this . open = false ; for ( int i = 0 ; i < listeningStreams . get ( ) ; i ++ ) { try { this . queue . offer ( ( T ) POISON_PILL ) ; } catch ( Exception e ) { } } return true ; }
Close this Queue Poison Pills are used to communicate closure to connected Streams A Poison Pill is added per connected Stream to the Queue If a BlockingQueue is backing this async . Queue it will block until able to add to the Queue .