public synchronized CloneableBootstrapContext createBootstrapContext ( String id , String name ) { if ( id == null || id . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The id of BootstrapContext is invalid: " + id ) ; // Check for an active BC if ( activeBootstrapContexts . keySet ( ) . contains ( id ) ) { Integer i = refCountBootstrapContexts . get ( id ) ; refCountBootstrapContexts . put ( id , Integer . valueOf ( i . intValue ( ) + 1 ) ) ; return activeBootstrapContexts . get ( id ) ; } try { // Create a new instance CloneableBootstrapContext template = null ; if ( name != null ) { template = bootstrapContexts . get ( name ) ; } else { template = defaultBootstrapContext ; } if ( template == null ) throw new IllegalArgumentException ( "The BootstrapContext wasn't found: " + name ) ; CloneableBootstrapContext bc = template . clone ( ) ; bc . setId ( id ) ; org . ironjacamar . core . api . workmanager . WorkManager wm = workManagerCoordinator . createWorkManager ( id , bc . getWorkManagerName ( ) ) ; bc . setWorkManager ( wm ) ; activeBootstrapContexts . put ( id , bc ) ; refCountBootstrapContexts . put ( id , Integer . valueOf ( 1 ) ) ; if ( trace ) log . tracef ( "Created BootstrapContext: %s" , bc ) ; return bc ; } catch ( Throwable t ) { throw new IllegalStateException ( "The BootstrapContext couldn't be created: " + name , t ) ; } }
Get a bootstrap context