private ModelActionEntry pollAction ( ) { ModelActionEntry action = null ; while ( ! stop ) { synchronized ( actionQueue ) { action = this . actionQueue . poll ( ) ; } if ( action != null ) { break ; } else { synchronized ( semaphore ) { try { semaphore . wait ( ) ; } catch ( InterruptedException ex ) { ex . printStackTrace ( ) ; ////////// } } } } return action ; }
Retrieves an action from the queue It is a blocking method it blocks until an action is available in the queue or the processing pool is stopped