public static < T > T queueAndWait ( RunQueue runq , final String name , final Callable < T > action ) throws ServiceException { final ServletWaiter < T > waiter = new ServletWaiter < T > ( name ) ; runq . postRunnable ( new Runnable ( ) { public void run ( ) { try { waiter . postSuccess ( action . call ( ) ) ; } catch ( final Exception e ) { waiter . postFailure ( e ) ; } } } ) ; return waiter . waitForResult ( ) ; }
Posts a result getter to be executed on the run queue thread and blocks waiting for the result .