idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
36,600
@ SuppressWarnings ( "rawtypes" ) private void doPostConstruct ( Class clazz , List < LifecycleCallback > postConstructs , Object instance ) throws InjectionException { if ( ! metadataComplete && clazz . getSuperclass ( ) != null ) { doPostConstruct ( clazz . getSuperclass ( ) , postConstructs , instance ) ; } String classname = clazz . getName ( ) ; String methodName = getMethodNameFromDD ( postConstructs , classname ) ; if ( methodName != null ) { invokeMethod ( clazz , methodName , instance ) ; } else if ( ! metadataComplete ) { Method method = getAnnotatedPostConstructMethod ( clazz ) ; if ( method != null ) { invokeMethod ( clazz , method . getName ( ) , instance ) ; } } }
Processes the PostConstruct callback method
36,601
@ SuppressWarnings ( "rawtypes" ) public Method getAnnotatedMethod ( Class clazz , Class < ? extends Annotation > annotationClass ) { Method m = null ; Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { Annotation [ ] a = methods [ i ] . getAnnotations ( ) ; if ( a != null ) { for ( int j = 0 ; j < a . length ; j ++ ) { if ( a [ j ] . annotationType ( ) == annotationClass ) { if ( m == null ) { m = methods [ i ] ; } else { Tr . warning ( tc , "DUPLICATE_CALLBACK_METHOD_CWWKC2454W" , new Object [ ] { methods [ i ] . getName ( ) , clazz . getName ( ) } ) ; } } } } } return m ; }
Gets the annotated method from the class object .
36,602
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public void invokeMethod ( final Class clazz , final String methodName , final Object instance ) { AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { try { final Method m = clazz . getDeclaredMethod ( methodName ) ; if ( ! m . isAccessible ( ) ) { m . setAccessible ( true ) ; m . invoke ( instance ) ; m . setAccessible ( false ) ; return m ; } else { m . invoke ( instance ) ; return m ; } } catch ( Exception e ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , e . getMessage ( ) ) ; } return null ; } } } ) ; }
Invokes the class method . The object instance can be null for the application main class .
36,603
public String getMethodNameFromDD ( List < LifecycleCallback > callbacks , String classname ) { String methodName = null ; for ( LifecycleCallback callback : callbacks ) { String callbackClassName ; callbackClassName = callback . getClassName ( ) ; if ( callbackClassName == null ) { callbackClassName = mainClassName ; } if ( callbackClassName . equals ( classname ) ) { if ( methodName == null ) { methodName = callback . getMethodName ( ) ; } else { Tr . warning ( tc , "DUPLICATE_CALLBACK_METHOD_CWWKC2454W" , new Object [ ] { methodName , classname } ) ; } } } return methodName ; }
Gets the lifecycle callback method name from the application client module deployment descriptor
36,604
private final void encrypt ( ) throws Exception { String signStr = Base64Coder . toString ( Base64Coder . base64Encode ( signature ) ) ; String ud = userData . toString ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "encrypt: userData" + ud ) ; } byte [ ] accessID = Base64Coder . getBytes ( ud ) ; StringBuilder sb = new StringBuilder ( DELIM ) ; sb . append ( getExpiration ( ) ) . append ( DELIM ) . append ( signStr ) ; byte [ ] timeAndSign = getSimpleBytes ( sb . toString ( ) ) ; byte [ ] toBeEnc = new byte [ accessID . length + timeAndSign . length ] ; for ( int i = 0 ; i < accessID . length ; i ++ ) { toBeEnc [ i ] = accessID [ i ] ; } for ( int i = accessID . length ; i < toBeEnc . length ; i ++ ) { toBeEnc [ i ] = timeAndSign [ i - accessID . length ] ; } try { encryptedBytes = LTPAKeyUtil . encrypt ( toBeEnc , sharedKey , cipher ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Error encrypting; " + e ) ; } throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Encrypted bytes are: " + ( encryptedBytes == null ? "" : Base64Coder . toString ( Base64Coder . base64Encode ( encryptedBytes ) ) ) ) ; } }
Encrypt the token passed into the token .
36,605
@ FFDCIgnore ( { BadPaddingException . class , Exception . class } ) private final void decrypt ( ) throws InvalidTokenException { byte [ ] tokenData ; try { tokenData = LTPAKeyUtil . decrypt ( encryptedBytes . clone ( ) , sharedKey , cipher ) ; checkTokenBytes ( tokenData ) ; String UTF8TokenString = toUTF8String ( tokenData ) ; String [ ] userFields = LTPATokenizer . parseToken ( UTF8TokenString ) ; Map < String , ArrayList < String > > attribs = LTPATokenizer . parseUserData ( userFields [ 0 ] ) ; userData = new UserData ( attribs ) ; String tokenString = toSimpleString ( tokenData ) ; String [ ] fields = LTPATokenizer . parseToken ( tokenString ) ; String [ ] expirationArray = userData . getAttributes ( AttributeNameConstants . WSTOKEN_EXPIRATION ) ; if ( expirationArray != null && expirationArray [ expirationArray . length - 1 ] != null ) { expirationInMilliseconds = Long . parseLong ( expirationArray [ expirationArray . length - 1 ] ) ; } else { expirationInMilliseconds = Long . parseLong ( fields [ 1 ] ) ; } byte [ ] signature = Base64Coder . base64Decode ( Base64Coder . getBytes ( fields [ 2 ] ) ) ; setSignature ( signature ) ; } catch ( BadPaddingException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Caught BadPaddingException while decrypting token, this is only a critical problem if decryption should have worked." , e ) ; } throw new InvalidTokenException ( e . getMessage ( ) , e ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Error decrypting; " + e ) ; } throw new InvalidTokenException ( e . getMessage ( ) , e ) ; } }
Decrypt the encrypted token bytes passed into the constructor .
36,606
private final void sign ( ) throws Exception { String dataStr = this . getUserData ( ) . toString ( ) ; byte [ ] data = Base64Coder . getBytes ( dataStr ) ; byte [ ] signature = sign ( data , this . privateKey ) ; this . setSignature ( signature ) ; }
Sign the token passed into the token .
36,607
private final boolean verify ( ) throws Exception { String dataStr = this . getUserData ( ) . toString ( ) ; byte [ ] data = Base64Coder . getBytes ( dataStr ) ; return verify ( data , signature , publicKey ) ; }
Verify the token .
36,608
public final void validateExpiration ( ) throws TokenExpiredException { Date d = new Date ( ) ; Date expD = new Date ( getExpiration ( ) ) ; boolean expired = d . after ( expD ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Current time = " + d + ", expiration time = " + expD ) ; } if ( expired ) { String msg = "The token has expired: current time = \"" + d + "\", expire time = \"" + expD + "\"" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , msg ) ; } throw new TokenExpiredException ( expirationInMilliseconds , msg ) ; } }
Checks if the token has expired .
36,609
private final void setExpiration ( long expirationInMinutes ) { expirationInMilliseconds = System . currentTimeMillis ( ) + expirationInMinutes * 60 * 1000 ; signature = null ; if ( userData != null ) { encryptedBytes = null ; userData . addAttribute ( "expire" , Long . toString ( expirationInMilliseconds ) ) ; } else { encryptedBytes = null ; } }
Set expiration limit of the LTPA2 token
36,610
private static final String toUTF8String ( byte [ ] b ) { String ns = null ; try { ns = new String ( b , "UTF8" ) ; } catch ( UnsupportedEncodingException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Error converting to string; " + e ) ; } } return ns ; }
Convert the byte representation to the UTF - 8 String form .
36,611
private static final String toSimpleString ( byte [ ] b ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 , len = b . length ; i < len ; i ++ ) { sb . append ( ( char ) ( b [ i ] & 0xff ) ) ; } String str = sb . toString ( ) ; return str ; }
Convert the byte representation to the String form .
36,612
private static final byte [ ] getSimpleBytes ( String str ) { StringBuilder sb = new StringBuilder ( str ) ; byte [ ] b = new byte [ sb . length ( ) ] ; for ( int i = 0 , len = sb . length ( ) ; i < len ; i ++ ) { b [ i ] = ( byte ) sb . charAt ( i ) ; } return b ; }
Convert the String form to the byte representation
36,613
public static ProtectedFunctionMapper getInstance ( ) { ProtectedFunctionMapper funcMapper ; if ( System . getSecurityManager ( ) != null ) { funcMapper = ( ProtectedFunctionMapper ) AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { return new ProtectedFunctionMapper ( ) ; } } ) ; } else { funcMapper = new ProtectedFunctionMapper ( ) ; } funcMapper . fnmap = new java . util . HashMap ( ) ; return funcMapper ; }
Generated Servlet and Tag Handler implementations call this method to retrieve an instance of the ProtectedFunctionMapper . This is necessary since generated code does not have access to create instances of classes in this package .
36,614
public Method resolveFunction ( String prefix , String localName ) { return ( Method ) this . fnmap . get ( prefix + ":" + localName ) ; }
Resolves the specified local name and prefix into a Java . lang . Method . Returns null if the prefix and local name are not found .
36,615
public void setItemType ( JMFType elem ) { if ( elem == null ) throw new NullPointerException ( "Repeated item cannot be null" ) ; itemType = ( JSType ) elem ; itemType . parent = this ; itemType . siblingPosition = 0 ; }
Set the item type of the array
36,616
protected void incrementActiveConns ( ) { int count = this . activeConnections . incrementAndGet ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Increment active, current=" + count ) ; } }
Increase the number of active connections currently being processed inside the HTTP dispatcher .
36,617
protected void decrementActiveConns ( ) { int count = this . activeConnections . decrementAndGet ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Decrement active, current=" + count ) ; } if ( 0 == count && this . quiescing ) { signalNoConnections ( ) ; } }
Decrement the number of active connections being processed by the dispatcher .
36,618
public void enactOpen ( long openAt ) { String methodName = "enactOpen" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " On [ " + path + " ] at [ " + toRelSec ( initialAt , openAt ) + " (s) ]" ) ; } if ( zipFileState == ZipFileState . OPEN ) { openDuration += openAt - lastOpenAt ; lastLastOpenAt = lastOpenAt ; lastOpenAt = openAt ; openCount ++ ; } else if ( zipFileState == ZipFileState . PENDING ) { long lastPendDuration = openAt - lastPendAt ; pendToOpenDuration += lastPendDuration ; pendToOpenCount ++ ; lastLastOpenAt = lastOpenAt ; lastOpenAt = openAt ; openCount ++ ; zipFileState = ZipFileState . OPEN ; if ( ZIP_REAPER_COLLECT_TIMINGS ) { timing ( " Pend Success [ " + toAbsSec ( lastPendDuration ) + " (s) ]" ) ; } } else if ( zipFileState == ZipFileState . FULLY_CLOSED ) { if ( firstOpenAt == - 1L ) { firstOpenAt = openAt ; } else { long lastFullCloseDuration = openAt - lastFullCloseAt ; fullCloseToOpenDuration += lastFullCloseDuration ; if ( ZIP_REAPER_COLLECT_TIMINGS ) { long lastPendDuration = ( ( lastPendAt == - 1L ) ? 0 : ( lastFullCloseAt - lastPendAt ) ) ; timing ( " Reopen; Pend [ " + toAbsSec ( lastPendDuration ) + " (s) ] " + " Close [ " + toAbsSec ( lastFullCloseDuration ) + " (s) ]" ) ; } } fullCloseToOpenCount ++ ; lastLastOpenAt = lastOpenAt ; lastOpenAt = openAt ; openCount ++ ; zipFileState = ZipFileState . OPEN ; } else { throw unknownState ( ) ; } if ( ZIP_REAPER_COLLECT_TIMINGS ) { timing ( " Open " + dualTiming ( openAt , initialAt ) + " " + openState ( ) ) ; } }
PENDING - > FULLY_CLOSED
36,619
protected ZipFile reacquireZipFile ( ) throws IOException , ZipException { String methodName = "reacquireZipFile" ; File rawZipFile = new File ( path ) ; long newZipLength = FileUtils . fileLength ( rawZipFile ) ; long newZipLastModified = FileUtils . fileLastModified ( rawZipFile ) ; boolean zipFileChanged = false ; if ( newZipLength != zipLength ) { zipFileChanged = true ; if ( openCount > closeCount ) { Tr . warning ( tc , "reaper.unexpected.length.change" , path , Long . valueOf ( zipLength ) , Long . valueOf ( newZipLength ) ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " Zip [ " + path + " ]:" + " Update length from [ " + Long . valueOf ( zipLength ) + " ]" + " to [ " + Long . valueOf ( newZipLength ) + " ]" ) ; } } } if ( newZipLastModified != zipLastModified ) { zipFileChanged = true ; if ( openCount > closeCount ) { Tr . warning ( tc , "reaper.unexpected.lastmodified.change" , path , Long . valueOf ( zipLastModified ) , Long . valueOf ( newZipLastModified ) ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " Zip [ " + path + " ]:" + " Update last modified from [ " + Long . valueOf ( zipLastModified ) + " ]" + " to [ " + Long . valueOf ( newZipLastModified ) + " ]" ) ; } } } if ( zipFileChanged ) { if ( openCount > closeCount ) { Tr . warning ( tc , "reaper.reopen.active" , path ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " Reopen [ " + path + " ]" ) ; } } @ SuppressWarnings ( "unused" ) ZipFile oldZipFile = closeZipFile ( ) ; @ SuppressWarnings ( "unused" ) ZipFile newZipFile = openZipFile ( newZipLength , newZipLastModified ) ; } return zipFile ; }
Re - acquire the ZIP file .
36,620
public static String getAttribute ( XMLStreamReader reader , String localName ) { int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { String name = reader . getAttributeLocalName ( i ) ; if ( localName . equals ( name ) ) { return reader . getAttributeValue ( i ) ; } } return null ; }
Get the element attribute value
36,621
public static < T > T createInstanceByElement ( XMLStreamReader reader , Class < T > clazz , Set < String > attrNames ) { if ( reader == null || clazz == null || attrNames == null ) return null ; try { T instance = clazz . newInstance ( ) ; int count = reader . getAttributeCount ( ) ; int matchCount = attrNames . size ( ) ; for ( int i = 0 ; i < count && matchCount > 0 ; ++ i ) { String name = reader . getAttributeLocalName ( i ) ; String value = reader . getAttributeValue ( i ) ; if ( attrNames . contains ( name ) ) { Field field = clazz . getDeclaredField ( name ) ; field . setAccessible ( true ) ; field . set ( instance , value ) ; matchCount -- ; } } return instance ; } catch ( InstantiationException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( SecurityException e ) { throw new RuntimeException ( e ) ; } catch ( NoSuchFieldException e ) { throw new RuntimeException ( e ) ; } }
Create the instance by parse the element the instance s class must have the empty construct . The clazz must have the fields in attrNames and all the fields type must be String
36,622
public void removeEjbBindings ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "removeEjbBindings called" ) ; for ( String bindingName : ivEjbContextBindingMap . values ( ) ) { removeFromServerContextBindingMap ( bindingName , true ) ; } ivEjbContextBindingMap . clear ( ) ; }
Removes all of the EJB bindings for this EJB from the bean specific and sever wide maps .
36,623
public boolean isUniqueShortDefaultBinding ( String interfaceName ) { BindingData bdata = ivServerContextBindingMap . get ( interfaceName ) ; if ( bdata != null && bdata . ivExplicitBean == null && bdata . ivImplicitBeans != null && bdata . ivImplicitBeans . size ( ) == 1 ) { return true ; } return false ; }
Returns true if a short form default binding is present for the specified interface and the current bean is currently the only bean with this short form default binding and there are no explicit bindings .
36,624
public void removeShortDefaultBindings ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "removeShortDefaultBindings called" ) ; for ( String bindingName : ivEjbContextShortDefaultJndiNames ) { removeFromServerContextBindingMap ( bindingName , false ) ; } ivEjbContextShortDefaultJndiNames . clear ( ) ; }
Removes all of the short form default bindings for this EJB from the bean specific and sever wide maps .
36,625
private void addToServerContextBindingMap ( String interfaceName , String bindingName ) throws NameAlreadyBoundException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "addToServerContextBindingMap : " + interfaceName + ", binding : " + bindingName ) ; BindingData bdata = ivServerContextBindingMap . get ( bindingName ) ; if ( bdata == null ) { bdata = new BindingData ( ) ; ivServerContextBindingMap . put ( bindingName , bdata ) ; } if ( bdata . ivExplicitBean == null ) { bdata . ivExplicitBean = ivHomeRecord . j2eeName ; bdata . ivExplicitInterface = interfaceName ; if ( bdata . ivImplicitBeans != null && bdata . ivImplicitBeans . size ( ) > 1 ) { ivEjbContextAmbiguousMap . remove ( interfaceName ) ; } } else { J2EEName j2eeName = ivHomeRecord . j2eeName ; if ( bdata . ivExplicitBean . equals ( j2eeName ) ) { Tr . error ( tc , "NAME_ALREADY_BOUND_FOR_SAME_EJB_CNTR0173E" , new Object [ ] { interfaceName , j2eeName . getComponent ( ) , j2eeName . getModule ( ) , j2eeName . getApplication ( ) , bindingName , bdata . ivExplicitInterface } ) ; String message = "The " + interfaceName + " interface of the " + j2eeName . getComponent ( ) + " bean in the " + j2eeName . getModule ( ) + " module of the " + j2eeName . getApplication ( ) + " application " + "cannot be bound to the " + bindingName + " name location. " + "The " + bdata . ivExplicitInterface + " interface of the " + "same bean has already been bound to the " + bindingName + " name location." ; throw new NameAlreadyBoundException ( message ) ; } else { Tr . error ( tc , "NAME_ALREADY_BOUND_FOR_EJB_CNTR0172E" , new Object [ ] { interfaceName , j2eeName . getComponent ( ) , j2eeName . getModule ( ) , j2eeName . getApplication ( ) , bindingName , bdata . ivExplicitInterface , bdata . ivExplicitBean . getComponent ( ) , bdata . ivExplicitBean . getModule ( ) , bdata . ivExplicitBean . getApplication ( ) } ) ; String message = "The " + interfaceName + " interface of the " + j2eeName . getComponent ( ) + " bean in the " + j2eeName . getModule ( ) + " module of the " + j2eeName . getApplication ( ) + " application " + "cannot be bound to the " + bindingName + " name location. " + "The " + bdata . ivExplicitInterface + " interface of the " + bdata . ivExplicitBean . getComponent ( ) + " bean in the " + bdata . ivExplicitBean . getModule ( ) + " module of the " + bdata . ivExplicitBean . getApplication ( ) + " application " + "has already been bound to the " + bindingName + " name location." ; throw new NameAlreadyBoundException ( message ) ; } } }
d457053 . 1
36,626
public static BindingsHelper getLocalHelper ( HomeRecord homeRecord ) { if ( homeRecord . ivLocalBindingsHelper == null ) { homeRecord . ivLocalBindingsHelper = new BindingsHelper ( homeRecord , cvAllLocalBindings , null ) ; } return homeRecord . ivLocalBindingsHelper ; }
A method for obtaining a Binding Name Helper for use with the local jndi namespace .
36,627
public static BindingsHelper getRemoteHelper ( HomeRecord homeRecord ) { if ( homeRecord . ivRemoteBindingsHelper == null ) { homeRecord . ivRemoteBindingsHelper = new BindingsHelper ( homeRecord , cvAllRemoteBindings , "ejb/" ) ; } return homeRecord . ivRemoteBindingsHelper ; }
A method for obtaining a Binding Name Helper for use with the remote jndi namespace .
36,628
public synchronized void stop ( ) { if ( timer != null ) { timer . keepRunning = false ; timer . interrupt ( ) ; timer = null ; } LogRepositorySpaceAlert . getInstance ( ) . removeRepositoryInfo ( this ) ; }
stop logging and thus stop the timer retention thread
36,629
protected static long calculateFileSplit ( long repositorySize ) { if ( repositorySize <= 0 ) { return MAX_LOG_FILE_SIZE ; } if ( repositorySize < MIN_REPOSITORY_SIZE ) { throw new IllegalArgumentException ( "Specified repository size is too small" ) ; } long result = repositorySize / SPLIT_RATIO ; if ( result < MIN_LOG_FILE_SIZE ) { result = MIN_LOG_FILE_SIZE ; } else if ( result > MAX_LOG_FILE_SIZE ) { result = MAX_LOG_FILE_SIZE ; } return result ; }
calculates maximum size of repository files based on the required maximum limit on total size of the repository .
36,630
private void initFileList ( boolean force ) { if ( totalSize < 0 || force ) { fileList . clear ( ) ; parentFilesMap . clear ( ) ; totalSize = 0L ; File [ ] files = listRepositoryFiles ( ) ; if ( files . length > 0 ) { Arrays . sort ( files , fileComparator ) ; for ( File file : files ) { long size = AccessHelper . getFileLength ( file ) ; fileList . add ( new FileDetails ( file , getLogFileTimestamp ( file ) , size , null ) ) ; totalSize += size ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "initFileList" , "add: " + file . getPath ( ) + " sz: " + size + " listSz: " + fileList . size ( ) + " new totalSz: " + totalSize ) ; } incrementFileCount ( file ) ; } debugListLL ( "fileListPrePop" ) ; } deleteEmptyRepositoryDirs ( ) ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { Iterator < File > parentKeys = parentFilesMap . keySet ( ) . iterator ( ) ; while ( parentKeys . hasNext ( ) ) { File parentNameKey = parentKeys . next ( ) ; Integer fileCount = parentFilesMap . get ( parentNameKey ) ; debugLogger . logp ( Level . FINE , thisClass , "initFileList" , " Directory: " + parentNameKey + " file count: " + fileCount ) ; } } } }
Initializes file list from the list of files in the repository . This method should be called while holding a lock on fileList .
36,631
protected void deleteEmptyRepositoryDirs ( ) { File [ ] directories = listRepositoryDirs ( ) ; for ( int i = 0 ; i < directories . length ; i ++ ) { boolean currentDir = ivSubDirectory != null && ivSubDirectory . compareTo ( directories [ i ] ) == 0 ; if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "deleteEmptyRepositoryDirs" , "Instance directory name (controller): " + directories [ i ] . getAbsolutePath ( ) ) ; File [ ] childFiles = AccessHelper . listFiles ( directories [ i ] , subprocFilter ) ; for ( File curFile : childFiles ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "deleteEmptyRepositoryDirs" , "Servant directory name: " + curFile . getAbsolutePath ( ) ) ; if ( ! currentDir && ! parentFilesMap . containsKey ( curFile ) ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "deleteEmptyRepositoryDirs" , "Found an empty servant directory: " + curFile ) ; deleteDirectory ( curFile ) ; } else { incrementFileCount ( curFile ) ; } } if ( ! currentDir && ! parentFilesMap . containsKey ( directories [ i ] ) ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "listRepositoryFiles" , "Found an empty directory: " + directories [ i ] ) ; deleteDirectory ( directories [ i ] ) ; } } }
Deletes all empty server instance directories including empty servant directories
36,632
protected void deleteDirectory ( File directoryName ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "deleteDirectory" , "empty directory " + ( ( directoryName == null ) ? "None" : directoryName . getPath ( ) ) ) ; } if ( AccessHelper . deleteFile ( directoryName ) ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "deleteDirectory" , "delete " + directoryName . getName ( ) ) ; } } else { if ( isDebugEnabled ( ) ) { debugLogger . logp ( Level . WARNING , thisClass , "deleteDirectory" , "Failed to delete directory " + directoryName . getPath ( ) ) ; } } }
Deletes the specified directory
36,633
private boolean purgeOldFiles ( long total ) { boolean result = false ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldFiles" , "total: " + total + " listSz: " + fileList . size ( ) ) ; } while ( total > 0 && fileList . size ( ) > 1 ) { FileDetails details = purgeOldestFile ( ) ; if ( details != null ) { if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldFiles" , "Purged: " + details . file . getPath ( ) + " sz: " + details . size ) ; } total -= details . size ; result = true ; } } return result ; }
Removes old files from the repository . This method does not remove the most recent file . This method should be called while holding a lock on fileList .
36,634
private FileDetails purgeOldestFile ( ) { debugListLL ( "prepurgeOldestFile" ) ; debugListHM ( "prepurgeOldestFile" ) ; FileDetails returnFD = getOldestInactive ( ) ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "oldestInactive: " + ( ( returnFD == null ) ? "None" : returnFD . file . getPath ( ) ) ) ; } if ( returnFD == null ) return null ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "fileList size before remove: " + fileList . size ( ) ) ; } if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "fileList size after remove: " + fileList . size ( ) ) ; } if ( AccessHelper . deleteFile ( returnFD . file ) ) { fileList . remove ( returnFD ) ; totalSize -= returnFD . size ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "delete: " + returnFD . file . getName ( ) ) ; } decrementFileCount ( returnFD . file ) ; notifyOfFileAction ( LogEventListener . EVENTTYPEDELETE ) ; } else { if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "Failed to delete file: " + returnFD . file . getPath ( ) ) ; } initFileList ( true ) ; returnFD = null ; } debugListLL ( "postpurgeOldestFile" ) ; return returnFD ; }
Removes the oldest file from the repository . This method has logic to avoid removing currently active files This method should be called with a lock on filelist already attained
36,635
public synchronized String addNewFileFromSubProcess ( long spTimeStamp , String spPid , String spLabel ) { checkSpaceConstrain ( maxLogFileSize ) ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "addNewFileFromSubProcess" , "Tstamp: " + spTimeStamp + " pid: " + spPid + " lbl: " + spLabel + " Max: " + maxLogFileSize ) ; } if ( ivSubDirectory == null ) getControllingProcessDirectory ( spTimeStamp , svPid ) ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "addNewFileFromSubProcess" , "Got ivSubDir: " + ivSubDirectory . getPath ( ) ) ; } File servantDirectory = new File ( ivSubDirectory , getLogDirectoryName ( - 1 , spPid , spLabel ) ) ; File servantFile = getLogFile ( servantDirectory , spTimeStamp ) ; FileDetails thisFile = new FileDetails ( servantFile , spTimeStamp , maxLogFileSize , spPid ) ; synchronized ( fileList ) { initFileList ( false ) ; fileList . add ( thisFile ) ; incrementFileCount ( servantFile ) ; synchronized ( activeFilesMap ) { activeFilesMap . put ( spPid , thisFile ) ; } } totalSize += maxLogFileSize ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "addNewFileFromSubProcess" , "Added file: " + servantFile . getPath ( ) + " sz:" + maxLogFileSize + " tstmp: " + spTimeStamp ) ; debugListLL ( "postAddFromSP" ) ; debugListHM ( "postAddFromSP" ) ; } return servantFile . getPath ( ) ; }
add information about a new file being created by a subProcess in order to maintain retention information . This is done for all files created by each subProcess . If IPC facility is not ready subProcess may have to create first then notify when IPC is up .
36,636
public void inactivateSubProcess ( String spPid ) { synchronized ( fileList ) { synchronized ( activeFilesMap ) { activeFilesMap . remove ( spPid ) ; } } if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "inactivateSubProcess" , "Inactivated pid: " + spPid ) ; } }
inactivate active file for a given process . Should only be one file active for a process
36,637
protected int getContentLength ( boolean update ) { if ( update ) { contentLength = ( int ) this . getFileSize ( update ) ; return contentLength ; } else { if ( contentLength == - 1 ) { contentLength = ( int ) this . getFileSize ( update ) ; return contentLength ; } else { return contentLength ; } } }
PM92967 pulled up method
36,638
public void logError ( String moduleName , String beanName , String methodName ) { Tr . error ( tc , ivError . getMessageId ( ) , new Object [ ] { beanName , moduleName , methodName , ivField } ) ; }
Logs an error message corresponding to this exception .
36,639
protected void restore ( ObjectInputStream ois , int dataVersion ) throws SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "restore" , new Object [ ] { dataVersion } ) ; checkPersistentVersionId ( dataVersion ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "restore" ) ; }
Child classes should override this method to restore their persistent data .
36,640
synchronized void captureCheckpointManagedObjects ( ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "captureCheckpointManagedObjectsremove" ) ; if ( checkpointManagedObjectsToWrite == null ) { checkpointManagedObjectsToWrite = managedObjectsToWrite ; managedObjectsToWrite = new ConcurrentHashMap ( concurrency ) ; checkpointTokensToDelete = tokensToDelete ; tokensToDelete = new ConcurrentHashMap ( concurrency ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "captureCheckpointManagedObjects" ) ; }
Capture the ManagedObjects to write and delete as part of the checkpoint .
36,641
private void write ( ManagedObject managedObject ) throws ObjectManagerException { final String methodName = "write" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { managedObject } ) ; ObjectManagerByteArrayOutputStream serializedBytes = null ; if ( usesSerializedForm ) { if ( managedObject . state != ManagedObject . stateDeleted ) serializedBytes = managedObject . freeLatestSerializedBytes ( ) ; } else { if ( managedObject . state == ManagedObject . stateReady ) serializedBytes = managedObject . getSerializedBytes ( ) ; } if ( serializedBytes != null ) { try { java . io . FileOutputStream storeFileOutputStream = new java . io . FileOutputStream ( storeDirectoryName + java . io . File . separator + managedObject . owningToken . storedObjectIdentifier ) ; storeFileOutputStream . write ( serializedBytes . getBuffer ( ) , 0 , serializedBytes . getCount ( ) ) ; storeFileOutputStream . flush ( ) ; storeFileOutputStream . close ( ) ; } catch ( java . io . IOException exception ) { ObjectManager . ffdc . processException ( this , cclass , methodName , exception , "1:656:1.17" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { exception } ) ; throw new PermanentIOException ( this , exception ) ; } managedObjectsOnDisk . add ( new Long ( managedObject . owningToken . storedObjectIdentifier ) ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Writes an object to hardened storage but may return before the write completes .
36,642
public void writeHeader ( ) throws ObjectManagerException { final String methodName = "writeHeader" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName ) ; try { java . io . FileOutputStream headerOutputStream = new java . io . FileOutputStream ( storeDirectoryName + java . io . File . separator + headerIdentifier ) ; java . io . DataOutputStream dataOutputStream = new java . io . DataOutputStream ( headerOutputStream ) ; java . io . FileDescriptor fileDescriptor = headerOutputStream . getFD ( ) ; dataOutputStream . writeInt ( version ) ; dataOutputStream . writeLong ( objectStoreIdentifier ) ; dataOutputStream . writeLong ( sequenceNumber ) ; dataOutputStream . flush ( ) ; headerOutputStream . flush ( ) ; fileDescriptor . sync ( ) ; headerOutputStream . close ( ) ; } catch ( java . io . IOException exception ) { ObjectManager . ffdc . processException ( this , cclass , methodName , exception , "1:706:1.17" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { exception } ) ; throw new PermanentIOException ( this , exception ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Write header information for disk in the file headerIdentifier and force it to disk .
36,643
public static RestRepositoryConnection createConnection ( RestRepositoryConnectionProxy proxy ) throws RepositoryBackendIOException { readRepoProperties ( proxy ) ; RestRepositoryConnection connection = new RestRepositoryConnection ( repoProperties . getProperty ( REPOSITORY_URL_PROP ) . trim ( ) ) ; connection . setProxy ( proxy ) ; if ( repoProperties . containsKey ( API_KEY_PROP ) ) { connection . setApiKey ( repoProperties . getProperty ( API_KEY_PROP ) . trim ( ) ) ; } if ( repoProperties . containsKey ( USERID_PROP ) ) { connection . setUserId ( repoProperties . getProperty ( USERID_PROP ) . trim ( ) ) ; } if ( repoProperties . containsKey ( PASSWORD_PROP ) ) { connection . setPassword ( repoProperties . getProperty ( PASSWORD_PROP ) . trim ( ) ) ; } if ( repoProperties . containsKey ( SOFTLAYER_USERID_PROP ) ) { connection . setSoftlayerUserId ( repoProperties . getProperty ( SOFTLAYER_USERID_PROP ) . trim ( ) ) ; } if ( repoProperties . containsKey ( SOFTLAYER_PASSWORD_PROP ) ) { connection . setSoftlayerPassword ( repoProperties . getProperty ( SOFTLAYER_PASSWORD_PROP ) . trim ( ) ) ; } if ( repoProperties . containsKey ( ATTACHMENT_BASIC_AUTH_USERID_PROP ) ) { connection . setAttachmentBasicAuthUserId ( repoProperties . getProperty ( ATTACHMENT_BASIC_AUTH_USERID_PROP ) . trim ( ) ) ; } if ( repoProperties . containsKey ( ATTACHMENT_BASIC_AUTH_PASSWORD_PROP ) ) { connection . setAttachmentBasicAuthPassword ( repoProperties . getProperty ( ATTACHMENT_BASIC_AUTH_PASSWORD_PROP ) . trim ( ) ) ; } return connection ; }
Creates a LoginInfoEntry with a proxy . This will then load the default repository using a hosted properties file on DHE .
36,644
public static boolean repositoryDescriptionFileExists ( RestRepositoryConnectionProxy proxy ) { boolean exists = false ; try { URL propertiesFileURL = getPropertiesFileLocation ( ) ; if ( proxy != null ) { if ( proxy . isHTTPorHTTPS ( ) ) { Proxy javaNetProxy = new Proxy ( Proxy . Type . HTTP , new InetSocketAddress ( proxy . getProxyURL ( ) . getHost ( ) , proxy . getProxyURL ( ) . getPort ( ) ) ) ; URLConnection connection = propertiesFileURL . openConnection ( javaNetProxy ) ; InputStream is = connection . getInputStream ( ) ; exists = true ; is . close ( ) ; if ( connection instanceof HttpURLConnection ) { ( ( HttpURLConnection ) connection ) . disconnect ( ) ; } } else { UnsupportedOperationException ue = new UnsupportedOperationException ( "Non-HTTP proxy not supported" ) ; throw new IOException ( ue ) ; } } else { InputStream is = propertiesFileURL . openStream ( ) ; exists = true ; is . close ( ) ; } } catch ( MalformedURLException e ) { } catch ( IOException e ) { } return exists ; }
Tests if the repository description properties file exists as defined by the location override system property or at the default location
36,645
private static void checkHttpResponseCodeValid ( URLConnection connection ) throws RepositoryHttpException , IOException { if ( connection instanceof HttpURLConnection ) { HttpURLConnection conn = ( HttpURLConnection ) connection ; conn . setRequestMethod ( "GET" ) ; int respCode = conn . getResponseCode ( ) ; if ( respCode < 200 || respCode >= 300 ) { throw new RepositoryHttpException ( "HTTP connection returned error code " + respCode , respCode , null ) ; } } }
Checks for a valid response code and throws and exception with the response code if an error
36,646
public static boolean isZos ( ) { String os = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { public String run ( ) { return System . getProperty ( "os.name" ) ; } } ) ; return os != null && ( os . equalsIgnoreCase ( "OS/390" ) || os . equalsIgnoreCase ( "z/OS" ) ) ; }
In general find another way to do what you are trying this is meant as a VERY VERY last resort and agreed to by Gary .
36,647
private InputStream safeOpen ( String file ) { URL url = bundle . getEntry ( file ) ; if ( url != null ) { try { return url . openStream ( ) ; } catch ( IOException e ) { } } return null ; }
Attempt to open the file in the bundle and return null if something goes wrong .
36,648
public static String parseTempPrefix ( String destinationName ) { String prefix = null ; if ( destinationName != null && ( destinationName . startsWith ( SIMPConstants . TEMPORARY_PUBSUB_DESTINATION_PREFIX ) ) || destinationName . startsWith ( SIMPConstants . TEMPORARY_QUEUE_DESTINATION_PREFIX ) ) { int index = destinationName . indexOf ( SIMPConstants . SYSTEM_DESTINATION_SEPARATOR , 2 ) ; if ( index > 1 ) { prefix = destinationName . substring ( 2 , index ) ; } } return prefix ; }
Used to extract the destination prefix component of a full temporary destination name .
36,649
public static void setGuaranteedDeliveryProperties ( ControlMessage msg , SIBUuid8 sourceMEUuid , SIBUuid8 targetMEUuid , SIBUuid12 streamId , SIBUuid12 gatheringTargetDestUuid , SIBUuid12 targetDestUuid , ProtocolType protocolType , byte protocolVersion ) { msg . setGuaranteedSourceMessagingEngineUUID ( sourceMEUuid ) ; msg . setGuaranteedTargetMessagingEngineUUID ( targetMEUuid ) ; msg . setGuaranteedStreamUUID ( streamId ) ; msg . setGuaranteedGatheringTargetUUID ( gatheringTargetDestUuid ) ; msg . setGuaranteedTargetDestinationDefinitionUUID ( targetDestUuid ) ; if ( protocolType != null ) msg . setGuaranteedProtocolType ( protocolType ) ; msg . setGuaranteedProtocolVersion ( protocolVersion ) ; }
Set up guaranteed delivery message properties . These are compulsory properties on a control message and are therefore set throughout the code . The method makes it easier to cope with new properties in the message .
36,650
public String intern ( String value ) { return intern ( value , Util_InternMap . DO_FORCE ) ; }
Intern a string value . Do force the value to be interned .
36,651
public boolean isChanged ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "isChanged" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "isChanged" , changed ) ; return changed ; }
Is the map fluffed up into a HashMap? d317373 . 1
36,652
public void setUnChanged ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setUnChanged" ) ; changed = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setUnChanged" ) ; }
Set the changed flag back to false if the map is written back to JMF
36,653
public void setChanged ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setChanged" ) ; changed = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setChanged" ) ; }
Set the changed flag to true if the caller knows better than the map itself
36,654
public Object put ( String key , Object value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "put" , new Object [ ] { key , PasswordUtils . replaceValueIfKeyIsPassword ( key , value ) } ) ; if ( ( ! changed ) && ( value != null ) ) { Object old = get ( key ) ; if ( value . equals ( old ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" , "unchanged" ) ; return old ; } else { changed = true ; Object result = copyMap ( ) . put ( key , value ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" , PasswordUtils . replaceValueIfKeyIsPassword ( key , result ) ) ; return result ; } } else { changed = true ; Object result = copyMap ( ) . put ( key , value ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" , PasswordUtils . replaceValueIfKeyIsPassword ( key , result ) ) ; return result ; } }
Once we ve made one update others don t matter so save time by not checking . d317373 . 1
36,655
public void addWebServiceFeatureInfo ( String seiName , WebServiceFeatureInfo featureInfo ) { PortComponentRefInfo portComponentRefInfo = seiNamePortComponentRefInfoMap . get ( seiName ) ; if ( portComponentRefInfo == null ) { portComponentRefInfo = new PortComponentRefInfo ( seiName ) ; seiNamePortComponentRefInfoMap . put ( seiName , portComponentRefInfo ) ; } portComponentRefInfo . addWebServiceFeatureInfo ( featureInfo ) ; }
Add a feature info to the PortComponentRefInfo if the target one does not exist a new one with that port component interface will be created
36,656
final String getName ( ) { Map < String , String > execProps = getExecutionProperties ( ) ; String taskName = execProps == null ? null : execProps . get ( ManagedTask . IDENTITY_NAME ) ; return taskName == null ? task . toString ( ) : taskName ; }
Returns the task name .
36,657
public static WASConfiguration getDefaultWasConfiguration ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getDefaultWasConfiguration()" ) ; WASConfiguration config = new WASConfiguration ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getDefaultWasConfiguration()" , config ) ; return ( config ) ; }
Create a new WASConfiguration object
36,658
public void performRecovery ( ObjectManagerState objectManagerState ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "performRecovery" , "ObjectManagerState=" + objectManagerState ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isDebugEnabled ( ) ) trace . debug ( this , cclass , "logicalUnitOfWork.identifier=" + logicalUnitOfWork . identifier + "(long)" ) ; Transaction transactionForRecovery = objectManagerState . getTransaction ( logicalUnitOfWork ) ; transactionForRecovery . commit ( false ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "performRecovery" ) ; }
Called to perform recovery action during a warm start of the objectManager .
36,659
public void initialize ( CacheConfig cc ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "initialize" ) ; cacheConfig = cc ; if ( null != cc ) { try { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Initializing CacheUnit " + uniqueServerNameFQ ) ; nullRemoteServices . setCacheUnit ( uniqueServerNameFQ , this ) ; } catch ( Exception ex ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ex , "com.ibm.ws.cache.CacheUnitImpl.initialize" , "120" , this ) ; Tr . error ( tc , "dynacache.configerror" , ex . getMessage ( ) ) ; throw new IllegalStateException ( "Unexpected exception: " + ex . getMessage ( ) ) ; } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "initialize" ) ; }
This is a helper method called by this CacheUnitImpl s constructor . It creates all the local objects - BatchUpdateDaemon InvalidationAuditDaemon and TimeLimitDaemon . These objects are used by all cache instances .
36,660
public void batchUpdate ( String cacheName , HashMap invalidateIdEvents , HashMap invalidateTemplateEvents , ArrayList pushEntryEvents ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "batchUpdate():" + cacheName ) ; invalidationAuditDaemon . registerInvalidations ( cacheName , invalidateIdEvents . values ( ) . iterator ( ) ) ; invalidationAuditDaemon . registerInvalidations ( cacheName , invalidateTemplateEvents . values ( ) . iterator ( ) ) ; pushEntryEvents = invalidationAuditDaemon . filterEntryList ( cacheName , pushEntryEvents ) ; DCache cache = ServerCache . getCache ( cacheName ) ; if ( cache != null ) { cache . batchUpdate ( invalidateIdEvents , invalidateTemplateEvents , pushEntryEvents ) ; if ( cache . getCacheConfig ( ) . isEnableServletSupport ( ) == true ) { if ( servletCacheUnit != null ) { servletCacheUnit . invalidateExternalCaches ( invalidateIdEvents , invalidateTemplateEvents ) ; } else { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "batchUpdate() cannot do invalidateExternalCaches because servletCacheUnit=NULL." ) ; } } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "batchUpdate()" ) ; }
This implements the method in the CacheUnit interface . It applies the updates to the local internal caches and the external caches . It validates timestamps to prevent race conditions .
36,661
public CacheEntry getEntry ( String cacheName , Object id , boolean ignoreCounting ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getEntry: {0}" , id ) ; DCache cache = ServerCache . getCache ( cacheName ) ; CacheEntry cacheEntry = null ; if ( cache != null ) { cacheEntry = ( CacheEntry ) cache . getEntry ( id , CachePerf . REMOTE , ignoreCounting , DCacheBase . INCREMENT_REFF_COUNT ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getEntry: {0}" , id ) ; return cacheEntry ; }
This implements the method in the CacheUnit interface . This is called by DRSNotificationService and DRSMessageListener . A returned null indicates that the local cache should execute it and return the result to the coordinating CacheUnit .
36,662
public void setEntry ( String cacheName , CacheEntry cacheEntry ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "setEntry: {0}" , cacheEntry . id ) ; cacheEntry = invalidationAuditDaemon . filterEntry ( cacheName , cacheEntry ) ; if ( cacheEntry != null ) { DCache cache = ServerCache . getCache ( cacheName ) ; cache . setEntry ( cacheEntry , CachePerf . REMOTE ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "setEntry: {0}" , cacheEntry == null ? "null" : cacheEntry . id ) ; }
This implements the method in the CacheUnit interface . This is called by DRSNotificationService and DRSMessageListener .
36,663
public void setExternalCacheFragment ( ExternalInvalidation externalCacheFragment ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "setExternalCacheFragment: {0}" , externalCacheFragment . getUri ( ) ) ; externalCacheFragment = invalidationAuditDaemon . filterExternalCacheFragment ( ServerCache . cache . getCacheName ( ) , externalCacheFragment ) ; if ( externalCacheFragment != null ) { batchUpdateDaemon . pushExternalCacheFragment ( externalCacheFragment , ServerCache . cache ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "setExternalCacheFragment: {0}" , externalCacheFragment . getUri ( ) ) ; }
This implements the method in the CacheUnit interface . This is called by DRSRemoteService and NullRemoteServices .
36,664
public void startServices ( boolean startTLD ) { synchronized ( this . serviceMonitor ) { if ( this . batchUpdateDaemon == null ) { batchUpdateDaemon = new BatchUpdateDaemon ( cacheConfig . batchUpdateInterval ) ; invalidationAuditDaemon = new InvalidationAuditDaemon ( cacheConfig . timeHoldingInvalidations ) ; batchUpdateDaemon . setInvalidationAuditDaemon ( invalidationAuditDaemon ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "startServices() - starting BatchUpdateDaemon/invalidationAuditDaemon services. " + "These services should only start once for all cache instances. Settings are: " + " batchUpdateInterval=" + cacheConfig . batchUpdateInterval + " timeHoldingInvalidations=" + cacheConfig . timeHoldingInvalidations ) ; } batchUpdateDaemon . start ( ) ; invalidationAuditDaemon . start ( ) ; } if ( startTLD && this . timeLimitDaemon == null ) { int lruToDiskTriggerTime = CacheConfig . DEFAULT_LRU_TO_DISK_TRIGGER_TIME ; if ( cacheConfig . lruToDiskTriggerTime > cacheConfig . timeGranularityInSeconds * 1000 || cacheConfig . lruToDiskTriggerTime < CacheConfig . MIN_LRU_TO_DISK_TRIGGER_TIME ) { Tr . warning ( tc , "DYNA0069W" , new Object [ ] { new Integer ( cacheConfig . lruToDiskTriggerTime ) , "lruToDiskTriggerTime" , cacheConfig . cacheName , new Integer ( CacheConfig . MIN_LRU_TO_DISK_TRIGGER_TIME ) , new Integer ( cacheConfig . timeGranularityInSeconds * 1000 ) , new Integer ( CacheConfig . DEFAULT_LRU_TO_DISK_TRIGGER_TIME ) } ) ; cacheConfig . lruToDiskTriggerTime = lruToDiskTriggerTime ; } else { lruToDiskTriggerTime = cacheConfig . lruToDiskTriggerTime ; } if ( lruToDiskTriggerTime == CacheConfig . DEFAULT_LRU_TO_DISK_TRIGGER_TIME && ( cacheConfig . lruToDiskTriggerPercent > CacheConfig . DEFAULT_LRU_TO_DISK_TRIGGER_PERCENT || cacheConfig . memoryCacheSizeInMB != CacheConfig . DEFAULT_DISABLE_CACHE_SIZE_MB ) ) { lruToDiskTriggerTime = CacheConfig . DEFAULT_LRU_TO_DISK_TRIGGER_TIME_FOR_TRIMCACHE ; cacheConfig . lruToDiskTriggerTime = lruToDiskTriggerTime ; Tr . audit ( tc , "DYNA1069I" , new Object [ ] { new Integer ( cacheConfig . lruToDiskTriggerTime ) } ) ; } timeLimitDaemon = new TimeLimitDaemon ( cacheConfig . timeGranularityInSeconds , lruToDiskTriggerTime ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "startServices() - starting TimeLimitDaemon service. " + "This service should only start once for all cache instances. Settings are: " + " timeGranularityInSeconds=" + cacheConfig . timeGranularityInSeconds + " lruToDiskTriggerTime=" + cacheConfig . lruToDiskTriggerTime ) ; } timeLimitDaemon . start ( ) ; } } }
This is called by ServerCache to start BatchUpdateDaemon InvalidationAuditDaemon TimeLimitDaemon and ExternalCacheServices These services should only start once for all cache instances
36,665
public void addAlias ( String cacheName , Object id , Object [ ] aliasArray ) { if ( id != null && aliasArray != null ) { DCache cache = ServerCache . getCache ( cacheName ) ; if ( cache != null ) { try { cache . addAlias ( id , aliasArray , false , false ) ; } catch ( IllegalArgumentException e ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Adding alias for cache id " + id + " failure: " + e . getMessage ( ) ) ; } } } } }
This implements the method in the CacheUnit interface . This is called to add alias ids for cache id .
36,666
public void removeAlias ( String cacheName , Object alias ) { if ( alias != null ) { DCache cache = ServerCache . getCache ( cacheName ) ; if ( cache != null ) { try { cache . removeAlias ( alias , false , false ) ; } catch ( IllegalArgumentException e ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Removing alias " + alias + " failure: " + e . getMessage ( ) ) ; } } } } }
This implements the method in the CacheUnit interface . This is called to remove alias ids from cache id .
36,667
public CommandCache getCommandCache ( String cacheName ) throws DynamicCacheServiceNotStarted , IllegalStateException { if ( servletCacheUnit == null ) { throw new DynamicCacheServiceNotStarted ( "Servlet cache service has not been started." ) ; } return servletCacheUnit . getCommandCache ( cacheName ) ; }
This implements the method in the CacheUnit interface . This is called to get Command Cache object .
36,668
public JSPCache getJSPCache ( String cacheName ) throws DynamicCacheServiceNotStarted , IllegalStateException { if ( servletCacheUnit == null ) { throw new DynamicCacheServiceNotStarted ( "Servlet cache service has not been started." ) ; } return servletCacheUnit . getJSPCache ( cacheName ) ; }
This implements the method in the CacheUnit interface . This is called to get JSP Cache object .
36,669
public Object createObjectCache ( String cacheName ) throws DynamicCacheServiceNotStarted , IllegalStateException { if ( objectCacheUnit == null ) { throw new DynamicCacheServiceNotStarted ( "Object cache service has not been started." ) ; } return objectCacheUnit . createObjectCache ( cacheName ) ; }
This implements the method in the CacheUnit interface . This is called to create object cache . It calls ObjectCacheUnit to perform this operation .
36,670
public EventSource createEventSource ( boolean createAsyncEventSource , String cacheName ) throws DynamicCacheServiceNotStarted { if ( objectCacheUnit == null ) { throw new DynamicCacheServiceNotStarted ( "Object cache service has not been started." ) ; } return objectCacheUnit . createEventSource ( createAsyncEventSource , cacheName ) ; }
This implements the method in the CacheUnit interface . This is called to create event source object . It calls ObjectCacheUnit to perform this operation .
36,671
public DERObject toASN1Object ( ) { ASN1EncodableVector dev = new ASN1EncodableVector ( ) ; dev . add ( policyQualifierId ) ; dev . add ( qualifier ) ; return new DERSequence ( dev ) ; }
Returns a DER - encodable representation of this instance .
36,672
public void sendAckExpectedMessage ( long ackExpStamp , int priority , Reliability reliability , SIBUuid12 stream ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "sendAckExpectedMessage" , new Object [ ] { new Long ( ackExpStamp ) , new Integer ( priority ) , reliability } ) ; if ( routingMEUuid != null ) { ControlAckExpected ackexpMsg ; try { ackexpMsg = cmf . createNewControlAckExpected ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.sendAckExpectedMessage" , "1:733:1.241" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendAckExpectedMessage" , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler" , "1:744:1.241" , e } ) ; throw new SIResourceException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler" , "1:752:1.241" , e } , null ) , e ) ; } SIMPUtils . setGuaranteedDeliveryProperties ( ackexpMsg , messageProcessor . getMessagingEngineUuid ( ) , targetMEUuid , stream , null , destinationHandler . getUuid ( ) , ProtocolType . UNICASTINPUT , GDConfig . PROTOCOL_VERSION ) ; ackexpMsg . setTick ( ackExpStamp ) ; ackexpMsg . setPriority ( priority ) ; ackexpMsg . setReliability ( reliability ) ; SourceStream sourceStream = ( SourceStream ) sourceStreamManager . getStreamSet ( ) . getStream ( priority , reliability ) ; if ( sourceStream != null ) { sourceStream . setLatestAckExpected ( ackExpStamp ) ; sourceStream . getControlAdapter ( ) . getHealthState ( ) . updateHealth ( HealthStateListener . ACK_EXPECTED_STATE , HealthState . AMBER ) ; } if ( isLink ) { ackexpMsg = ( ControlAckExpected ) addLinkProps ( ackexpMsg ) ; } if ( this . isSystemOrTemp ) { ackexpMsg . setRoutingDestination ( routingDestination ) ; } mpio . sendToMe ( routingMEUuid , priority , ackexpMsg ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unable to send AckExpected as Link not started" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendAckExpectedMessage" ) ; }
sendAckExpectedMessage is called from SourceStream timer alarm
36,673
public void sendSilenceMessage ( long startStamp , long endStamp , long completedPrefix , boolean requestedOnly , int priority , Reliability reliability , SIBUuid12 stream ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "sendSilenceMessage" ) ; ControlSilence sMsg ; try { sMsg = cmf . createNewControlSilence ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.sendSilenceMessage" , "1:849:1.241" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler" , "1:856:1.241" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendSilenceMessage" , e ) ; throw new SIResourceException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler" , "1:867:1.241" , e } , null ) , e ) ; } SIMPUtils . setGuaranteedDeliveryProperties ( sMsg , messageProcessor . getMessagingEngineUuid ( ) , targetMEUuid , stream , null , destinationHandler . getUuid ( ) , ProtocolType . UNICASTINPUT , GDConfig . PROTOCOL_VERSION ) ; sMsg . setStartTick ( startStamp ) ; sMsg . setEndTick ( endStamp ) ; sMsg . setPriority ( priority ) ; sMsg . setReliability ( reliability ) ; sMsg . setCompletedPrefix ( completedPrefix ) ; if ( isLink ) { sMsg = ( ControlSilence ) addLinkProps ( sMsg ) ; } if ( this . isSystemOrTemp ) { sMsg . setRoutingDestination ( routingDestination ) ; } if ( requestedOnly ) mpio . sendToMe ( routingMEUuid , priority + 1 , sMsg ) ; else mpio . sendToMe ( routingMEUuid , priority , sMsg ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendSilenceMessage" ) ; }
sendSilenceMessage may be called from SourceStream when a Nack is recevied
36,674
protected void handleRollback ( LocalTransaction transaction ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "handleRollback" , transaction ) ; if ( transaction != null ) { try { transaction . rollback ( ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.handleRollback" , "1:1644:1.241" , this ) ; SibTr . exception ( tc , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "handleRollback" ) ; }
This method checks to see if rollback is required
36,675
public void updateTargetCellule ( SIBUuid8 targetMEUuid ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "updateTargetCellule" , targetMEUuid ) ; this . targetMEUuid = targetMEUuid ; sourceStreamManager . updateTargetCellule ( targetMEUuid ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "updateTargetCellule" ) ; }
This method should only be called when the PtoPOutputHandler was created for a Link with an unknown targetCellule and WLM has now told us correct targetCellule .
36,676
public void updateRoutingCellule ( SIBUuid8 routingME ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "updateRoutingCellule" , routingME ) ; this . routingMEUuid = routingME ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "updateRoutingCellule" ) ; }
This method should only be called when the PtoPOutputHandler was created for a Link . It is called every time a message is sent
36,677
public void enqueueWork ( AsyncUpdate unit ) throws ClosedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "enqueueWork" , unit ) ; synchronized ( this ) { if ( closed ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "enqueueWork" , "ClosedException" ) ; throw new ClosedException ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Enqueueing update: " + unit ) ; enqueuedUnits . add ( unit ) ; if ( executing ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "enqueueWork" , "AsyncUpdateThread executing" ) ; return ; } if ( enqueuedUnits . size ( ) > batchThreshold ) { executeSinceExpiry = true ; try { startExecutingUpdates ( ) ; } catch ( ClosedException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "enqueueWork" , e ) ; throw e ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "enqueueWork" ) ; }
Enqueue an AsyncUpdate
36,678
private void startExecutingUpdates ( ) throws ClosedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "startExecutingUpdates" ) ; ArrayList temp = executingUnits ; executingUnits = enqueuedUnits ; enqueuedUnits = temp ; enqueuedUnits . clear ( ) ; executing = true ; try { LocalTransaction tran = tranManager . createLocalTransaction ( false ) ; ExecutionThread thread = new ExecutionThread ( executingUnits , tran ) ; mp . startNewSystemThread ( thread ) ; } catch ( InterruptedException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.store.AsyncUpdateThread.startExecutingUpdates" , "1:222:1.28" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "startExecutingUpdates" , e ) ; closed = true ; throw new ClosedException ( e . getMessage ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "startExecutingUpdates" ) ; }
Internal method . Should be called from within a synchronized block .
36,679
public void alarm ( Object thandle ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "alarm" , new Object [ ] { this , mp . getMessagingEngineUuid ( ) } ) ; synchronized ( this ) { if ( ! closed ) { if ( ( executeSinceExpiry ) || executing ) { executeSinceExpiry = false ; } else { try { if ( enqueuedUnits . size ( ) > 0 ) startExecutingUpdates ( ) ; } catch ( ClosedException e ) { } } } } if ( maxCommitInterval > 0 ) { mp . getAlarmManager ( ) . create ( maxCommitInterval , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "alarm" ) ; }
end class ExecutionThread ...
36,680
public void waitTillAllUpdatesExecuted ( ) throws InterruptedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "waitTillAllUpdatesExecuted" ) ; synchronized ( this ) { while ( enqueuedUnits . size ( ) > 0 || executing ) { try { this . wait ( ) ; } catch ( InterruptedException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "waitTillAllUpdatesExecuted" , e ) ; throw e ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "waitTillAllUpdatesExecuted" ) ; }
This method blocks till there are 0 enqueued updates and 0 executing updates . Useful for unit testing .
36,681
public Throwable getRootCause ( ) { Throwable root = getError ( ) ; while ( true ) { if ( root instanceof ServletException ) { ServletException se = ( ServletException ) _error ; Throwable seRoot = se . getRootCause ( ) ; if ( seRoot == null ) { return root ; } else if ( seRoot . equals ( root ) ) { return root ; } else { root = seRoot ; } } else { return root ; } } }
Get the original cause of the error . Use of ServletExceptions by the engine to rethrow errors can cause the original error to be buried within one or more exceptions . This method will sift through the wrapped ServletExceptions to return the original error .
36,682
protected void activate ( ComponentContext context ) { securityServiceRef . activate ( context ) ; unauthSubjectServiceRef . activate ( context ) ; authServiceRef . activate ( context ) ; credServiceRef . activate ( context ) ; }
Called during service activation .
36,683
protected void initialise ( String logFileName , int logFileType , java . util . Map objectStoreLocations , ObjectManagerEventCallback [ ] callbacks ) throws ObjectManagerException { final String methodName = "initialise" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { logFileName , new Integer ( logFileType ) , objectStoreLocations , callbacks } ) ; if ( objectStoreLocations == null ) objectStoreLocations = new java . util . HashMap ( ) ; for ( ; ; ) { synchronized ( objectManagerStates ) { objectManagerState = ( ObjectManagerState ) objectManagerStates . get ( logFileName ) ; if ( objectManagerState == null ) { objectManagerState = createObjectManagerState ( logFileName , logFileType , objectStoreLocations , callbacks ) ; objectManagerStates . put ( logFileName , objectManagerState ) ; } } synchronized ( objectManagerState ) { if ( objectManagerState . state == ObjectManagerState . stateColdStarted || objectManagerState . state == ObjectManagerState . stateWarmStarted ) { break ; } else { try { objectManagerState . wait ( ) ; } catch ( InterruptedException exception ) { ObjectManager . ffdc . processException ( cclass , methodName , exception , "1:260:1.28" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , exception ) ; throw new UnexpectedExceptionException ( this , exception ) ; } } } } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Create a handle for the ObjectManagerState and initialise it of necessary .
36,684
protected ObjectManagerState createObjectManagerState ( String logFileName , int logFileType , java . util . Map objectStoreLocations , ObjectManagerEventCallback [ ] callbacks ) throws ObjectManagerException { return new ObjectManagerState ( logFileName , this , logFileType , objectStoreLocations , callbacks ) ; }
Instantiate the ObjectManagerState . A subclass of ObjectManager should override this method if a subclass of ObjecManagerState is required .
36,685
public final boolean warmStarted ( ) { final String methodName = "warmStarted" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName ) ; boolean isWarmStarted = false ; if ( objectManagerState . state == ObjectManagerState . stateWarmStarted ) isWarmStarted = true ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Boolean ( isWarmStarted ) ) ; return isWarmStarted ; }
returns true if the objectManager was warm started .
36,686
public final void shutdown ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "shutdown" ) ; objectManagerState . shutdown ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "shutdown" ) ; }
Terminates the ObjectManager .
36,687
public final void shutdownFast ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "shutdownFast" ) ; if ( ! testInterfaces ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "shutdownFast" , "via InterfaceDisabledException" ) ; throw new InterfaceDisabledException ( this , "shutdownFast" ) ; } objectManagerState . shutdownFast ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "shutdownFast" ) ; }
Terminates the ObjectManager without taking a checkpoint . The allows the ObjectManager to be restarted as if it had crashed and is only intended for testing emergency restart .
36,688
public final void waitForCheckpoint ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "waitForCheckpoint" ) ; if ( ! testInterfaces ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "waitForCheckpoint via InterfaceDisabledException" ) ; throw new InterfaceDisabledException ( this , "waitForCheckpoint" ) ; } objectManagerState . waitForCheckpoint ( true ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "waitForCheckpoint" ) ; }
Waits for one checkpoint to complete .
36,689
public final Transaction getTransaction ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getTransaction" ) ; objectManagerState . transactionPacing ( ) ; Transaction transaction = objectManagerState . getTransaction ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "getTransaction" , "returns transaction=" + transaction + "(Transaction)" ) ; return transaction ; }
Factory method to crate a new transaction for use with the ObjectManager .
36,690
public final Transaction getTransactionByXID ( byte [ ] XID ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getTransactionByXID" , "XIDe=" + XID + "(byte[]" ) ; Transaction transaction = objectManagerState . getTransactionByXID ( XID ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "getTransactionByXID" , "returns transaction=" + transaction + "(Transaction)" ) ; return transaction ; }
Locate a transaction registered with this ObjectManager . with the same XID as the one passed . If a null XID is passed this will return any registered transaction with a null XID .
36,691
public final java . util . Iterator getTransactionIterator ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getTransactionIterator" ) ; java . util . Iterator transactionIterator = objectManagerState . getTransactionIterator ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "getTransactionIterator" , "returns transactionIterator" + transactionIterator + "(java.util.Iterator)" ) ; return transactionIterator ; }
Create an iterator over all transactions known to this ObjectManager . The iterator returned is safe against concurrent modification of the set of transactions new transactions created after the iterator is created may not be covered by the iterator .
36,692
public final ObjectStore getObjectStore ( String objectStoreName ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getObjectStore" , "objectStoreName=" + objectStoreName + "(String)" ) ; ObjectStore objectStore = objectManagerState . getObjectStore ( objectStoreName ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "getObjectStore" , "returns objectStore=" + objectStore + "(ObjectStore)" ) ; return objectStore ; }
Locate an ObjectStore used by this objectManager .
36,693
public final java . util . Iterator getObjectStoreIterator ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getObjectStoreIterator" ) ; java . util . Iterator objectStoreIterator = objectManagerState . getObjectStoreIterator ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "getObjectStoreIterator" , new Object [ ] { objectStoreIterator } ) ; return objectStoreIterator ; }
Create an iterator over all ObjectStores known to this ObjectManager .
36,694
public final Token getNamedObject ( String name , Transaction transaction ) throws ObjectManagerException { final String methodName = "getNamedObject" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { name , transaction } ) ; if ( objectManagerState . namedObjects == null ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , "via NoRestartableObjectStoresAvailableException" ) ; throw new NoRestartableObjectStoresAvailableException ( this ) ; } TreeMap namedObjectsTree = ( TreeMap ) objectManagerState . namedObjects . getManagedObject ( ) ; Token token = ( Token ) namedObjectsTree . get ( name , transaction ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { token } ) ; return token ; }
Locate a Token by name within this objectManager .
36,695
public final Token removeNamedObject ( String name , Transaction transaction ) throws ObjectManagerException { final String methodName = "removeNamedObject" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { name , transaction } ) ; Token tokenOut = null ; if ( objectManagerState . namedObjects == null ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , "via NoRestartablebjectStoresAvailableException" ) ; throw new NoRestartableObjectStoresAvailableException ( this ) ; } java . util . Iterator objectStoreIterator = objectManagerState . objectStores . values ( ) . iterator ( ) ; while ( objectStoreIterator . hasNext ( ) ) { ObjectStore objectStore = ( ObjectStore ) objectStoreIterator . next ( ) ; if ( objectStore . getContainsRestartData ( ) ) { Token namedObjectsToken = new Token ( objectStore , ObjectStore . namedObjectTreeIdentifier . longValue ( ) ) ; namedObjectsToken = objectStore . like ( namedObjectsToken ) ; TreeMap namedObjectsTree = ( TreeMap ) namedObjectsToken . getManagedObject ( ) ; tokenOut = ( Token ) namedObjectsTree . remove ( name , transaction ) ; } } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { tokenOut } ) ; return tokenOut ; }
Remove a named ManagedObject locatable by name within this objectManager .
36,696
public final void setTransactionsPerCheckpoint ( long persistentTransactionsPerCheckpoint , long nonPersistentTransactionsPerCheckpoint , Transaction transaction ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "setTransactionsPerCheckpoint" , new Object [ ] { new Long ( persistentTransactionsPerCheckpoint ) , new Long ( nonPersistentTransactionsPerCheckpoint ) , transaction } ) ; transaction . lock ( objectManagerState ) ; objectManagerState . persistentTransactionsPerCheckpoint = persistentTransactionsPerCheckpoint ; objectManagerState . nonPersistentTransactionsPerCheckpoint = nonPersistentTransactionsPerCheckpoint ; transaction . replace ( objectManagerState ) ; objectManagerState . saveClonedState ( transaction ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setTransactionsPerCheckpoint" ) ; }
Create a named ManagedObject by name within this objectManager .
36,697
public final void setMaximumActiveTransactions ( int maximumActiveTransactions , Transaction transaction ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "setMaximumActiveTransactions" , new Object [ ] { new Integer ( maximumActiveTransactions ) , transaction } ) ; transaction . lock ( objectManagerState ) ; objectManagerState . maximumActiveTransactions = maximumActiveTransactions ; transaction . replace ( objectManagerState ) ; objectManagerState . saveClonedState ( transaction ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setMaximumActiveTransactions" ) ; }
Change the maximum active transactrions that the ObjectManager will allow to start . If this call reduces the maximum then existing transactions continue but no new ones are allowed until the total has fallen below the new maximum .
36,698
public java . util . Map captureStatistics ( String name ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "captureStatistics" , new Object [ ] { name } ) ; java . util . Map statistics = new java . util . HashMap ( ) ; synchronized ( objectManagerState ) { if ( ! ( objectManagerState . state == ObjectManagerState . stateColdStarted ) && ! ( objectManagerState . state == ObjectManagerState . stateWarmStarted ) ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "addEntry" , new Object [ ] { new Integer ( objectManagerState . state ) , ObjectManagerState . stateNames [ objectManagerState . state ] } ) ; throw new InvalidStateException ( this , objectManagerState . state , ObjectManagerState . stateNames [ objectManagerState . state ] ) ; } if ( name . equals ( "*" ) ) { statistics . putAll ( objectManagerState . logOutput . captureStatistics ( ) ) ; statistics . putAll ( captureStatistics ( ) ) ; } else if ( name . equals ( "LogOutput" ) ) { statistics . putAll ( objectManagerState . logOutput . captureStatistics ( ) ) ; } else if ( name . equals ( "ObjectManager" ) ) { statistics . putAll ( captureStatistics ( ) ) ; } else { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "captureStatistics" , new Object [ ] { name } ) ; throw new StatisticsNameNotFoundException ( this , name ) ; } } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "captureStatistics" , statistics ) ; return statistics ; }
Capture statistics .
36,699
public void registerEventCallback ( ObjectManagerEventCallback callback ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "registerEventCallback" , callback ) ; objectManagerState . registerEventCallback ( callback ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "registerEventCallback" ) ; }
Defect 495856 496893