public synchronized void removeWorkManager ( String id ) { if ( id == null || id . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The id of WorkManager is invalid: " + id ) ; Integer i = refCountWorkmanagers . get ( id ) ; if ( i != null ) { int newValue = i . intValue ( ) - 1 ; if ( newValue == 0 ) { if ( trace ) log . tracef ( "Removed WorkManager: %s" , id ) ; WorkManager wm = activeWorkmanagers . get ( id ) ; if ( wm instanceof DistributedWorkManager ) { DistributedWorkManager dwm = ( DistributedWorkManager ) wm ; if ( dwm . getTransport ( ) != null ) dwm . getTransport ( ) . unregister ( new Address ( wm . getId ( ) , wm . getName ( ) , dwm . getTransport ( ) . getId ( ) ) ) ; } activeWorkmanagers . remove ( id ) ; refCountWorkmanagers . remove ( id ) ; } else { if ( trace ) log . tracef ( "DerefCount WorkManager: %s" , id ) ; refCountWorkmanagers . put ( id , Integer . valueOf ( newValue ) ) ; } } }
Remove a work manager