@Override public void run() { log.debug( "up and running" ); //noinspection InfiniteLoopStatement while ( true ) { if ( Thread.currentThread().isInterrupted() ) { log.debug( "Thread has been interrupted --> exiting" ); return; } try { log.debug( "waiting for next callback" ); T callback = support.waitForNextCallback(); log.debug( "got callback" ); Object returnValue; synchronized ( support ) { returnValue = execute( callback ); } log.debug( "executed" ); support.acknowledge( callback, returnValue ); log.debug( "acknowledged" ); } catch ( InterruptedException ignore ) { log.debug( "Thread has been interrupted --> exiting" ); return; } } }
@Override public void run() { log.debug( "up and running" ); //noinspection InfiniteLoopStatement while ( true ) { if ( Thread.currentThread().isInterrupted() ) { log.debug( "Thread has been interrupted --> exiting" ); return; } try { log.debug( "waiting for next callback" ); T callback = support.waitForNextCallback(); log.debug( "got callback" ); Object returnValue; synchronized ( support ) { returnValue = execute( callback ); } log.debug( "executed" ); support.acknowledge( callback, returnValue ); log.debug( "acknowledged" ); } catch ( InterruptedException ignore ) { log.debug( "Thread has been interrupted --> exiting" ); return; } } }