@ Override public void doWork ( Work work , long startTimeout , ExecutionContext execContext , WorkListener workListener ) throws WorkException { try { beforeRunCheck ( work , workListener , startTimeout ) ; new WorkProxy ( work , startTimeout , execContext , workListener , bootstrapContext , runningWork , false ) . call ( ) ; } catch ( WorkException ex ) { throw ex ; } catch ( Throwable t ) { WorkRejectedException wrex = new WorkRejectedException ( t ) ; wrex . setErrorCode ( WorkException . INTERNAL ) ; if ( workListener != null ) workListener . workRejected ( new WorkEvent ( work , WorkEvent . WORK_REJECTED , work , wrex ) ) ; throw wrex ; } }
This method does not return until the work is completed as the caller expects to wait until the work is completed before getting control back . This method accomplishes this by NOT spinning a thread .