public DistributedWorkManager resolveDistributedWorkManager ( Address address ) { if ( trace ) { log . tracef ( "resolveDistributedWorkManager(%s)" , address ) ; log . tracef ( " ActiveWorkManagers: %s" , activeWorkmanagers ) ; } WorkManager wm = activeWorkmanagers . get ( address . getWorkManagerId ( ) ) ; if ( wm != null ) { if ( wm instanceof DistributedWorkManager ) { if ( trace ) log . tracef ( " WorkManager: %s" , wm ) ; return ( DistributedWorkManager ) wm ; } else { if ( trace ) log . tracef ( " WorkManager not distributable: %s" , wm ) ; return null ; } } try { // Create a new instance WorkManager template = workmanagers . get ( address . getWorkManagerName ( ) ) ; if ( template != null ) { wm = template . clone ( ) ; wm . setId ( address . getWorkManagerId ( ) ) ; if ( wm instanceof DistributedWorkManager ) { DistributedWorkManager dwm = ( DistributedWorkManager ) wm ; dwm . initialize ( ) ; activeWorkmanagers . put ( address . getWorkManagerId ( ) , dwm ) ; refCountWorkmanagers . put ( address . getWorkManagerId ( ) , Integer . valueOf ( 0 ) ) ; if ( trace ) log . tracef ( "Created WorkManager: %s" , dwm ) ; return dwm ; } } } catch ( Throwable t ) { //throw new IllegalStateException("The WorkManager couldn't be created: " + name); } return null ; }
Resolve a distributed work manager