public long addEntry ( UniqueKeyGenerator generator ) throws PersistenceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addEntry" , "GeneratorName=" + generator . getName ( ) ) ; if ( ! _generators . containsKey ( generator . getName ( ) ) ) { Transaction transaction = null ; try { transaction = _objectManager . getTransaction ( ) ; // Add the ManagedObject for this generator UniqueKeyGeneratorManagedObject uniqueKey = new UniqueKeyGeneratorManagedObject ( generator ) ; Token uniqueKeyToken = _objectStore . allocate ( uniqueKey ) ; transaction . add ( uniqueKey ) ; // Add token to the list of generators LinkedList list = ( LinkedList ) _uniqueKeyRootToken . getManagedObject ( ) ; list . add ( uniqueKeyToken , transaction ) ; // Commit all of the work transaction . commit ( false ) ; // Store the token in our list to access at runtime. _generators . put ( generator . getName ( ) , uniqueKey ) ; } catch ( ObjectManagerException ome ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ome , "com.ibm.ws.sib.msgstore.persistence.objectManager.UniqueKeyRangeManager.addEntry" , "1:217:1.8" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . event ( tc , "Exception caught creating new unique key generator!" , ome ) ; if ( transaction != null ) { try { // Clean up our ObjectManager work. transaction . backout ( false ) ; } catch ( ObjectManagerException e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ws.sib.msgstore.persistence.objectManager.UniqueKeyRangeManager.addEntry" , "1:229:1.8" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . event ( tc , "Exception caught backing out unique key generator creation!" , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addEntry" ) ; throw new PersistenceException ( "Exception caught creating new unique key generator!" , ome ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addEntry" , "return=" + UNIQUE_KEY_INITIAL_VALUE ) ; return UNIQUE_KEY_INITIAL_VALUE ; }
Tell the persistence layer about a new generator