public void deactivate ( ) throws InvalidStateException , TransactionRequiredLocalException { if ( ! this . state . isActive ( ) ) { throw new InvalidStateException ( "entity " + name + " is in state: " + this . state ) ; } this . state = ResourceAdaptorEntityState . STOPPING ; if ( object . getState ( ) == ResourceAdaptorObjectState . ACTIVE ) { object . raStopping ( ) ; } // tck requires that the method returns with stopping state so do // all deactivation logic half a sec later TimerTask t = new TimerTask ( ) { @ Override public void run ( ) { try { cancel ( ) ; if ( state == ResourceAdaptorEntityState . STOPPING ) { if ( object . getState ( ) == ResourceAdaptorObjectState . STOPPING ) { scheduleAllActivitiesEnd ( ) ; } else { allActivitiesEnded ( ) ; } } } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } ; resourceAdaptorContext . getTimer ( ) . schedule ( t , 500 ) ; }
Deactivates the ra entity