@ Trivial private void beforeRunCheck ( Work work , WorkListener workListener , long startTimeout ) throws WorkRejectedException { WorkRejectedException wrex = null ; if ( work == null ) { wrex = new WorkRejectedException ( new NullPointerException ( "work" ) ) ; wrex . setErrorCode ( WorkException . UNDEFINED ) ; } else if ( startTimeout < WorkManager . IMMEDIATE ) wrex = new WorkRejectedException ( "startTimeout=" + startTimeout , WorkException . START_TIMED_OUT ) ; else if ( stopped ) wrex = new WorkRejectedException ( new UnavailableException ( bootstrapContext . resourceAdapterID ) ) ; if ( wrex != null ) { if ( workListener != null ) { WorkEvent event = new WorkEvent ( work == null ? this : work , WorkEvent . WORK_REJECTED , work , wrex ) ; workListener . workRejected ( event ) ; } throw wrex ; } }
Input parameter checks that can be done before calling run .