@ Override public < A extends Annotation > void registerOverrideReferenceFactory ( Class < A > annotation , OverrideReferenceFactory < A > factory ) throws InjectionException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "registerOverrideReferenceFactory" , annotation , factory ) ; if ( annotation == null || factory == null ) { throw new IllegalArgumentException ( "Null arguments are not allowed: " + annotation + ", " + factory ) ; } // Now add the new factory to the map, per annotation. synchronized ( this ) { HashMap < Class < ? extends Annotation > , OverrideReferenceFactory < ? > [ ] > map = ivOverrideReferenceFactoryMap ; if ( ivOverrideReferenceFactoryMapCopyOnWrite ) // PM79779 F743-32696 { HashMap < Class < ? extends Annotation > , OverrideReferenceFactory < ? > [ ] > newMap = new HashMap < Class < ? extends Annotation > , OverrideReferenceFactory < ? > [ ] > ( ) ; for ( Map . Entry < Class < ? extends Annotation > , OverrideReferenceFactory < ? > [ ] > entry : map . entrySet ( ) ) { OverrideReferenceFactory < ? > [ ] value = entry . getValue ( ) ; OverrideReferenceFactory < ? > [ ] newValue = new OverrideReferenceFactory [ value . length ] ; System . arraycopy ( value , 0 , newValue , 0 , value . length ) ; newMap . put ( entry . getKey ( ) , newValue ) ; } map = newMap ; } OverrideReferenceFactory < ? > [ ] factories = map . get ( annotation ) ; if ( factories == null ) { if ( ! ivProcessorProviders . containsKey ( annotation ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "registerOverrideReferenceFactory: An injection " + "processor does not exist for the specified annotation: " + annotation . getName ( ) ) ; throw new InjectionException ( "An injection processor does not exist for the specified annotation: " + annotation . getName ( ) ) ; } factories = new OverrideReferenceFactory [ 1 ] ; factories [ 0 ] = factory ; map . put ( annotation , factories ) ; } else { OverrideReferenceFactory < ? > [ ] newFactories = new OverrideReferenceFactory [ factories . length + 1 ] ; System . arraycopy ( factories , 0 , newFactories , 0 , factories . length ) ; newFactories [ factories . length ] = factory ; map . put ( annotation , newFactories ) ; } if ( ivOverrideReferenceFactoryMapCopyOnWrite ) // PM79779 F743-32696 { // Replace exiting map after all updates have been made. ivOverrideReferenceFactoryMap = map ; ivOverrideReferenceFactoryMapCopyOnWrite = false ; } } }
F1339 - 9050