idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
25,300
private AppMessageHelper getAppMessageHelper ( String type , String fileName ) { if ( type == null && fileName != null ) { String [ ] parts = fileName . split ( "[\\\\/]" ) ; if ( parts . length > 0 ) { String last = parts [ parts . length - 1 ] ; int dot = last . indexOf ( '.' ) ; type = dot >= 0 ? last . substring ( dot + 1 ) : parts . length > 1 ? parts [ parts . length - 2 ] : null ; } } if ( type != null ) try { String filter = FilterUtils . createPropertyFilter ( AppManagerConstants . TYPE , type . toLowerCase ( ) ) ; @ SuppressWarnings ( "rawtypes" ) Collection < ServiceReference < ApplicationHandler > > refs = _ctx . getServiceReferences ( ApplicationHandler . class , filter ) ; if ( refs . size ( ) > 0 ) { @ SuppressWarnings ( "rawtypes" ) ServiceReference < ApplicationHandler > ref = refs . iterator ( ) . next ( ) ; ApplicationHandler < ? > appHandler = _ctx . getService ( ref ) ; try { return AppMessageHelper . get ( appHandler ) ; } finally { _ctx . ungetService ( ref ) ; } } } catch ( InvalidSyntaxException x ) { } return AppMessageHelper . get ( null ) ; }
Returns the message helper for the specified application handler type .
25,301
private void startApplication ( File currentFile , String type ) { if ( _tc . isEventEnabled ( ) ) { Tr . event ( _tc , "Starting dropin application '" + currentFile . getName ( ) + "'" ) ; } String filePath = getAppLocation ( currentFile ) ; try { Configuration config = _configs . get ( filePath ) ; if ( config == null ) { Hashtable < String , Object > appConfigSettings = new Hashtable < String , Object > ( ) ; appConfigSettings . put ( "location" , filePath ) ; if ( type != null ) { appConfigSettings . put ( "type" , type ) ; } appConfigSettings . put ( AppManagerConstants . AUTO_INSTALL_PROP , true ) ; config = configAdmin . createFactoryConfiguration ( AppManagerConstants . APPLICATIONS_PID ) ; config . update ( appConfigSettings ) ; _configs . put ( filePath , config ) ; } } catch ( Exception e ) { getAppMessageHelper ( type , filePath ) . error ( "MONITOR_APP_START_FAIL" , filePath ) ; } }
Takes a file and an optional file type and updates the file . If no type is given it will use the extension of the file given .
25,302
private static void populateInterceptorMethodMap ( Class < ? > c , LinkedList < Class < ? > > lifoClasses , InterceptorMethodKind kind , Class < ? > [ ] parmTypes , List < ? extends InterceptorCallback > methodMetaDataList , Map < InterceptorMethodKind , List < Method > > methodMap , boolean ejbClass , J2EEName name ) throws EJBConfigurationException { String className = c . getName ( ) ; List < Method > methodList = new LinkedList < Method > ( ) ; for ( InterceptorCallback methodMetaData : methodMetaDataList ) { String methodName = methodMetaData . getMethodName ( ) ; Method m = findMethod ( c , methodName , parmTypes ) ; if ( m == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , methodName + " not found in " + className + " or in any of it's super classes" ) ; } EJBConfigurationException ecex ; ecex = new EJBConfigurationException ( "CNTR0238E: " + methodName + " is not a " + kind . getXMLElementName ( ) + " method of EJB interceptor class " + className ) ; Tr . error ( tc , "INTERCEPTOR_METHOD_NOT_FOUND_CNTR0238E" , new Object [ ] { methodName , kind . getXMLElementName ( ) , className } ) ; throw ecex ; } if ( kind . isLifecycle ( ) ) { InterceptorMetaDataHelper . validateLifeCycleSignatureExceptParameters ( kind , kind . getXMLElementName ( ) , m , ejbClass , name ) ; } else { InterceptorMetaDataHelper . validateAroundSignature ( kind , m , name ) ; } methodList . add ( m ) ; } LinkedList < Method > lifo = InterceptorMetaDataHelper . getLIFOMethodList ( methodList , lifoClasses ) ; methodMap . put ( kind , lifo ) ; }
Populate the interceptor map for an EJB or interceptor class . Each mapping value is a List of Methods ordered by class hierarchy with methods from java . lang . Object appearing first which is the order required by the EJB specification .
25,303
public static LinkedList < Method > getLIFOMethodList ( List < Method > methodList , LinkedList < Class < ? > > lifoSuperClassesList ) { LinkedList < Method > sortedList = new LinkedList < Method > ( ) ; for ( Class < ? > c : lifoSuperClassesList ) { if ( methodList . isEmpty ( ) ) { break ; } Iterator < Method > it = methodList . iterator ( ) ; while ( it . hasNext ( ) ) { Method m = it . next ( ) ; if ( m . getDeclaringClass ( ) == c ) { sortedList . addFirst ( m ) ; it . remove ( ) ; } } } return sortedList ; }
Sorts a specified Method object list into a LIFO list where the first out is the Method object of the most generic super class of an interceptor class and the last out is a method of the interceptor class itself .
25,304
public static Method findMethod ( final Class < ? > c , String methodName , final Class < ? > [ ] parmTypes ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "findMethod" , new Object [ ] { c , methodName , Arrays . toString ( parmTypes ) } ) ; } Class < ? > classObject = c ; Method m = null ; while ( classObject != null && m == null ) { try { m = classObject . getDeclaredMethod ( methodName , parmTypes ) ; } catch ( NoSuchMethodException e ) { classObject = classObject . getSuperclass ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { if ( classObject != null ) { Tr . debug ( tc , "searching superclass: " + classObject . getName ( ) ) ; } else { Tr . debug ( tc , methodName + " was not found" ) ; } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "findMethod returning: " + m ) ; } return m ; }
Returns a Method object that reflects the specified method of a specified EJB or interceptor class . The methodName parameter is a String that specifies the simple name of the desired method and the parameterTypes parameter is an array of Class objects that identify the method s formal parameter types in the declared order . If more than one method with the same parameter types is declared in a class and one of these methods has a return type that is more specific than any of the others that method is returned ; otherwise one of the methods is chosen arbitrarily . If the specified class is extended and the methodName exists in more than one class of the inheritance tree then the subclass method is returned rather than the method in the more generic class .
25,305
public static LinkedList < Class < ? > > getLIFOSuperClassesList ( Class < ? > interceptorClass ) { LinkedList < Class < ? > > supers = new LinkedList < Class < ? > > ( ) ; supers . addFirst ( interceptorClass ) ; Class < ? > interceptorSuperClass = interceptorClass . getSuperclass ( ) ; while ( interceptorSuperClass != null && interceptorSuperClass != java . lang . Object . class ) { supers . addFirst ( interceptorSuperClass ) ; interceptorSuperClass = interceptorSuperClass . getSuperclass ( ) ; } return supers ; }
Create a LIFO LinkedList of Class objects starting with a specified interceptor class object itself and then each of its the super classes . A LIFO is used so that the interceptor methods in the most general superclass are invoked first as required by the EJB specification .
25,306
public static void validateAroundSignature ( InterceptorMethodKind kind , Method m , J2EEName name ) throws EJBConfigurationException { int mod = m . getModifiers ( ) ; if ( Modifier . isFinal ( mod ) || Modifier . isStatic ( mod ) ) { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_INTERCEPTOR_METHOD_MODIFIER_CNTR0229E" , new Object [ ] { method } ) ; throw new EJBConfigurationException ( kind . getXMLElementName ( ) + " interceptor \"" + method + "\" must not be declared as final or static." ) ; } Class < ? > [ ] parmTypes = m . getParameterTypes ( ) ; if ( ( parmTypes . length == 1 ) && ( parmTypes [ 0 ] . equals ( InvocationContext . class ) ) ) { } else { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E" , new Object [ ] { method , kind . getXMLElementName ( ) } ) ; throw new EJBConfigurationException ( kind . getXMLElementName ( ) + " interceptor \"" + method + "\" must have a single parameter of type javax.interceptors.InvocationContext." ) ; } Class < ? > returnType = m . getReturnType ( ) ; if ( returnType != Object . class ) { boolean compatiblyValid = kind == InterceptorMethodKind . AROUND_INVOKE && Object . class . isAssignableFrom ( returnType ) ; if ( ! compatiblyValid || isValidationLoggable ( ) ) { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E" , new Object [ ] { method , kind . getXMLElementName ( ) } ) ; if ( ! compatiblyValid || isValidationFailable ( ) ) { throw new EJBConfigurationException ( kind . getXMLElementName ( ) + " interceptor \"" + method + "\" must have a return value of type java.lang.Object." ) ; } } } }
Verify a specified AroundInvoke interceptor method has correct method modifiers and signature .
25,307
static void validateLifeCycleSignatureExceptParameters ( InterceptorMethodKind kind , String lifeCycle , Method m , boolean ejbClass , J2EEName name , boolean isInterceptor1_2 ) throws EJBConfigurationException { if ( kind == InterceptorMethodKind . AROUND_CONSTRUCT && ejbClass ) { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_AROUND_CONSTRUCT_DEFINITION_CNTR0249E" , new Object [ ] { name . getComponent ( ) , name . getModule ( ) , name . getApplication ( ) , method } ) ; throw new EJBConfigurationException ( "CNTR0249E: The " + name . getComponent ( ) + " enterprise bean in the " + name . getModule ( ) + " module in the " + name . getApplication ( ) + " application specifies the @AroundConstruct annotation on the " + method + " method, but this annotation can only be used by interceptor classes." ) ; } int mod = m . getModifiers ( ) ; if ( Modifier . isFinal ( mod ) || Modifier . isStatic ( mod ) ) { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_INTERCEPTOR_METHOD_MODIFIER_CNTR0229E" , new Object [ ] { method } ) ; throw new EJBConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must not be declared as final or static." ) ; } Class < ? > returnType = m . getReturnType ( ) ; if ( returnType == java . lang . Void . TYPE || ( isInterceptor1_2 && returnType == Object . class ) ) { } else { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_LIFECYCLE_SIGNATURE_CNTR0231E" , new Object [ ] { method , lifeCycle } ) ; throw new EJBConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must have void as return type." ) ; } }
Method for unittesting only
25,308
public static boolean isMethodOverridden ( Method m , LinkedList < Class < ? > > supers ) { int methodModifier = m . getModifiers ( ) ; if ( ! Modifier . isPrivate ( methodModifier ) ) { int startIndex = supers . indexOf ( m . getDeclaringClass ( ) ) + 1 ; if ( startIndex < supers . size ( ) ) { String name = m . getName ( ) ; Class < ? > [ ] pTypes = m . getParameterTypes ( ) ; for ( ListIterator < Class < ? > > lit = supers . listIterator ( startIndex ) ; lit . hasNext ( ) ; ) { Class < ? > subClass = lit . next ( ) ; try { subClass . getDeclaredMethod ( name , pTypes ) ; return true ; } catch ( NoSuchMethodException e ) { } } } } return false ; }
d469514 - added entire method .
25,309
protected static ReturnCode createExtractor ( ) { if ( ! extractorCreated ) { createExtractor_rc = SelfExtractor . buildInstance ( ) ; extractor = SelfExtractor . getInstance ( ) ; extractorCreated = true ; } return createExtractor_rc ; }
ok to call this before doMain from subclass main
25,310
private void expectedByte ( int position , int count ) throws UTFDataFormatException { String msg = JspCoreException . getMsg ( "jsp.error.xml.expectedByte" , new Object [ ] { Integer . toString ( position ) , Integer . toString ( count ) } ) ; throw new UTFDataFormatException ( msg ) ; }
Throws an exception for expected byte .
25,311
private void invalidByte ( int position , int count , int c ) throws UTFDataFormatException { String msg = JspCoreException . getMsg ( "jsp.error.xml.invalidByte" , new Object [ ] { Integer . toString ( position ) , Integer . toString ( count ) } ) ; throw new UTFDataFormatException ( msg ) ; }
Throws an exception for invalid byte .
25,312
private void invalidSurrogate ( int uuuuu ) throws UTFDataFormatException { String msg = JspCoreException . getMsg ( "jsp.error.xml.invalidHighSurrogate" , new Object [ ] { Integer . toHexString ( uuuuu ) } ) ; throw new UTFDataFormatException ( msg ) ; }
Throws an exception for invalid surrogate bits .
25,313
public void alarm ( Object context ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "alarm" , context ) ; btmLockManager . lock ( ) ; boolean btmLocked = true ; timeoutLockManager . lockExclusive ( ) ; boolean timeoutLocked = true ; try { if ( ! timedout . isEmpty ( ) && ! isStopped ) { btmLockManager . unlock ( ) ; btmLocked = false ; List tempTimeoutList = timedout ; timedout = new ArrayList < BatchedTimeoutEntry > ( ) ; timeoutLockManager . unlockExclusive ( ) ; timeoutLocked = false ; try { handler . processTimedoutEntries ( tempTimeoutList ) ; batchFailed = false ; batchCleared = false ; } catch ( Throwable e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.utils.am.BatchedTimeoutManager.alarm" , "1:280:1.24" , new Object [ ] { this , handler , tempTimeoutList } ) ; SibTr . exception ( tc , e ) ; if ( ! batchFailed ) batchFailed = true ; else { batchFailed = false ; Iterator itr = tempTimeoutList . iterator ( ) ; while ( itr . hasNext ( ) ) { BatchedTimeoutEntry bte = ( BatchedTimeoutEntry ) itr . next ( ) ; removeTimeoutEntry ( bte ) ; } if ( batchCleared ) { SIErrorException e2 = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.utils.am.BatchedTimeoutManager.alarm" , "1:325:1.24" } , null ) , e ) ; FFDCFilter . processException ( e2 , "com.ibm.ws.sib.processor.utils.am.BatchedTimeoutManager.alarm" , "1:331:1.24" , this ) ; SibTr . exception ( tc , e2 ) ; stopTimer ( ) ; } else batchCleared = true ; } } restartEntries ( tempTimeoutList ) ; } } finally { if ( timeoutLocked ) timeoutLockManager . unlockExclusive ( ) ; if ( btmLocked ) btmLockManager . unlock ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "alarm" ) ; }
The group alarm call . The context on this call will be null .
25,314
private void restartEntries ( List timedout ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "restartEntries" , new Object [ ] { timedout } ) ; Iterator itr = timedout . iterator ( ) ; while ( itr . hasNext ( ) ) { BatchedTimeoutEntry bte = ( BatchedTimeoutEntry ) itr . next ( ) ; LinkedListEntry entry = bte . getEntry ( ) ; if ( entry != null && activeEntries . contains ( entry ) ) { startNewAlarm ( entry ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "restartEntries" ) ; }
Restart alarms for a a list of BTEs
25,315
public void startTimer ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "startTimer" ) ; btmLockManager . lockExclusive ( ) ; try { if ( isStopped ) { isStopped = false ; LinkedListEntry entry = ( LinkedListEntry ) activeEntries . getFirst ( ) ; while ( entry != null && activeEntries . contains ( entry ) ) { startNewAlarm ( entry ) ; entry = ( LinkedListEntry ) entry . getNext ( ) ; } } } finally { btmLockManager . unlockExclusive ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "startTimer" ) ; }
Start the BatchedTimeoutManager
25,316
private void startNewAlarm ( LinkedListEntry entry ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "startNewAlarm" , new Object [ ] { entry } ) ; entry . alarm = am . create ( delta , percentLate , this , entry ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "startNewAlarm" ) ; }
Start a new alarm for a given entry in the active list .
25,317
public void stopTimer ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stopTimer" ) ; btmLockManager . lockExclusive ( ) ; try { if ( ! isStopped ) { isStopped = true ; LinkedListEntry entry = ( LinkedListEntry ) activeEntries . getFirst ( ) ; while ( entry != null && activeEntries . contains ( entry ) ) { if ( entry . alarm != null ) { entry . alarm . cancel ( ) ; entry . alarm = null ; } entry = ( LinkedListEntry ) entry . getNext ( ) ; } } } finally { btmLockManager . unlockExclusive ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stopTimer" ) ; }
Stop the BatchedTimeoutManager
25,318
public void close ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "close" ) ; btmLockManager . lockExclusive ( ) ; try { stopTimer ( ) ; activeEntries = null ; } finally { btmLockManager . unlockExclusive ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "close" ) ; }
Method to close this timer forever
25,319
public synchronized void setCache ( RemoteListCache cache ) { if ( cache != null && ( this . cache == null || ! this . cache . isComplete ( ) ) ) { this . cache = cache ; } }
sets cache for the query result on this instance
25,320
public Object decode ( byte [ ] frame , int offset , int indirect , JMFMessageData msg ) throws JMFMessageCorruptionException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "decode" , new Object [ ] { frame , offset , indirect , msg } ) ; Object result = null ; if ( indirect < 0 ) { indirect = this . indirect ; } if ( indirect > 0 ) { result = new JSVaryingListImpl ( frame , offset , element , indirect ) ; } else if ( varying ) { result = new JSVaryingListImpl ( frame , offset , element , 0 ) ; } else { result = new JSFixedListImpl ( frame , offset , element ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "decode" , result ) ; return result ; }
Implement JSCoder . decode
25,321
public static void sanityCheck ( int length , byte [ ] frame , int offset ) throws JMFMessageCorruptionException { if ( length < 0 || offset + 4 + length > frame . length ) { JMFMessageCorruptionException jmce = new JMFMessageCorruptionException ( "Bad length: " + HexUtil . toString ( new int [ ] { length } ) + " at offset " + offset ) ; FFDCFilter . processException ( jmce , "com.ibm.ws.sib.mfp.jmf.impl.JSListCoder.sanityCheck" , "160" , Integer . valueOf ( length ) , new Object [ ] { MfpConstants . DM_BUFFER , frame , Integer . valueOf ( 0 ) , Integer . valueOf ( frame . length ) } ) ; throw jmce ; } }
A method to sanity check a 32 bit length value read from the message prior to allocating storage based on the value . The length is not allowed to be negative or to exceed the length of the remaining portion of the message s frame assuming that the length field is immediately followed by the data whose length it is .
25,322
public static FilterPredicate areEqual ( FilterableAttribute attribute , Object value ) { FilterPredicate pred = new FilterPredicate ( ) ; pred . attribute = attribute ; Class < ? > requiredType = attribute . getType ( ) ; if ( ! requiredType . isInstance ( value ) ) { throw new IllegalArgumentException ( "The value must be of the correct type for the FilterableAttribute." + " Expected: " + requiredType . getName ( ) + " but was " + value . getClass ( ) . getName ( ) ) ; } pred . values = Collections . singleton ( getString ( value ) ) ; return pred ; }
Create a predicate specifying that the value of the specified attribute must exactly match the supplied value . The value must also be the type specified by the FilterableAttribute
25,323
private static String getString ( Object value ) { if ( ! ( value instanceof Enum ) ) { return value . toString ( ) ; } Method method = null ; try { method = value . getClass ( ) . getMethod ( "getValue" ) ; } catch ( NoSuchMethodException e ) { } catch ( SecurityException e ) { } if ( method != null && method . getReturnType ( ) != String . class ) { method = null ; } if ( method == null ) { return value . toString ( ) ; } String answer = null ; try { answer = ( String ) method . invoke ( value ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( "The enum " + value . getClass ( ) . getName ( ) + " was expected to have a public getValue method" , e ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( "The enum " + value . getClass ( ) . getName ( ) + " was expected to have a public getValue method with no arguments" , e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( "The enum " + value . getClass ( ) . getName ( ) + " getValue method threw an unexpectd exception" , e ) ; } return answer ; }
From the value object find the field name that will be filtered on which is a effectively a key into a JSON object . This will generally be the result of calling toString on the object but for enums there maybe a getValue method which be used instead .
25,324
void rollbackResources ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "rollbackResources" , this ) ; distributeEnd ( XAResource . TMFAIL ) ; _outcome = false ; _retryRequired = distributeOutcome ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "rollbackResources" , _retryRequired ) ; }
Rollback all resources but do not drive state changes . Used when transaction HAS TIMED OUT . This will not start a retry thread
25,325
public void init ( UpgradeInputByteBufferUtil input ) { this . _inBuffer = input ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "init upgrade input" ) ; } }
this . in defined in SRTInputStream
25,326
public void addDiscoveredBda ( ArchiveType moduleType , WebSphereBeanDeploymentArchive bda ) throws CDIException { webSphereCDIDeployment . addBeanDeploymentArchive ( bda ) ; Set < WebSphereBeanDeploymentArchive > bdaSet = bdasByType . get ( moduleType ) ; if ( bdaSet != null ) { bdaSet . add ( bda ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Ignore this type: {0}, as CDI does not need to add this in the addDiscoveredBda " , moduleType ) ; } } String path = bda . getArchive ( ) . getPath ( ) ; if ( moduleType == ArchiveType . SHARED_LIB || moduleType == ArchiveType . EAR_LIB ) { libraryPaths . add ( path ) ; } else if ( moduleType == ArchiveType . RAR_MODULE || moduleType == ArchiveType . EJB_MODULE ) { modulePaths . add ( path ) ; } }
Registers a newly discovered BDA and adds it to the deployment
25,327
public void makeCrossBoundaryWiring ( ) throws CDIException { Collection < WebSphereBeanDeploymentArchive > sharedLibs = bdasByType . get ( ArchiveType . SHARED_LIB ) ; Collection < WebSphereBeanDeploymentArchive > earLibs = bdasByType . get ( ArchiveType . EAR_LIB ) ; Collection < WebSphereBeanDeploymentArchive > rarModules = bdasByType . get ( ArchiveType . RAR_MODULE ) ; Collection < WebSphereBeanDeploymentArchive > ejbModules = bdasByType . get ( ArchiveType . EJB_MODULE ) ; Collection < WebSphereBeanDeploymentArchive > warModules = bdasByType . get ( ArchiveType . WEB_MODULE ) ; Collection < WebSphereBeanDeploymentArchive > clientModules = bdasByType . get ( ArchiveType . CLIENT_MODULE ) ; Collection < WebSphereBeanDeploymentArchive > allAccessibleBdas = new HashSet < WebSphereBeanDeploymentArchive > ( ) ; allAccessibleBdas . addAll ( sharedLibs ) ; allAccessibleBdas . addAll ( earLibs ) ; allAccessibleBdas . addAll ( ejbModules ) ; allAccessibleBdas . addAll ( rarModules ) ; wireBdas ( earLibs , allAccessibleBdas ) ; wireBdas ( rarModules , allAccessibleBdas ) ; wireBdas ( ejbModules , allAccessibleBdas ) ; wireBdas ( warModules , allAccessibleBdas ) ; wireBdas ( clientModules , allAccessibleBdas ) ; wireBdasBasedOnClassLoader ( earLibs , warModules ) ; }
The method should be called last to wire all libraries and modules
25,328
private void wireBdas ( Collection < WebSphereBeanDeploymentArchive > wireFromBdas , Collection < WebSphereBeanDeploymentArchive > wireToBdas ) { for ( WebSphereBeanDeploymentArchive wireFromBda : wireFromBdas ) { Collection < BeanDeploymentArchive > accessibleBdas = wireFromBda . getBeanDeploymentArchives ( ) ; for ( WebSphereBeanDeploymentArchive wireToBda : wireToBdas ) { if ( ( wireToBda != wireFromBda ) && ( ( accessibleBdas == null ) || ! accessibleBdas . contains ( wireToBda ) ) ) { wireFromBda . addBeanDeploymentArchive ( wireToBda ) ; } } } }
Make a wire from the group of bdas to a set of destination bdas
25,329
public static String dumpString ( byte [ ] frame , int offset , int length ) { return dumpString ( frame , offset , length , false ) ; }
Create a formatted dump of a sequence of bytes
25,330
public static String dumpString ( byte [ ] frame , int offset , int length , boolean ascii ) { if ( ( frame == null ) || ( length == 0 ) ) return null ; StringBuffer buf = new StringBuffer ( ) ; StringBuffer asciibuf = new StringBuffer ( ) ; buf . append ( "Length=" ) . append ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { if ( i % 32 == 0 ) { if ( ascii ) { buf . append ( asciibuf ) ; asciibuf . setLength ( 0 ) ; asciibuf . append ( "\n" ) . append ( pad ( 0 ) ) . append ( " " ) ; } buf . append ( "\n" ) . append ( pad ( offset + i ) ) . append ( offset + i ) . append ( ": " ) ; } else if ( i % 16 == 0 ) { buf . append ( " " ) ; if ( ascii ) asciibuf . append ( " " ) ; } else if ( i % 4 == 0 ) { buf . append ( " " ) ; if ( ascii ) asciibuf . append ( " " ) ; } buf . append ( digits [ ( frame [ offset + i ] >>> 4 ) & 0x0f ] ) ; buf . append ( digits [ frame [ offset + i ] & 0x0f ] ) ; if ( ascii ) { if ( frame [ offset + i ] >= 0x20 && ( ( frame [ offset + i ] & 0x80 ) == 0 ) ) { asciibuf . append ( ' ' ) . append ( ( char ) frame [ offset + i ] ) ; } else { asciibuf . append ( " ." ) ; } } } if ( ascii ) buf . append ( asciibuf ) ; return buf . toString ( ) ; }
Create a formatted dump of a sequence of bytes with ascii translation if specified . Performs simple ascii translation . No DBCS translations .
25,331
public static void main ( String [ ] args ) { System . err . println ( toString ( new int [ ] { Integer . parseInt ( args [ 0 ] ) } ) ) ; }
A trivial int - to - hex converter
25,332
protected void traceJobStart ( String jobXMLName , Properties jobParameters ) { if ( logger . isLoggable ( Level . FINE ) ) { StringWriter jobParameterWriter = new StringWriter ( ) ; if ( jobParameters != null ) { try { jobParameters . store ( jobParameterWriter , "Job parameters on start: " ) ; } catch ( IOException e ) { jobParameterWriter . write ( "Job parameters on start: not printable" ) ; } } else { jobParameterWriter . write ( "Job parameters on start = null" ) ; } logger . fine ( "Starting job: jobXMLName = " + jobXMLName + "\n" + jobParameterWriter . toString ( ) ) ; } }
Trace job submission ..
25,333
protected void traceJobXML ( String jobXML ) { if ( logger . isLoggable ( Level . FINE ) ) { int concatLen = jobXML . length ( ) > 200 ? 200 : jobXML . length ( ) ; logger . fine ( "Starting job: " + jobXML . substring ( 0 , concatLen ) + "... truncated ..." ) ; } }
Trace job xml file ..
25,334
private String getMIMEType ( String path ) { String extension = getFileExtension ( path ) ; if ( extension == null ) { return FILE_TRANSFER_BINARY_MIME ; } if ( "zip" . equals ( extension ) || "ear" . equals ( extension ) || "war" . equals ( extension ) || "jar" . equals ( extension ) || "eba" . equals ( extension ) ) { return FILE_TRANSFER_ZIP_MIME ; } else if ( "pax" . equals ( extension ) ) { return FILE_TRANSFER_PAX_MIME ; } else if ( "gz" . equals ( extension ) || "gzip" . equals ( extension ) ) { return FILE_TRANSFER_GZIP_MIME ; } else if ( "tar" . equals ( extension ) ) { return FILE_TRANSFER_TAR_MIME ; } else if ( "txt" . equals ( extension ) || "log" . equals ( extension ) || "trace" . equals ( extension ) || "properties" . equals ( extension ) ) { return FILE_TRANSFER_TEXT_MIME ; } else if ( "xml" . equals ( extension ) || "xslt" . equals ( extension ) || "xsl" . equals ( extension ) ) { return FILE_TRANSFER_XML_MIME ; } else if ( "html" . equals ( extension ) || "htm" . equals ( extension ) ) { return FILE_TRANSFER_HTML_MIME ; } else { return FILE_TRANSFER_BINARY_MIME ; } }
Get the MIME type for the given path
25,335
private static String getFileExtension ( String path ) { int index = path . lastIndexOf ( '.' ) ; if ( index == - 1 ) { return null ; } return path . substring ( index + 1 ) . toLowerCase ( Locale . ENGLISH ) ; }
returns lower cased extension
25,336
private synchronized FileServiceMXBean getFileService ( ) { if ( fileService == null ) { try { fileService = JMX . newMXBeanProxy ( ManagementFactory . getPlatformMBeanServer ( ) , new ObjectName ( FileServiceMXBean . OBJECT_NAME ) , FileServiceMXBean . class ) ; } catch ( MalformedObjectNameException e ) { throw ErrorHelper . createRESTHandlerJsonException ( e , null , APIConstants . STATUS_INTERNAL_SERVER_ERROR ) ; } catch ( NullPointerException e ) { throw ErrorHelper . createRESTHandlerJsonException ( e , null , APIConstants . STATUS_INTERNAL_SERVER_ERROR ) ; } } return fileService ; }
File Service MXBean
25,337
public String getWritableLocation ( ) { String writableLocation = getWsLocationAdmin ( ) . resolveString ( "${server.output.dir}/workarea/" + UUID . randomUUID ( ) + "/" ) ; if ( writableLocation == null ) { IOException ioe = new IOException ( TraceNLS . getFormattedMessage ( this . getClass ( ) , APIConstants . TRACE_BUNDLE_FILE_TRANSFER , "NO_WRITE_LOCATION" , null , "CWWKX0128E: There are no configured writable locations on the routing server." ) ) ; throw ErrorHelper . createRESTHandlerJsonException ( ioe , null , APIConstants . STATUS_BAD_REQUEST ) ; } return writableLocation ; }
Return a unique directory within the workarea directory
25,338
public static String getFilename ( String path ) { final int index = path != null ? path . lastIndexOf ( "/" ) : - 1 ; if ( index == - 1 ) { IOException ioe = new IOException ( TraceNLS . getFormattedMessage ( FileTransferHelper . class , APIConstants . TRACE_BUNDLE_FILE_TRANSFER , "PATH_NOT_VALID" , new String [ ] { path } , "CWWKX0127E: The path " + path + " is not valid." ) ) ; throw ErrorHelper . createRESTHandlerJsonException ( ioe , null , APIConstants . STATUS_BAD_REQUEST ) ; } return path . substring ( index + 1 ) ; }
Get the filename from a given path
25,339
public void internalConsumeMessages ( final LockedMessageEnumeration lockedMessages , final AsynchDispatchScheduler asynchDispatchScheduler ) { final String methodName = "internalConsumeMessages" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { lockedMessages , asynchDispatchScheduler } ) ; } try { final List < DispatchableMessage > messages = new ArrayList < DispatchableMessage > ( ) ; SIBusMessage message ; while ( ( message = lockedMessages . nextLocked ( ) ) != null ) { final Map handlerContext = new FastSerializableHashMap ( ) ; DispatchableMessage dispatchableMessage = new DispatchableMessage ( message , handlerContext ) ; messages . add ( dispatchableMessage ) ; if ( _deleteUnrecoverableMessages && ( _unrecoverableReliability . compareTo ( message . getReliability ( ) ) >= 0 ) ) { lockedMessages . deleteCurrent ( null ) ; } } if ( messages . size ( ) != 0 ) { final SibRaWork work = new SibRaWork ( ) ; work . schedule ( messages , asynchDispatchScheduler , this ) ; } } catch ( final Throwable throwable ) { FFDCFilter . processException ( throwable , CLASS_NAME + "." + methodName , "1:375:1.42" , this ) ; SibTr . error ( TRACE , "RETRIEVE_MESSAGES_CWSIV1100" , new Object [ ] { throwable , lockedMessages } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
The consumeMessages method is invoked by the message processor with an enumeration containing one or more messages locked to this consumer . The consumeMessages method will either call the internalConsumeMessage method directly or if XD wishes to suspend the processing this method will be called then XD decides to resume processing . This method retrieves the messages from the enumeration . It then schedules a piece of work that will create the dispatcher on a new thread .
25,340
protected void processCachedMessage ( SIBusMessage message , LockedMessageEnumeration lockedMessages ) throws SISessionDroppedException , SIConnectionDroppedException , SISessionUnavailableException , SIConnectionUnavailableException , SIConnectionLostException , SILimitExceededException , SIMessageNotLockedException , SIResourceException , SIIncorrectCallException { if ( _deleteBestEffortNonPersistentMessages && Reliability . BEST_EFFORT_NONPERSISTENT . equals ( message . getReliability ( ) ) ) { lockedMessages . deleteCurrent ( null ) ; } }
Perform any processing on a message that is required whilst creating the cached locked message enumeration .
25,341
int getMaxActiveMessages ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { final String methodName = "getMaxActiveMessages" ; SibTr . entry ( this , TRACE , methodName ) ; } int maxActiveMsgs = _strictMessageOrdering ? 1 : 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { final String methodName = "getMaxActiveMessages" ; SibTr . exit ( this , TRACE , methodName , maxActiveMsgs ) ; } return maxActiveMsgs ; }
Returns the maximum number of active messages that should be associated with this listener at any one time .
25,342
long getMessageLockExpiry ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { final String methodName = "getMessageLockExpiry" ; SibTr . entry ( this , TRACE , methodName ) ; SibTr . exit ( this , TRACE , methodName , "0" ) ; } return 0 ; }
Returns the expiry time for message locks .
25,343
protected static LogRecord getUserLogRecord ( java . io . DataInputStream dataInputStream , ObjectManagerState objectManagerState ) throws ObjectManagerException { final String methodName = "getUserLogRecord" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( cclass , methodName , new Object [ ] { dataInputStream , objectManagerState } ) ; byte [ ] logRecordBytes ; try { long serializedLogRecordLength = dataInputStream . readLong ( ) ; logRecordBytes = new byte [ ( int ) serializedLogRecordLength ] ; dataInputStream . read ( logRecordBytes ) ; } catch ( java . io . IOException exception ) { ObjectManager . ffdc . processException ( cclass , methodName , exception , "1:94:1.8" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( cclass , methodName , new Object [ ] { exception } ) ; throw new PermanentIOException ( "LogRecord" , exception ) ; } LogRecord logRecord = ( LogRecord ) deserialize ( logRecordBytes , objectManagerState ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( cclass , methodName , logRecord ) ; return logRecord ; }
Recover a user defined Log Record from a DataInputStream
25,344
protected boolean atStart ( ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "atStart" ) ; boolean atStartOfLogRecord = ( bufferCursor == 0 ) && ( bufferByteCursor == 0 ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "atStart" , "returns atStartOfLogRecord=" + atStartOfLogRecord + "(boolean)" ) ; return atStartOfLogRecord ; }
Indicates whether the buffer cursors are positioned at the start of the LogRecord buffers indicating that no logBuffers have been filled yet .
25,345
protected ObjectManagerByteArrayOutputStream [ ] getBuffers ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getBuffers" ) ; ObjectManagerByteArrayOutputStream serializedLogRecord = serialize ( this ) ; ObjectManagerByteArrayOutputStream [ ] buffers = new ObjectManagerByteArrayOutputStream [ 2 ] ; buffers [ 0 ] = new ObjectManagerByteArrayOutputStream ( 4 + 8 ) ; buffers [ 0 ] . writeInt ( LogRecord . TYPE_USER_DEFINED ) ; buffers [ 0 ] . writeLong ( serializedLogRecord . getCount ( ) ) ; buffers [ 1 ] = serializedLogRecord ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "getBuffers" , "returns buffers=" + buffers + "(byte[][])" ) ; return buffers ; }
Gives back the serialized LogRecord as arrays of bytes . Unless overriden this simply serializes the Log Record .
25,346
protected ObjectManagerByteArrayOutputStream serialize ( java . io . Serializable serializableObject ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "serialize" , new Object [ ] { serializableObject } ) ; ObjectManagerByteArrayOutputStream byteArrayOutputStream = new ObjectManagerByteArrayOutputStream ( ) ; try { java . io . ObjectOutputStream objectOutputStream = new java . io . ObjectOutputStream ( byteArrayOutputStream ) ; objectOutputStream . writeObject ( serializableObject ) ; objectOutputStream . close ( ) ; } catch ( java . io . IOException exception ) { ObjectManager . ffdc . processException ( this , cclass , "serialize" , exception , "1:303:1.8" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "serialize" , exception ) ; throw new PermanentIOException ( this , exception ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "serialize" , new Object [ ] { byteArrayOutputStream } ) ; return byteArrayOutputStream ; }
Serialize s an Object by turning it into an array of bytes .
25,347
protected static Object deserialize ( byte [ ] objectBytes , ObjectManagerState objectManagerState ) throws ObjectManagerException { final String methodName = "deserialize" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( cclass , methodName , new Object [ ] { objectBytes , objectManagerState } ) ; java . io . ByteArrayInputStream byteArrayInputStream = new java . io . ByteArrayInputStream ( objectBytes ) ; Object object = null ; try { ManagedObjectInputStream managedObjectInputStream = new ManagedObjectInputStream ( byteArrayInputStream , objectManagerState ) ; object = managedObjectInputStream . readObject ( ) ; managedObjectInputStream . close ( ) ; } catch ( java . lang . ClassNotFoundException exception ) { ObjectManager . ffdc . processException ( cclass , methodName , exception , "1:347:1.8" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( cclass , methodName , exception ) ; throw new ClassNotFoundException ( cclass , exception ) ; } catch ( java . io . IOException exception ) { ObjectManager . ffdc . processException ( cclass , methodName , exception , "1:357:1.8" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( cclass , methodName , exception ) ; throw new PermanentIOException ( cclass , exception ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( cclass , methodName , new Object [ ] { object } ) ; return object ; }
Turns a serialized Object from an array of bytes back into an object .
25,348
public final int getTransactionTimeout ( ) throws XAException { if ( ivManagedConnection . _mcStale ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "MC is stale throwing XAER_RMFAIL" , ivManagedConnection ) ; Tr . error ( tc , "INVALID_CONNECTION" ) ; throw new XAException ( XAException . XAER_RMFAIL ) ; } return ivXaRes . getTransactionTimeout ( ) ; }
Obtain the current transaction timeout value set for this XAResource instance . If XAResource . setTransactionTimeout was not use prior to invoking this method the return value is the default timeout set for the resource manager ; otherwise the value used in the previous setTransactionTimeout call is returned .
25,349
public < T > ConfigBuilder withConverter ( Class < T > type , int priority , Converter < T > converter ) { synchronized ( this ) { UserConverter < ? > userConverter = UserConverter . newInstance ( type , priority , converter ) ; addUserConverter ( userConverter ) ; } return this ; }
new api method for 1 . 2
25,350
public static final JmsSharedUtils getSharedUtils ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tcInt . isEntryEnabled ( ) ) SibTr . entry ( tcInt , "getSharedUtils" ) ; if ( jsuInstance == null ) { try { Class cls = Class . forName ( "com.ibm.ws.sib.api.jms.impl.JmsSharedUtilsImpl" ) ; jsuInstance = ( JmsSharedUtils ) cls . newInstance ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "JmsInternalsFactory.getSharedUtils" , "getSharedUtils1" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tcInt . isDebugEnabled ( ) ) SibTr . debug ( tcInt , "Unable to instantiate JmsSharedUtilsImpl" , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tcInt . isEntryEnabled ( ) ) SibTr . exit ( tcInt , "getSharedUtils" ) ; jsuInstance = null ; JMSException jmse = new JMSException ( nls . getFormattedMessage ( "UNABLE_TO_CREATE_FACTORY_CWSIA0201" , new Object [ ] { "JmsSharedUtilsImpl" , "sib.api.jmsImpl.jar" } , "!!!Unable to instantiate JmsSharedUtils" ) ) ; jmse . initCause ( e ) ; jmse . setLinkedException ( e ) ; throw jmse ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tcInt . isEntryEnabled ( ) ) SibTr . exit ( tcInt , "getSharedUtils" ) ; return jsuInstance ; }
Used to obtain the singleton instance of the JmsSharedUtils interface .
25,351
final void close ( ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "close : " + ivArchivePuId , this ) ; if ( ivEMFMap != null ) { synchronized ( ivEMFMap ) { ivCreateEMFAllowed = false ; } } synchronized ( ivEMPoolMap ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "shutting down EM pools : " + ivEMPoolMap . size ( ) ) ; for ( JPAEMPool emPool : ivEMPoolMap . values ( ) ) { emPool . shutdown ( ) ; } } unregisterClassFileTransformer ( ivClassLoader ) ; if ( ivEMFactory != null ) { if ( ivEMFactory . isOpen ( ) ) { try { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "closing base EMF" ) ; ivEMFactory . close ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".close" , "934" , this ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Caught unexpected exception on factory.close():" + e ) ; } } if ( ivEMFMap != null ) { for ( EntityManagerFactory emFactory : ivEMFMap . values ( ) ) { if ( emFactory . isOpen ( ) ) { try { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "closing component EMF" ) ; emFactory . close ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".close" , "934" , this ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Caught unexpected exception on factory.close():" + e ) ; } } } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "close : " + ivArchivePuId ) ; }
Close the entity manager factory if it exists and is in open state per JPA Spec section 5 . 8 . 1 .
25,352
private final boolean classNeedsTransform ( String className ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "classNeedsTransform : PUID = " + ivArchivePuId + ", class name = " + className ) ; } boolean rtnVal = true ; for ( Pattern regex : transformExclusionPatterns ) { if ( regex . matcher ( className ) . matches ( ) ) { rtnVal = false ; break ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "classNeedsTransform : " + className + ( rtnVal ? " needs" : " does not need" ) + " transform." ) ; return rtnVal ; }
Determine if the input class needs persistence provider class transformation using a pre - defined regular expression filter .
25,353
public void copyMessageToExceptionDestination ( LocalTransaction tran ) throws SINotPossibleInCurrentConfigurationException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "copyMessageToExceptionDestination" , tran ) ; SIMPMessage msg = getSIMPMessage ( ) ; ExceptionDestinationHandlerImpl edh = null ; if ( _destinationHandler . isLink ( ) ) edh = new ExceptionDestinationHandlerImpl ( _destinationHandler ) ; else { edh = new ExceptionDestinationHandlerImpl ( null , _messageProcessor ) ; edh . setDestination ( _destinationHandler ) ; } edh . sendToExceptionDestination ( msg . getMessage ( ) , null , tran , SIRCConstants . SIRC0036_MESSAGE_ADMINISTRATIVELY_REROUTED_TO_EXCEPTION_DESTINATION , null , new String [ ] { "" + _messageID , _destinationHandler . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "copyMessageToExceptionDestination" ) ; }
Copy the message to the exception destination
25,354
public static final boolean isSafe ( Method meth ) { String fullyQualifiedName = new StringBuilder ( ) . append ( meth . getDeclaringClass ( ) . getName ( ) ) . append ( '.' ) . append ( meth . getName ( ) ) . toString ( ) ; return ! unsafeMethods . contains ( meth . getName ( ) ) && ! unsafeMethods . contains ( fullyQualifiedName ) ; }
Determines whether it is safe based on the method name to invoke the method on behalf of a dynamic proxy for a JDBC wrapper .
25,355
static boolean isSafeReturnType ( Class < ? > type ) { return ! ConnectionPoolDataSource . class . isAssignableFrom ( type ) && ! CommonDataSource . class . isAssignableFrom ( type ) && ! XADataSource . class . isAssignableFrom ( type ) && ! DataSource . class . isAssignableFrom ( type ) && ! PooledConnection . class . isAssignableFrom ( type ) && ! Connection . class . isAssignableFrom ( type ) && ! DatabaseMetaData . class . isAssignableFrom ( type ) && ! Statement . class . isAssignableFrom ( type ) && ! ResultSet . class . isAssignableFrom ( type ) && ! XAResource . class . isAssignableFrom ( type ) ; }
Determine whether it is safe to return the result of an operation performed by the underlying implementation from a dynamic JDBC wrapper .
25,356
public synchronized void reset ( ) { final String methodName = "reset()" ; this . currentDataGB = 1 ; if ( this . currentDependencyIdGB > 0 ) { this . currentDependencyIdGB = 1 ; } if ( this . currentTemplateGB > 0 ) { this . currentTemplateGB = 1 ; } if ( this . diskCacheSizeInGBLimit > 0 ) { this . diskCacheSizeInBytesLimit = ( diskCacheSizeInGBLimit - this . currentDependencyIdGB - this . currentTemplateGB ) * GB_SIZE ; this . diskCacheSizeInBytesHighLimit = ( this . diskCacheSizeInBytesLimit * ( long ) this . highThreshold ) / 100l ; this . diskCacheSizeInBytesLowLimit = ( this . diskCacheSizeInBytesLimit * ( long ) this . lowThreshold ) / 100l ; traceDebug ( methodName , "cacheName=" + this . cacheName + " diskCacheSizeInBytesLimit=" + this . diskCacheSizeInBytesLimit + " diskCacheSizeInBytesHighLimit=" + this . diskCacheSizeInBytesHighLimit + " diskCacheSizeInBytesLowLimit=" + this . diskCacheSizeInBytesLowLimit + " currentDataGB=" + this . currentDataGB + " currentDependencyIdGB=" + this . currentDependencyIdGB + " currentTemplateGB=" + this . currentTemplateGB ) ; } }
Call this method to reset the disk cache size info after disk clear
25,357
public void setChainStartRetryInterval ( Object value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Setting chain start retry interval [" + value + "]" ) ; } try { long num = MetatypeUtils . parseLong ( PROPERTY_CONFIG_ALIAS , PROPERTY_CHAIN_START_RETRY_INTERVAL , value , chainStartRetryInterval ) ; if ( 0L <= num ) { this . chainStartRetryInterval = num ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Value is too low" ) ; } } } catch ( NumberFormatException nfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Value is not a number" ) ; } } }
Setter method for the interval of time between chain restart attempts .
25,358
public void setChainStartRetryAttempts ( Object value ) throws NumberFormatException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Setting chain start retry attempts [" + value + "]" ) ; } try { int num = MetatypeUtils . parseInteger ( PROPERTY_CONFIG_ALIAS , PROPERTY_CHAIN_START_RETRY_ATTEMPTS , value , chainStartRetryAttempts ) ; if ( - 1 <= num ) { this . chainStartRetryAttempts = num ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Value too low" ) ; } } } catch ( NumberFormatException nfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Vaue is not a number" ) ; } } }
Setter method for the number of chain restart attempts .
25,359
public void setDefaultChainQuiesceTimeout ( Object value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Setting default chain quiesce timeout [" + value + "]" ) ; } try { long num = MetatypeUtils . parseLong ( PROPERTY_CONFIG_ALIAS , PROPERTY_CHAIN_QUIESCETIMEOUT , value , chainQuiesceTimeout ) ; if ( 0 < num ) { this . chainQuiesceTimeout = num ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Timeout is too low" ) ; } } } catch ( NumberFormatException nfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Timeout is not a number" ) ; } } }
Set the default chain quiesce timeout property from config .
25,360
public void setMissingConfigWarning ( Object value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Setting missing config warning delay to [" + value + "]" ) ; } try { long num = MetatypeUtils . parseLong ( PROPERTY_CONFIG_ALIAS , PROPERTY_MISSING_CONFIG_WARNING , value , missingConfigWarning ) ; if ( 0L <= num ) { this . missingConfigWarning = num ; } } catch ( NumberFormatException nfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Value is not a number" ) ; } } }
Set the custom property for the delay before warning about missing configuration values .
25,361
public static String stringForMap ( Map < Object , Object > map ) { StringBuilder sbOutput = new StringBuilder ( ) ; if ( map == null ) { sbOutput . append ( "\tNULL" ) ; } else { for ( Entry < Object , Object > entry : map . entrySet ( ) ) { sbOutput . append ( '\t' ) . append ( entry ) . append ( '\n' ) ; } } return sbOutput . toString ( ) ; }
Utility method to extract a string representing the contents of a map . This is currently used by various methods as part of debug tracing .
25,362
public synchronized ChannelFactoryDataImpl findOrCreateChannelFactoryData ( Class < ? > type ) throws ChannelFactoryException { ChannelFactoryDataImpl cfd = channelFactories . get ( type ) ; if ( cfd == null ) { ChannelFactory cf = getChannelFactoryInternal ( type , false ) ; Class < ? > [ ] deviceInf = null ; Class < ? > applicationInf = null ; try { deviceInf = cf . getDeviceInterface ( ) ; } catch ( Exception e ) { } try { applicationInf = cf . getApplicationInterface ( ) ; } catch ( Exception e ) { } cfd = new ChannelFactoryDataImpl ( type , deviceInf , applicationInf ) ; this . channelFactories . put ( type , cfd ) ; } return cfd ; }
is needed outside of this package .
25,363
public synchronized ChannelFactory getChannelFactoryInternal ( Class < ? > type , boolean isPersistent ) throws ChannelFactoryException { if ( type == null ) { throw new InvalidChannelFactoryException ( "ChannelFactory type is null" ) ; } ChannelFactory factory = null ; ChannelFactoryDataImpl cfd = null ; try { cfd = channelFactories . get ( type ) ; if ( cfd != null ) { factory = cfd . getChannelFactory ( ) ; } if ( null == factory ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Create channel factory; " + type ) ; } factory = ( ChannelFactory ) type . newInstance ( ) ; if ( isPersistent ) { initChannelFactory ( type , factory , null ) ; } } } catch ( Exception exp ) { FFDCFilter . processException ( exp , getClass ( ) . getName ( ) + ".getChannelFactoryInternal" , "675" , this , new Object [ ] { cfd } ) ; throw new InvalidChannelFactoryException ( "Can't create instance of channel factory " + type . getName ( ) + " " + exp . getMessage ( ) ) ; } return factory ; }
This method will do the real work of accessing a channel factory . Note multiple methods in this class call into this method some of which are synchronized . According to the input parameters the factory that is returned may or may not be persisted in the framework . In some cases like simple channel adds there is no need for the factory in the framework an instantiation is only needed to verify that the factory is valid . Other times like during chain initialization persistence is necessary .
25,364
private ChannelData addChannelInternal ( String channelName , Class < ? > factoryType , Map < Object , Object > inputPropertyBag , int weight ) throws ChannelException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "addChannelInternal: channelName=" + channelName + ", factoryType=" + factoryType + ", weight=" + weight ) ; } if ( weight < 0 ) { throw new InvalidWeightException ( "Invalid weight for channel, " + weight ) ; } if ( null == channelName ) { throw new InvalidChannelNameException ( "Input channel name is null" ) ; } ChannelData channelData = channelDataMap . get ( channelName ) ; if ( null != channelData ) { throw new InvalidChannelNameException ( "Channel already exists: " + channelName ) ; } getChannelFactoryInternal ( factoryType , false ) ; Map < Object , Object > propertyBag = inputPropertyBag ; if ( null == propertyBag ) { propertyBag = new HashMap < Object , Object > ( ) ; } channelData = createChannelData ( channelName , factoryType , propertyBag , weight ) ; this . channelDataMap . put ( channelName , channelData ) ; return channelData ; }
This method does the work of adding a channel data object to the framework . It is called internally by both the addInbound and addOutbound channel methods .
25,365
private void updateRunningChannels ( ChannelDataImpl channelData ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "updateRunningChannels" ) ; } Channel channel = null ; ChannelContainer channelContainer = null ; Iterator < ChildChannelDataImpl > children = channelData . children ( ) ; while ( children . hasNext ( ) ) { channelContainer = channelRunningMap . get ( children . next ( ) . getName ( ) ) ; channel = channelContainer . getChannel ( ) ; channel . update ( channelContainer . getChannelData ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "updateRunningChannels" ) ; } }
Update all running channels using the input channel data .
25,366
private boolean initChannelInChain ( Channel channel , Chain chain ) throws ChannelException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "initChannelInChain" ) ; } String channelName = channel . getName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "channelName=" + channelName + " chainName=" + chain . getName ( ) ) ; } boolean channelInitialized = false ; ChannelContainer channelContainer = channelRunningMap . get ( channelName ) ; if ( null == channelContainer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Channel not found in runtime so build it" ) ; } ChannelData channelsData [ ] = chain . getChannelsData ( ) ; int index = 0 ; for ( ; index < channelsData . length ; index ++ ) { if ( channelsData [ index ] . getName ( ) . equals ( channel . getName ( ) ) ) { break ; } } if ( index == channelsData . length ) { ChannelException e = new ChannelException ( "Channel providing incorrect name; " + channel . getName ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Channel provided the wrong name, probably the external name instead of the internal one; " + channel . getName ( ) ) ; } throw e ; } try { channel . init ( ) ; } catch ( ChannelException ce ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Channel " + channel + " threw ChannelException " + ce . getMessage ( ) ) ; throw ce ; } catch ( Throwable e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".initChannelInChain" , "1168" , this , new Object [ ] { channel } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Channel " + channel + " threw non-ChannelException " + e . getMessage ( ) ) ; throw new ChannelException ( e ) ; } channelInitialized = true ; channelContainer = new ChannelContainer ( channel , ( ChildChannelDataImpl ) channelsData [ index ] ) ; this . channelRunningMap . put ( channelName , channelContainer ) ; } channelContainer . addChainReference ( chain ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "initChannelInChain" ) ; } return channelInitialized ; }
This method won t actually call the init method of the channel implemenation unless the channel is uninitialized . If the channel doesn t exist in the runtime yet it will be put in here . The channel in the runtime will then be updated with a reference to the input chain . This method is invoked from the chain implementation .
25,367
private boolean startChannelInChain ( Channel targetChannel , Chain chain ) throws ChannelException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "startChannelInChain" ) ; } String channelName = targetChannel . getName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "channelName=" + channelName + " chainName=" + chain . getName ( ) ) ; } boolean channelStarted = false ; ChannelContainer channelContainer = channelRunningMap . get ( channelName ) ; RuntimeState channelState = channelContainer . getState ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found channel, state: " + channelState . ordinal ) ; } Channel channel = channelContainer . getChannel ( ) ; if ( ( RuntimeState . INITIALIZED == channelState ) || ( RuntimeState . QUIESCED == channelState ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Starting channel" ) ; } try { channel . start ( ) ; } catch ( ChannelException ce ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Channel " + channel + " threw ChannelException " + ce . getMessage ( ) ) ; } throw ce ; } catch ( Throwable e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".startChannelInChain" , "1228" , this , new Object [ ] { channel } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Channel " + channel + " threw non-ChannelException " + e . getMessage ( ) ) ; } throw new ChannelException ( e ) ; } channelStarted = true ; channelContainer . setState ( RuntimeState . STARTED ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Skip channel start, invalid former state: " + channelState . ordinal ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "startChannelInChain" ) ; } return channelStarted ; }
Start the input channel . While it isn t needed yet the chain from which the start is coming from is in the parameter list . This method will only be called from the chain implementation . Regardless of what chains are referenced by the channel if the state is initialized or quiesced then the channel will be started .
25,368
private boolean disableChannelInChain ( Channel targetChannel , Chain chain ) throws ChannelException , ChainException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "disableChannelInChain" ) ; } String channelName = targetChannel . getName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "channelName=" + channelName + " chainName=" + chain . getName ( ) ) ; } ChannelContainer channelContainer = channelRunningMap . get ( channelName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found channel, state: " + channelContainer . getState ( ) . ordinal ) ; } Channel channel = channelContainer . getChannel ( ) ; RuntimeState chainState = null ; boolean stillInUse = false ; for ( Chain channelChain : channelContainer . getChainMap ( ) . values ( ) ) { chainState = channelChain . getState ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found chain reference: " + channelChain . getName ( ) + ", state: " + chainState . ordinal ) ; } if ( channelChain . getName ( ) . equals ( chain . getName ( ) ) ) { continue ; } else if ( ( RuntimeState . STARTED == chainState ) || ( RuntimeState . QUIESCED == chainState ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found chain that is not ready to stop, " + channelChain . getName ( ) ) ; } stillInUse = true ; break ; } } if ( ! stillInUse ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Disabling channel, " + channelName ) ; } ( ( InboundChain ) chain ) . disableChannel ( channel ) ; } else if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Skip channel stop, in use by other chain(s)" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "disableChannelInChain" ) ; } return ! stillInUse ; }
This method is done in preparation for stopping a channel . It pull s its discriminator from the device side channel s discrimination process in the chain .
25,369
private synchronized void removeChainInternal ( ChainData chaindata ) { String chainName = chaindata . getName ( ) ; ChainData [ ] chains = null ; for ( String groupName : chainGroups . keySet ( ) ) { chains = chainGroups . get ( groupName ) . getChains ( ) ; int j = 0 ; for ( ; j < chains . length ; j ++ ) { if ( chainName . equals ( chains [ j ] . getName ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Removing chain from chain group, " + groupName ) ; } break ; } } if ( j < chains . length ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Updating chain group with new chain config list, " + groupName ) ; } ChainData [ ] newChains = new ChainData [ chains . length - 1 ] ; int k = 0 ; for ( ; k < j ; k ++ ) { newChains [ k ] = chains [ k ] ; } for ( ++ j ; j < chains . length ; k ++ , j ++ ) { newChains [ k ] = chains [ j ] ; } chainGroups . put ( groupName , createChainGroupData ( groupName , newChains ) ) ; } } chainDataMap . remove ( chainName ) ; }
Remove the chain from the framework and disconnect it from any groups that contain it .
25,370
private void cleanChildRefsInParent ( ChannelData channelDataArray [ ] , boolean childrenNew [ ] ) { ChildChannelDataImpl child = null ; for ( int i = 0 ; i < channelDataArray . length ; i ++ ) { if ( childrenNew [ i ] == true ) { child = ( ChildChannelDataImpl ) channelDataArray [ i ] ; child . getParent ( ) . removeChild ( child ) ; } } }
This is a helper function . The same logic needs to be done in multiple places so this method was written to break it out . It will be called in times when an exception occurred during the construction of a chain . It cleans up some of the objects that were lined up ahead of time .
25,371
public synchronized void destroyChainInternal ( Chain chain ) throws ChannelException , ChainException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "destroyChainInternal: " + chain . getName ( ) ) ; } if ( RuntimeState . INITIALIZED . equals ( chain . getState ( ) ) ) { Channel [ ] chainChannels = chain . getChannels ( ) ; ChannelData [ ] channelData = chain . getChannelsData ( ) ; for ( int i = 0 ; i < chainChannels . length ; i ++ ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Destroy channel in chain: " + chainChannels [ i ] . getName ( ) ) ; } try { destroyChannelInChain ( chainChannels [ i ] , chain , channelData [ i ] ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".destroyChainInternal" , "2865" , this , new Object [ ] { chain , channelData [ i ] } ) ; Tr . error ( tc , "chain.destroy.error" , new Object [ ] { chain . getName ( ) , e . toString ( ) } ) ; } } chain . destroy ( ) ; this . chainRunningMap . remove ( chain . getName ( ) ) ; if ( FlowType . OUTBOUND . equals ( chain . getChainData ( ) . getType ( ) ) ) { this . outboundVCFactories . remove ( chain . getName ( ) ) ; } } else { InvalidRuntimeStateException e = new InvalidRuntimeStateException ( "Unable to destroy chain: " + chain . getName ( ) + ", state: " + chain . getState ( ) . ordinal ) ; throw e ; } }
This method destroys both inbound and outbound chains ..
25,372
protected void retryChainStart ( ChainData chainData , Exception e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".retryChainStart" , "3470" , this , new Object [ ] { chainData } ) ; Tr . error ( tc , "chain.retrystart.error" , new Object [ ] { chainData . getName ( ) , Integer . valueOf ( 1 ) } ) ; ( ( ChainDataImpl ) chainData ) . chainStartFailed ( 1 , 0 ) ; }
This method is called when an initial attempt to start a chain has failed due to a particular type of exception RetryableChannelException indicating that a retry may enable the chain to be started . This could result from something like a device side channel having bind problems since a socket from a previous chain stop is still wrapping up .
25,373
public synchronized Chain getRunningChain ( String chainName ) { Chain chain = null ; if ( null != chainName ) { chain = this . chainRunningMap . get ( chainName ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getRunningChain: " + chainName + " found=" + ( null != chain ) ) ; } return chain ; }
Fetch the input chain from the runtime .
25,374
public synchronized Channel getRunningChannel ( String inputChannelName , Chain chain ) { if ( inputChannelName == null || chain == null ) { return null ; } Channel channel = null ; if ( null != this . chainRunningMap . get ( chain . getName ( ) ) ) { ChannelData [ ] channels = chain . getChannelsData ( ) ; for ( int index = 0 ; index < channels . length ; index ++ ) { if ( channels [ index ] . getExternalName ( ) . equals ( inputChannelName ) ) { channel = chain . getChannels ( ) [ index ] ; break ; } } } return channel ; }
Fetch the input channel from the runtime .
25,375
public synchronized RuntimeState getChannelState ( String channelName , Chain chain ) { RuntimeState state = null ; Channel channel = getRunningChannel ( channelName , chain ) ; if ( channel != null ) { ChannelContainer channelContainer = this . channelRunningMap . get ( channel . getName ( ) ) ; if ( null != channelContainer ) { state = channelContainer . getState ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getChannelState: " + channelName + "=" + state ) ; } return state ; }
Return the state of the input runtime channel .
25,376
private synchronized void setChannelState ( String channelName , RuntimeState state ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setChannelState channelName=" + channelName + ", state=" + state . ordinal ) ; } if ( null != channelName ) { ChannelContainer channelContainer = this . channelRunningMap . get ( channelName ) ; if ( null != channelContainer ) { channelContainer . setState ( state ) ; } } }
Set the channel state of a given channel .
25,377
public synchronized boolean doesChannelReferenceChain ( String channelName , String chainName ) { boolean foundRef = false ; Chain chain = this . chainRunningMap . get ( chainName ) ; if ( chain != null ) { ChannelData channelsData [ ] = chain . getChannelsData ( ) ; ChildChannelDataImpl childChannelData = null ; for ( int i = 0 ; i < channelsData . length ; i ++ ) { childChannelData = ( ChildChannelDataImpl ) channelsData [ i ] ; if ( childChannelData . getExternalName ( ) . equals ( channelName ) ) { foundRef = true ; break ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "doesChannelReferenceChain: channel=" + channelName + ", chain=" + chainName + ", rc=" + foundRef ) ; } return foundRef ; }
Determine if a channel references a chain in the runtime config .
25,378
public synchronized int getNumStartedChainsUsingChannel ( String channelName ) { int numStartedChains = 0 ; ChannelContainer channelContainer = this . channelRunningMap . get ( channelName ) ; if ( null != channelContainer ) { for ( Chain chain : channelContainer . getChainMap ( ) . values ( ) ) { if ( chain . getState ( ) == RuntimeState . STARTED ) { numStartedChains ++ ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getNumStartedChainsUsingChannel: " + channelName + "=" + numStartedChains ) ; } return numStartedChains ; }
Get the number of chains that are currently using this channel in the runtime which are in the STARTED state .
25,379
protected ChannelData createChannelData ( String name , Class < ? > factoryClass , Map < Object , Object > properties , int weight ) { return new ChannelDataImpl ( name , factoryClass , properties , weight , this ) ; }
Create a new ChannelData Object .
25,380
protected ChainData createChainData ( String name , FlowType type , ChannelData [ ] channels , Map < Object , Object > properties ) throws IncoherentChainException { return new ChainDataImpl ( name , type , channels , properties ) ; }
Create a new ChainData object .
25,381
public void registerFactories ( ChannelFactoryProvider provider ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Register factory provider; " + provider . getClass ( ) . getName ( ) ) ; } synchronized ( this . factories ) { for ( Entry < String , Class < ? extends ChannelFactory > > entry : provider . getTypes ( ) . entrySet ( ) ) { this . providers . put ( entry . getKey ( ) , provider ) ; Class < ? extends ChannelFactory > newFactory = entry . getValue ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Class < ? extends ChannelFactory > prevFactory = this . factories . get ( entry . getKey ( ) ) ; if ( null != prevFactory && newFactory != prevFactory ) { Tr . event ( tc , "WARNING: overlaying existing factory: " + prevFactory ) ; } } this . factories . put ( entry . getKey ( ) , newFactory ) ; } } ChannelUtils . loadConfig ( null ) ; }
Set a factory provider .
25,382
public void deregisterFactories ( ChannelFactoryProvider provider ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Removing factory provider; " + provider . getClass ( ) . getName ( ) ) ; } for ( Entry < String , Class < ? extends ChannelFactory > > entry : provider . getTypes ( ) . entrySet ( ) ) { this . providers . remove ( entry . getKey ( ) ) ; deregisterFactory ( entry . getKey ( ) ) ; } this . activatedProviders . remove ( provider ) ; }
Remove a factory provider .
25,383
public List < String > getVhost ( String address , String port ) { if ( null == address || null == port ) { return null ; } int portnum = Integer . parseInt ( port ) ; List < EndPointInfo > eps = EndPointMgrImpl . getRef ( ) . getEndPoints ( address , portnum ) ; List < String > rc = new ArrayList < String > ( eps . size ( ) ) ; for ( EndPointInfo ep : eps ) { rc . add ( ep . getName ( ) ) ; } return rc ; }
Find the appropriate virtual host list for the provided address and port target .
25,384
public ChainData createOutboundChain ( CFEndPoint endpoint ) throws ChannelFrameworkException { List < OutboundChannelDefinition > defs = endpoint . getOutboundChannelDefs ( ) ; String namelist [ ] = new String [ defs . size ( ) ] ; int i = 0 ; for ( OutboundChannelDefinition def : defs ) { namelist [ i ] = "channel_" + channelNameCounter . getAndIncrement ( ) ; addChannel ( namelist [ i ] , def . getOutboundFactory ( ) , def . getOutboundChannelProperties ( ) ) ; i ++ ; } return addChain ( "chain_" + chainNameCounter . getAndIncrement ( ) , FlowType . OUTBOUND , namelist ) ; }
Create a new outbound chain based on the provided endpoint definition .
25,385
private boolean propertiesIncluded ( Map < Object , Object > inputMap , Map < Object , Object > existingMap ) { if ( inputMap == null ) { return true ; } else if ( existingMap == null || inputMap . size ( ) > existingMap . size ( ) ) { return false ; } Object existingValue ; for ( Entry < Object , Object > entry : inputMap . entrySet ( ) ) { existingValue = existingMap . get ( entry . getKey ( ) ) ; if ( existingValue == null || ! existingValue . equals ( entry . getValue ( ) ) ) { return false ; } } return true ; }
This method returns whether all the properties in the first Map are in the second Map .
25,386
public void prepareEndPoint ( CFEndPointImpl endpoint ) throws ChannelFrameworkException { if ( null == endpoint . getOutboundChainData ( ) ) { VirtualConnectionFactory vcf = getOutboundVCFactory ( endpoint . getOutboundChannelDefs ( ) ) ; endpoint . setOutboundVCFactory ( vcf ) ; endpoint . setOutboundChainData ( getChain ( vcf . getName ( ) ) ) ; } }
Prepare the factory and the chain for the provided endpoint .
25,387
public int updateExpirationTime ( Object id , long oldExpirationTime , int size , long newExpirationTime , long newValidatorExpirationTime ) { final String methodName = "updateExpirationTime()" ; int returnCode = NO_EXCEPTION ; Exception diskException = null ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , methodName , "cacheName=" + this . cacheName + " id=" + id + " newValidatorExpirationTime=" + newValidatorExpirationTime ) ; try { rwLock . writeLock ( ) . lock ( ) ; object_cache . updateExpirationInHeader ( id , newExpirationTime , newValidatorExpirationTime ) ; } catch ( FileManagerException ex ) { this . diskCacheException = ex ; diskException = ex ; returnCode = DISK_EXCEPTION ; } catch ( HashtableOnDiskException ex ) { this . diskCacheException = ex ; diskException = ex ; returnCode = DISK_EXCEPTION ; } catch ( IOException ex ) { diskException = ex ; if ( ex . getMessage ( ) . equals ( DISK_CACHE_IN_GB_OVER_LIMIT_MSG ) ) { returnCode = DISK_SIZE_OVER_LIMIT_EXCEPTION ; } else { this . diskCacheException = ex ; returnCode = DISK_EXCEPTION ; } } catch ( Exception ex ) { returnCode = OTHER_EXCEPTION ; diskException = ex ; } finally { rwLock . writeLock ( ) . unlock ( ) ; if ( returnCode != NO_EXCEPTION && returnCode != NO_EXCEPTION_ENTRY_OVERWRITTEN ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , methodName , "cacheName=" + this . cacheName + "\n Exception: " + ExceptionUtility . getStackTrace ( diskException ) ) ; } if ( returnCode == DISK_EXCEPTION || returnCode == OTHER_EXCEPTION ) { com . ibm . ws . ffdc . FFDCFilter . processException ( diskException , "com.ibm.ws.cache.HTODDynacache.writeCacheEntry" , "1239" , this ) ; } } return returnCode ; }
Since the real expiration time does not change the GC will be updated .
25,388
public boolean isCacheIdInAuxDepIdTable ( Object id ) { if ( delayOffload ) { if ( ! this . disableDependencyId ) { return this . auxDataDependencyTable . containsCacheId ( id ) ; } else { return false ; } } else { return false ; } }
Return a boolean to indicate whether the specified cache id exists in the aux dependency table
25,389
public Throwable getOriginalException ( ) throws ExceptionInstantiationException { Throwable prevEx = null ; if ( previousExceptionInfo != null ) { prevEx = previousExceptionInfo . getOriginalException ( ) ; if ( prevEx == null ) { prevEx = getPreviousException ( ) ; } } return prevEx ; }
Get the original exception in a possible chain of exceptions . If no previous exceptions have been chained null will be returned .
25,390
public Throwable getPreviousException ( ) throws ExceptionInstantiationException { Throwable ex = null ; if ( previousExceptionObject != null ) return previousExceptionObject ; if ( previousException != null ) { try { final ByteArrayInputStream bais = new ByteArrayInputStream ( previousException ) ; ObjectInputStream ois = ( ObjectInputStream ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { public Object run ( ) throws IOException { return new ObjectInputStream ( bais ) ; } } ) ; ex = ( Throwable ) ois . readObject ( ) ; } catch ( PrivilegedActionException pae ) { throw new ExceptionInstantiationException ( pae . getException ( ) ) ; } catch ( Exception e ) { throw new ExceptionInstantiationException ( e ) ; } } return ex ; }
Retrieves the previous exception
25,391
private void setExceptionInfo ( DistributedExceptionEnabled e ) { if ( e != null ) { setClassName ( e . getClass ( ) . getName ( ) ) ; } currentException = e ; }
Set the exceptionInfo attribute
25,392
public void setLocalizationInfo ( String resourceBundleName , String resourceKey , Object [ ] formatArguments ) { this . resourceBundleName = resourceBundleName ; this . resourceKey = resourceKey ; this . formatArguments = formatArguments ; }
FOR WEBSPHERE INTERNAL USE ONLY Set the localization information .
25,393
private void serializePreviousException ( ) { try { final ByteArrayOutputStream bas = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = ( ObjectOutputStream ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { public Object run ( ) throws IOException { return new ObjectOutputStream ( bas ) ; } } ) ; oos . writeObject ( previousExceptionObject ) ; previousException = bas . toByteArray ( ) ; } catch ( PrivilegedActionException pae ) { pae . getException ( ) . printStackTrace ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
Set the previous exception attribute . The exception will be converted to a byte array so that an unmarshall exception will not be thrown if the exception doesn t exist on the client or on an intermediate server .
25,394
private void setPreviousExceptionInfo ( Throwable previousException ) { if ( previousException instanceof com . ibm . websphere . exception . DistributedExceptionEnabled ) { previousExceptionInfo = ( ( DistributedExceptionEnabled ) previousException ) . getExceptionInfo ( ) ; } else { previousExceptionInfo = new DistributedExceptionInfo ( previousException ) ; } }
Set the previous exception info object .
25,395
private void setStackTrace ( Throwable e ) { StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; e . printStackTrace ( pw ) ; stackTrace = sw . toString ( ) ; setLineSeparator ( getLineSeparatorProperty ( ) ) ; }
Set the stack trace
25,396
private void processOCDAttributes ( String currDefId , AttributeDefinition [ ] attrDefs , Map < String , AttributeDefinition > requiredAttributes , Map < String , AttributeDefinition > optionalAttributes , Map < String , ExtendedAttributeDefinition > attributeMap , boolean required ) { Map < String , AttributeDefinition > currentAttributes ; Map < String , AttributeDefinition > alternateAttributes ; if ( required ) { currentAttributes = requiredAttributes ; alternateAttributes = optionalAttributes ; } else { currentAttributes = optionalAttributes ; alternateAttributes = requiredAttributes ; } for ( AttributeDefinition attrDef : attrDefs ) { String attrId = attrDef . getID ( ) ; ExtendedAttributeDefinition extendedAttr = attributeMap . get ( attrId ) ; String rename ; if ( extendedAttr != null ) { if ( extendedAttr . isFinal ( ) ) { currentAttributes . remove ( attrId ) ; alternateAttributes . remove ( attrId ) ; } else if ( ( rename = extendedAttr . getRename ( ) ) != null ) { boolean alternativeAttr = false ; AttributeDefinition attrToRename = currentAttributes . get ( rename ) ; if ( attrToRename == null ) { attrToRename = alternateAttributes . get ( rename ) ; alternativeAttr = true ; } if ( attrToRename == null ) { error ( "schemagen.rename.attribute.missing" , new Object [ ] { currDefId , rename , extendedAttr . getID ( ) } ) ; } else { currentAttributes . put ( attrId , renameAttribute ( currDefId , attributeMap . get ( rename ) , extendedAttr , required ) ) ; if ( alternativeAttr ) alternateAttributes . remove ( rename ) ; else currentAttributes . remove ( rename ) ; } } else { currentAttributes . put ( attrId , attrDef ) ; } } } }
This method takes a set of Attribute Definitions and processes them against an existing Map of attributes .
25,397
public static List < String > generatePropertyNameList ( String propertyName , List < String > suffixValues ) { List < String > propertyNames = new ArrayList < > ( ) ; int suffixes = suffixValues . size ( ) ; if ( suffixes > 0 ) { int counter = ( ( int ) Math . pow ( 2 , suffixes ) ) - 1 ; while ( counter > 0 ) { StringBuilder builder = new StringBuilder ( propertyName ) ; for ( int i = 0 ; i < suffixes ; i ++ ) { int shift = suffixes - ( i + 1 ) ; int mask = ( 1 << shift ) ; if ( ( counter & mask ) == mask ) { builder . append ( "." ) ; builder . append ( suffixValues . get ( i ) ) ; } } String generatedPropertyName = builder . toString ( ) ; propertyNames . add ( generatedPropertyName ) ; counter -- ; } } propertyNames . add ( propertyName ) ; return propertyNames ; }
This method uses a binary count down to append suffixes to a base propertyName .
25,398
protected synchronized void unsetKeyStore ( KeystoreConfig config ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Removing keystore: " + config . getId ( ) ) ; } keystoreIdMap . remove ( config . getId ( ) ) ; keystorePidMap . remove ( config . getPid ( ) ) ; KeyStoreManager . getInstance ( ) . clearKeyStoreFromMap ( config . getId ( ) ) ; KeyStoreManager . getInstance ( ) . clearKeyStoreFromMap ( config . getPid ( ) ) ; for ( Iterator < Map . Entry < String , RepertoireConfigService > > it = repertoireMap . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { RepertoireConfigService rep = it . next ( ) . getValue ( ) ; if ( rep . getKeyStore ( ) == config || rep . getTrustStore ( ) == config ) { it . remove ( ) ; repertoirePropertiesMap . remove ( rep . getAlias ( ) ) ; repertoirePIDMap . remove ( rep . getPID ( ) ) ; } } }
Method will be called for each KeyStoreConfigService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
25,399
protected synchronized void unsetRepertoire ( RepertoireConfigService config ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Removing repertoire: " + config . getAlias ( ) ) ; } repertoireMap . remove ( config . getAlias ( ) ) ; repertoirePIDMap . remove ( config . getPID ( ) ) ; repertoirePropertiesMap . remove ( config . getAlias ( ) ) ; processConfig ( repertoirePropertiesMap . remove ( config . getAlias ( ) ) != null ) ; }
Method will be called for each RepertoireConfigService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .