idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
158,800
@ SuppressWarnings ( "unchecked" ) public < EngineComponent > EngineComponent [ ] getEngineComponents ( Class < EngineComponent > clazz ) { String thisMethodName = "getEngineComponents" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , clazz ) ; } List < EngineComponent > foundComponents = new ArrayList < EngineComponent > ( ) ; // No need to synchronize on jmeComponents to prevent concurrent // modification from dynamic config and runtime callbacks, because // jmeComponents is now a CopyOnWriteArrayList. Iterator < ComponentList > vIter = jmeComponents . iterator ( ) ; while ( vIter . hasNext ( ) ) { JsEngineComponent ec = vIter . next ( ) . getRef ( ) ; if ( clazz . isInstance ( ec ) ) { foundComponents . add ( ( EngineComponent ) ec ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , foundComponents ) ; } // this code is required to get an array of the EngineComponent type. return foundComponents . toArray ( ( EngineComponent [ ] ) Array . newInstance ( clazz , 0 ) ) ; }
The purpose of this method is to get an engine component that can be cast using the specified class . The EngineComponent is not a class name but represents the classes real type . It is not possible to create an Array of a generic type without using reflection .
300
51
158,801
public final JsMEConfig getMeConfig ( ) { String thisMethodName = "getMeConfig" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; SibTr . exit ( tc , thisMethodName , _me ) ; } return _me ; }
Returns a reference to this messaging engine s configuration .
84
10
158,802
@ Deprecated public JsEngineComponent getMessageProcessor ( String name ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getMessageProcessor" , this ) ; SibTr . exit ( tc , "getMessageProcessor" , _messageProcessor ) ; } return _messageProcessor ; }
Gets the instance of the MP associated with this ME
86
11
158,803
private void resolveExceptionDestination ( BaseDestinationDefinition dd ) { String thisMethodName = "resolveExceptionDestination" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , dd . getName ( ) ) ; } // If variable substitution string detected, then override ED name if ( dd . isLocal ( ) ) { String ed = ( ( DestinationDefinition ) dd ) . getExceptionDestination ( ) ; if ( ( ed != null ) && ( ed . equals ( JsConstants . DEFAULT_EXCEPTION_DESTINATION ) ) ) { ( ( DestinationDefinition ) dd ) . setExceptionDestination ( JsConstants . EXCEPTION_DESTINATION_PREFIX + this . getName ( ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } }
Resolve if necessary a variable Exception Destination name in the specified DD to it s runtime value .
220
19
158,804
BaseDestinationDefinition getSIBDestinationByUuid ( String bus , String key , boolean newCache ) throws SIBExceptionDestinationNotFound , SIBExceptionBase { String thisMethodName = "getSIBDestinationByUuid" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , new Object [ ] { bus , key , new Boolean ( newCache ) } ) ; } BaseDestinationDefinition bdd = null ; if ( oldDestCache == null || newCache ) { bdd = ( BaseDestinationDefinition ) _bus . getDestinationCache ( ) . getSIBDestinationByUuid ( bus , key ) . clone ( ) ; } else { bdd = ( BaseDestinationDefinition ) oldDestCache . getSIBDestinationByUuid ( bus , key ) . clone ( ) ; } // Resolve Exception Destination if necessary resolveExceptionDestination ( bdd ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , bdd ) ; } return bdd ; }
Accessor method to return a destination definition .
259
9
158,805
public final String getState ( ) { String thisMethodName = "getState" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; SibTr . exit ( tc , thisMethodName , states [ _state ] ) ; } return states [ _state ] ; }
Get the state of this ME
83
6
158,806
public final boolean isStarted ( ) { String thisMethodName = "isStarted" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; } boolean retVal = ( _state == STATE_STARTED ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , Boolean . toString ( retVal ) ) ; } return retVal ; }
Returns an indication of whether this ME is started or not
123
11
158,807
final boolean addLocalizationPoint ( LWMConfig lp , DestinationDefinition dd ) { String thisMethodName = "addLocalizationPoint" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , lp ) ; } boolean success = _localizer . addLocalizationPoint ( lp , dd ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , Boolean . valueOf ( success ) ) ; } return success ; }
Pass the request to add a new localization point onto the localizer object .
135
15
158,808
final void alterLocalizationPoint ( BaseDestination dest , LWMConfig lp ) { String thisMethodName = "alterLocalizationPoint" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , lp ) ; } try { _localizer . alterLocalizationPoint ( dest , lp ) ; } catch ( Exception e ) { SibTr . exception ( tc , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } }
Pass the request to alter a localization point onto the localizer object .
143
14
158,809
final void deleteLocalizationPoint ( JsBus bus , LWMConfig dest ) { String thisMethodName = "deleteLocalizationPoint" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , dest ) ; } try { _localizer . deleteLocalizationPoint ( bus , dest ) ; } catch ( SIBExceptionBase ex ) { SibTr . exception ( tc , ex ) ; } catch ( SIException e ) { SibTr . exception ( tc , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } }
Pass the request to delete a localization point onto the localizer object .
162
14
158,810
final void setLPConfigObjects ( List config ) { String thisMethodName = "setLPConfigObjects" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , "Number of LPs =" + config . size ( ) ) ; } _lpConfig . clear ( ) ; _lpConfig . addAll ( config ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } }
Update the cache of localization point config objects . This method is used by dynamic config to refresh the cache .
130
21
158,811
public boolean isEventNotificationPropertySet ( ) { String thisMethodName = "isEventNotificationPropertySet" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; } boolean enabled = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , Boolean . toString ( enabled ) ) ; } return enabled ; }
Test whether the Event Notification property has been set . This method resolves the setting for the specific ME and the setting for the bus .
116
26
158,812
public JsMainImpl getMainImpl ( ) { String thisMethodName = "getMainImpl" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; SibTr . exit ( tc , thisMethodName , _mainImpl ) ; } return _mainImpl ; }
Returns a reference to the repository service . This is used in conjunction with ConfigRoot to access EMF configuration documents .
83
23
158,813
protected final JsEngineComponent loadClass ( String className , int stopSeq , boolean reportError ) { String thisMethodName = "loadClass" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , new Object [ ] { className , Integer . toString ( stopSeq ) , Boolean . toString ( reportError ) } ) ; } Class myClass = null ; JsEngineComponent retValue = null ; int _seq = stopSeq ; if ( _seq < 0 || _seq > NUM_STOP_PHASES ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "loadClass: stopSeq is out of bounds " + stopSeq ) ; } else { try { myClass = Class . forName ( className ) ; retValue = ( JsEngineComponent ) myClass . newInstance ( ) ; ComponentList compList = new ComponentList ( className , retValue ) ; // No need to synchronize on jmeComponents to prevent concurrent // modification from dynamic config and runtime callbacks, because // jmeComponents is now a CopyOnWriteArrayList. jmeComponents . add ( compList ) ; stopSequence [ _seq ] . addElement ( compList ) ; } catch ( ClassNotFoundException e ) { // No FFDC code needed if ( reportError == true ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , CLASS_NAME + ".loadClass" , "3" , this ) ; SibTr . error ( tc , "CLASS_LOAD_FAILURE_SIAS0013" , className ) ; SibTr . exception ( tc , e ) ; } } catch ( InstantiationException e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , CLASS_NAME + ".loadClass" , "1" , this ) ; if ( reportError == true ) { SibTr . error ( tc , "CLASS_LOAD_FAILURE_SIAS0013" , className ) ; SibTr . exception ( tc , e ) ; } } catch ( Throwable e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , CLASS_NAME + ".loadClass" , "2" , this ) ; if ( reportError == true ) { SibTr . error ( tc , "CLASS_LOAD_FAILURE_SIAS0013" , className ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { if ( retValue == null ) SibTr . debug ( tc , "loadClass: failed" ) ; else SibTr . debug ( tc , "loadClass: OK" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , retValue ) ; } return retValue ; }
Load the named class and add it to the list of engine components .
685
14
158,814
public void addMember ( JSConsumerKey key ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addMember" , key ) ; super . addMember ( key ) ; // superclass method does most of the work synchronized ( criteriaLock ) { if ( allCriterias != null ) { SelectionCriteria [ ] newCriterias = new SelectionCriteria [ allCriterias . length + 1 ] ; System . arraycopy ( allCriterias , 0 , newCriterias , 0 , allCriterias . length ) ; allCriterias = newCriterias ; } else { allCriterias = new SelectionCriteria [ 1 ] ; } allCriterias [ allCriterias . length - 1 ] = ( ( RemoteQPConsumerKey ) key ) . getSelectionCriteria ( ) [ 0 ] ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addMember" ) ; }
overriding superclass method
243
6
158,815
public static void setCustomPropertyVariables ( ) { UPGRADE_READ_TIMEOUT = Integer . valueOf ( customProps . getProperty ( "upgradereadtimeout" , Integer . toString ( TCPReadRequestContext . NO_TIMEOUT ) ) ) . intValue ( ) ; UPGRADE_WRITE_TIMEOUT = Integer . valueOf ( customProps . getProperty ( "upgradewritetimeout" , Integer . toString ( TCPReadRequestContext . NO_TIMEOUT ) ) ) . intValue ( ) ; }
The timeout to use when the request has been upgraded and a write is happening
122
15
158,816
public void registerInvalidations ( String cacheName , Iterator invalidations ) { InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; if ( invalidationTableList != null ) { try { invalidationTableList . readWriteLock . writeLock ( ) . lock ( ) ; while ( invalidations . hasNext ( ) ) { try { Object invalidation = invalidations . next ( ) ; if ( invalidation instanceof InvalidateByIdEvent ) { InvalidateByIdEvent idEvent = ( InvalidateByIdEvent ) invalidation ; Object id = idEvent . getId ( ) ; InvalidateByIdEvent oldIdEvent = ( InvalidateByIdEvent ) invalidationTableList . presentIdSet . get ( id ) ; long timeStamp = idEvent . getTimeStamp ( ) ; if ( ( oldIdEvent != null ) && ( oldIdEvent . getTimeStamp ( ) >= timeStamp ) ) { continue ; } invalidationTableList . presentIdSet . put ( id , idEvent ) ; continue ; } InvalidateByTemplateEvent templateEvent = ( InvalidateByTemplateEvent ) invalidation ; String template = templateEvent . getTemplate ( ) ; InvalidateByTemplateEvent oldTemplateEvent = ( InvalidateByTemplateEvent ) invalidationTableList . presentTemplateSet . get ( template ) ; long timeStamp = templateEvent . getTimeStamp ( ) ; if ( ( oldTemplateEvent != null ) && ( oldTemplateEvent . getTimeStamp ( ) >= timeStamp ) ) { continue ; } invalidationTableList . presentTemplateSet . put ( template , templateEvent ) ; } catch ( Exception ex ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ex , "com.ibm.ws.cache.InvalidationAuditDaemon.registerInvalidations" , "126" , this ) ; } } } finally { invalidationTableList . readWriteLock . writeLock ( ) . unlock ( ) ; } } }
This adds id and template invalidations .
427
8
158,817
public CacheEntry filterEntry ( String cacheName , CacheEntry cacheEntry ) { InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; try { invalidationTableList . readWriteLock . readLock ( ) . lock ( ) ; return internalFilterEntry ( cacheName , invalidationTableList , cacheEntry ) ; } finally { invalidationTableList . readWriteLock . readLock ( ) . unlock ( ) ; } }
This ensures the specified CacheEntrys have not been invalidated .
95
13
158,818
public ArrayList filterEntryList ( String cacheName , ArrayList incomingList ) { InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; try { invalidationTableList . readWriteLock . readLock ( ) . lock ( ) ; Iterator it = incomingList . iterator ( ) ; while ( it . hasNext ( ) ) { Object obj = it . next ( ) ; if ( obj instanceof CacheEntry ) { // ignore any "push-pull" String id's in DRS case CacheEntry cacheEntry = ( CacheEntry ) obj ; if ( internalFilterEntry ( cacheName , invalidationTableList , cacheEntry ) == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "filterEntryList(): Filtered OUT cacheName=" + cacheName + " id=" + cacheEntry . id ) ; } it . remove ( ) ; } } } return incomingList ; } finally { invalidationTableList . readWriteLock . readLock ( ) . unlock ( ) ; } }
This ensures all incoming CacheEntrys have not been invalidated .
221
13
158,819
private final CacheEntry internalFilterEntry ( String cacheName , InvalidationTableList invalidationTableList , CacheEntry cacheEntry ) { InvalidateByIdEvent idEvent = null ; if ( cacheEntry == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterEntry(): Filtered cacheName=" + cacheName + " CE == NULL" ) ; } return null ; } else if ( cacheEntry . id == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterEntry(): Filtered cacheName=" + cacheName + " id == NULL" ) ; } return null ; } long timeStamp = cacheEntry . getTimeStamp ( ) ; idEvent = ( InvalidateByIdEvent ) invalidationTableList . presentIdSet . get ( cacheEntry . id ) ; if ( ( idEvent != null ) && ( idEvent . getTimeStamp ( ) > timeStamp ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in presentIdSet. cacheName=" + cacheName + " id=" + cacheEntry . id ) ; } return null ; } if ( collision ( invalidationTableList . presentTemplateSet , cacheEntry . getTemplates ( ) , timeStamp ) || collision ( invalidationTableList . presentIdSet , cacheEntry . getDataIds ( ) , timeStamp ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry . id ) ; } return null ; } if ( timeStamp > lastTimeCleared ) { return cacheEntry ; } //else check past values as well idEvent = ( InvalidateByIdEvent ) invalidationTableList . pastIdSet . get ( cacheEntry . id ) ; if ( ( idEvent != null ) && ( idEvent . getTimeStamp ( ) > timeStamp ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in pastIdSet. cacheName=" + cacheName + " id=" + cacheEntry . id ) ; } return null ; } if ( collision ( invalidationTableList . pastTemplateSet , cacheEntry . getTemplates ( ) , timeStamp ) || collision ( invalidationTableList . pastIdSet , cacheEntry . getDataIds ( ) , timeStamp ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry . id ) ; } return null ; } return cacheEntry ; }
This is a helper method that filters a single CacheEntry . It is called by the filterEntry and filterEntryList methods .
653
25
158,820
public ExternalInvalidation filterExternalCacheFragment ( String cacheName , ExternalInvalidation externalCacheFragment ) { InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; try { invalidationTableList . readWriteLock . readLock ( ) . lock ( ) ; return internalFilterExternalCacheFragment ( cacheName , invalidationTableList , externalCacheFragment ) ; } finally { invalidationTableList . readWriteLock . readLock ( ) . unlock ( ) ; } }
This ensures that the specified ExternalCacheFragment has not been invalidated .
107
15
158,821
public ArrayList filterExternalCacheFragmentList ( String cacheName , ArrayList incomingList ) { InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; try { invalidationTableList . readWriteLock . readLock ( ) . lock ( ) ; Iterator it = incomingList . iterator ( ) ; while ( it . hasNext ( ) ) { ExternalInvalidation externalCacheFragment = ( ExternalInvalidation ) it . next ( ) ; if ( null == internalFilterExternalCacheFragment ( cacheName , invalidationTableList , externalCacheFragment ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "filterExternalCacheFragmentList(): Filtered OUT cacheName=" + cacheName + " uri=" + externalCacheFragment . getUri ( ) ) ; } it . remove ( ) ; } } return incomingList ; } finally { invalidationTableList . readWriteLock . readLock ( ) . unlock ( ) ; } }
This ensures all incoming ExternalCacheFragments have not been invalidated .
213
14
158,822
private final ExternalInvalidation internalFilterExternalCacheFragment ( String cacheName , InvalidationTableList invalidationTableList , ExternalInvalidation externalCacheFragment ) { if ( externalCacheFragment == null ) { return null ; } long timeStamp = externalCacheFragment . getTimeStamp ( ) ; if ( collision ( invalidationTableList . presentTemplateSet , externalCacheFragment . getInvalidationIds ( ) , timeStamp ) || collision ( invalidationTableList . presentIdSet , externalCacheFragment . getTemplates ( ) , timeStamp ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment . getUri ( ) ) ; } return null ; } if ( timeStamp > lastTimeCleared ) { return externalCacheFragment ; } //else check past values as well if ( collision ( invalidationTableList . pastTemplateSet , externalCacheFragment . getInvalidationIds ( ) , timeStamp ) || collision ( invalidationTableList . pastIdSet , externalCacheFragment . getTemplates ( ) , timeStamp ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment . getUri ( ) ) ; } return null ; } return externalCacheFragment ; }
This is a helper method that filters a single ExternalCacheFragment . It is called by the filterExternalCacheFragment and filterExternalCacheFragmentList methods .
364
33
158,823
private final boolean collision ( Map < Object , InvalidationEvent > hashtable , Enumeration enumeration , long timeStamp ) { while ( enumeration . hasMoreElements ( ) ) { Object key = enumeration . nextElement ( ) ; InvalidationEvent invalidationEvent = ( InvalidationEvent ) hashtable . get ( key ) ; if ( ( invalidationEvent != null ) && ( invalidationEvent . getTimeStamp ( ) > timeStamp ) ) { return true ; } } return false ; }
This is a helper method that checks for a collision .
109
11
158,824
private InvalidationTableList getInvalidationTableList ( String cacheName ) { InvalidationTableList invalidationTableList = cacheinvalidationTables . get ( cacheName ) ; if ( invalidationTableList == null ) { synchronized ( this ) { invalidationTableList = new InvalidationTableList ( ) ; cacheinvalidationTables . put ( cacheName , invalidationTableList ) ; } } return invalidationTableList ; }
Retrieve the InvalidationTableList by the specified cacheName .
93
13
158,825
public static File getBootstrapJar ( ) { if ( launchHome == null ) { if ( launchURL == null ) { // How were we launched? launchURL = getLocationFromClass ( KernelUtils . class ) ; } launchHome = FileUtils . getFile ( launchURL ) ; } return launchHome ; }
The location of the launch jar is only obtained once .
68
11
158,826
public static File getBootstrapLibDir ( ) { if ( libDir . get ( ) == null ) { libDir = StaticValue . mutateStaticValue ( libDir , new Utils . FileInitializer ( getBootstrapJar ( ) . getParentFile ( ) ) ) ; } return libDir . get ( ) ; }
The lib dir is the parent of the bootstrap jar
70
11
158,827
public static Properties getProperties ( final InputStream is ) throws IOException { Properties p = new Properties ( ) ; try { if ( is != null ) { p . load ( is ) ; // Look for "values" and strip the quotes to values for ( Entry < Object , Object > entry : p . entrySet ( ) ) { String s = ( ( String ) entry . getValue ( ) ) . trim ( ) ; // If first and last characters are ", strip them off.. if ( s . length ( ) > 1 && s . startsWith ( "\"" ) && s . endsWith ( "\"" ) ) { entry . setValue ( s . substring ( 1 , s . length ( ) - 1 ) ) ; } } } } finally { Utils . tryToClose ( is ) ; } return p ; }
Read properties from input stream . Will close the input stream before returning .
175
14
158,828
private static String getClassFromLine ( String line ) { line = line . trim ( ) ; // Skip commented lines if ( line . length ( ) == 0 || line . startsWith ( "#" ) ) return null ; // lop off spaces/tabs/end-of-line-comments String [ ] className = line . split ( "[\\s#]" ) ; if ( className . length >= 1 ) return className [ 0 ] ; return null ; }
Read a service class from the given line . Must ignore whitespace and skip comment lines or end of line comments .
99
23
158,829
public final void checkSpillLimits ( ) { long currentTotal ; long currentSize ; synchronized ( this ) { currentTotal = _countTotal ; currentSize = _countTotalBytes ; } if ( ! _spilling ) { // We are not currently spilling so we need to calculate the moving average // for the number of items on our stream and then check the moving average // and the total size of the items on the stream against our configured limits. // moving total is accumulated value over last 20 calculations minus the // immediately previous value. This saves both a division and storing the // last average. To get the current running total we add the current total // to the _movingTotal _movingTotal = _movingTotal + currentTotal ; // we calculate the moving average by dividing moving total by number of // cycles in the moving window. long movingAverage = _movingTotal / MOVING_AVERAGE_LENGTH ; // we then diminish the moving total by the moving average leaving it free for next time. _movingTotal = _movingTotal - movingAverage ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream is NOT SPILLING" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current size :" + currentSize ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current total :" + currentTotal ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Moving average:" + movingAverage ) ; if ( movingAverage >= _movingAverageHighLimit || // There are too many items on the stream currentSize >= _totalSizeHighLimit ) // The size of items on the stream is too large { _spilling = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream has STARTED SPILLING" ) ; } } else { // We are spilling so we just need to check against our configured limits and // if we are below them for both number of items and total size of items then // we can stop spilling. If we do stop spilling we also need to reset our moving // average counter. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream is SPILLING" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current size :" + currentSize ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current total :" + currentTotal ) ; if ( currentTotal <= _movingAverageLowLimit && // There are only a few items on the stream currentSize <= _totalSizeLowLimit ) // AND The items on the stream are small { _spilling = false ; _movingTotal = _movingAverageLowLimit * ( MOVING_AVERAGE_LENGTH - 1 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream has STOPPED SPILLING" ) ; } } }
Instead of just triggering spilling when we have a certain number of Items on a stream we now have the ability to trigger spilling if the total size of the Items on a stream goes over a pre - defined limit . This should allow us to control the memory usage of a stream in a more intuitive fashion .
765
60
158,830
public final void updateTotal ( int oldSizeInBytes , int newSizeInBytes ) throws SevereMessageStoreException { boolean doCallback = false ; synchronized ( this ) { // We're only replacing an old size estimation // with a new one so we do not need to change // or inspect the count total and watermark // Check whether we were between our limits before // before this update. boolean wasBelowHighLimit = ( _countTotalBytes < _watermarkBytesHigh ) ; boolean wasAboveLowLimit = ( _countTotalBytes >= _watermarkBytesLow ) ; // Update our count to the new value by adding the // difference between the old and new sizes _countTotalBytes = _countTotalBytes + ( newSizeInBytes - oldSizeInBytes ) ; if ( ( wasBelowHighLimit && _countTotalBytes >= _watermarkBytesHigh ) // Was below the HIGH watermark but now isn't || ( wasAboveLowLimit && _countTotalBytes < _watermarkBytesLow ) ) // OR was above LOW watermark but now isn't { doCallback = true ; } } if ( doCallback ) { _owningStreamLink . eventWatermarkBreached ( ) ; } }
once we have the Item available to determine it from .
249
11
158,831
public static void addUnspecifiedAttributes ( FeatureDescriptor descriptor , Tag tag , String [ ] standardAttributesSorted , FaceletContext ctx ) { for ( TagAttribute attribute : tag . getAttributes ( ) . getAll ( ) ) { final String name = attribute . getLocalName ( ) ; if ( Arrays . binarySearch ( standardAttributesSorted , name ) < 0 ) { // attribute not found in standard attributes // --> put it on the BeanDescriptor descriptor . setValue ( name , attribute . getValueExpression ( ctx , Object . class ) ) ; } } }
Adds all attributes from the given Tag which are NOT listed in standardAttributesSorted as a ValueExpression to the given BeanDescriptor . NOTE that standardAttributesSorted has to be alphabetically sorted in order to use binary search .
125
48
158,832
public static boolean containsUnspecifiedAttributes ( Tag tag , String [ ] standardAttributesSorted ) { for ( TagAttribute attribute : tag . getAttributes ( ) . getAll ( ) ) { final String name = attribute . getLocalName ( ) ; if ( Arrays . binarySearch ( standardAttributesSorted , name ) < 0 ) { return true ; } } return false ; }
Returns true if the given Tag contains attributes that are not specified in standardAttributesSorted . NOTE that standardAttributesSorted has to be alphabetically sorted in order to use binary search .
79
37
158,833
public static void addDevelopmentAttributes ( FeatureDescriptor descriptor , FaceletContext ctx , TagAttribute displayName , TagAttribute shortDescription , TagAttribute expert , TagAttribute hidden , TagAttribute preferred ) { if ( displayName != null ) { descriptor . setDisplayName ( displayName . getValue ( ctx ) ) ; } if ( shortDescription != null ) { descriptor . setShortDescription ( shortDescription . getValue ( ctx ) ) ; } if ( expert != null ) { descriptor . setExpert ( expert . getBoolean ( ctx ) ) ; } if ( hidden != null ) { descriptor . setHidden ( hidden . getBoolean ( ctx ) ) ; } if ( preferred != null ) { descriptor . setPreferred ( preferred . getBoolean ( ctx ) ) ; } }
Applies the displayName shortDescription expert hidden and preferred attributes to the BeanDescriptor .
169
19
158,834
public static void addDevelopmentAttributesLiteral ( FeatureDescriptor descriptor , TagAttribute displayName , TagAttribute shortDescription , TagAttribute expert , TagAttribute hidden , TagAttribute preferred ) { if ( displayName != null ) { descriptor . setDisplayName ( displayName . getValue ( ) ) ; } if ( shortDescription != null ) { descriptor . setShortDescription ( shortDescription . getValue ( ) ) ; } if ( expert != null ) { descriptor . setExpert ( Boolean . valueOf ( expert . getValue ( ) ) ) ; } if ( hidden != null ) { descriptor . setHidden ( Boolean . valueOf ( hidden . getValue ( ) ) ) ; } if ( preferred != null ) { descriptor . setPreferred ( Boolean . valueOf ( preferred . getValue ( ) ) ) ; } }
Applies the displayName shortDescription expert hidden and preferred attributes to the BeanDescriptor if they are all literal values . Thus no FaceletContext is necessary .
171
33
158,835
public static boolean areAttributesLiteral ( TagAttribute ... attributes ) { for ( TagAttribute attribute : attributes ) { if ( attribute != null && ! attribute . isLiteral ( ) ) { // the attribute exists and is not literal return false ; } } // all attributes are literal return true ; }
Returns true if all specified attributes are either null or literal .
63
12
158,836
protected static FacesServletMapping calculateFacesServletMapping ( String servletPath , String pathInfo ) { if ( pathInfo != null ) { // If there is a "extra path", it's definitely no extension mapping. // Now we just have to determine the path which has been specified // in the url-pattern, but that's easy as it's the same as the // current servletPath. It doesn't even matter if "/*" has been used // as in this case the servletPath is just an empty string according // to the Servlet Specification (SRV 4.4). return FacesServletMapping . createPrefixMapping ( servletPath ) ; } else { // In the case of extension mapping, no "extra path" is available. // Still it's possible that prefix-based mapping has been used. // Actually, if there was an exact match no "extra path" // is available (e.g. if the url-pattern is "/faces/*" // and the request-uri is "/context/faces"). int slashPos = servletPath . lastIndexOf ( ' ' ) ; int extensionPos = servletPath . lastIndexOf ( ' ' ) ; if ( extensionPos > - 1 && extensionPos > slashPos ) { String extension = servletPath . substring ( extensionPos ) ; return FacesServletMapping . createExtensionMapping ( extension ) ; } else { // There is no extension in the given servletPath and therefore // we assume that it's an exact match using prefix-based mapping. return FacesServletMapping . createPrefixMapping ( servletPath ) ; } } }
Determines the mapping of the FacesServlet in the web . xml configuration file . However there is no need to actually parse this configuration file as runtime information is sufficient .
351
35
158,837
private boolean isCDIEnabled ( Collection < WebSphereBeanDeploymentArchive > bdas ) { boolean anyHasBeans = false ; for ( WebSphereBeanDeploymentArchive bda : bdas ) { boolean hasBeans = false ; if ( bda . getType ( ) != ArchiveType . RUNTIME_EXTENSION ) { hasBeans = isCDIEnabled ( bda ) ; } anyHasBeans = anyHasBeans || hasBeans ; if ( anyHasBeans ) { break ; } } return anyHasBeans ; }
Do any of the specified BDAs or any of BDAs accessible by them have any beans
124
18
158,838
private boolean isCDIEnabled ( WebSphereBeanDeploymentArchive bda ) { Boolean hasBeans = cdiStatusMap . get ( bda . getId ( ) ) ; if ( hasBeans == null ) { //it's enabled if it has beans or it is an extension which could add beans hasBeans = bda . hasBeans ( ) || bda . isExtension ( ) ; //setting this now should prevent loops when checking children in the next step cdiStatusMap . put ( bda . getId ( ) , hasBeans ) ; //it's also enabled if any of it's children are enabled (but not including runtime extensions) hasBeans = hasBeans || isCDIEnabled ( bda . getWebSphereBeanDeploymentArchives ( ) ) ; //remember the result cdiStatusMap . put ( bda . getId ( ) , hasBeans ) ; } return hasBeans ; }
Does the specified BDA or any of BDAs accessible by it have any beans or it is an extension which could add beans
202
25
158,839
@ Override public boolean isCDIEnabled ( String bdaId ) { boolean hasBeans = false ; //the top level isCDIEnabled can fail faster if ( isCDIEnabled ( ) ) { Boolean hasBeansBoolean = cdiStatusMap . get ( bdaId ) ; if ( hasBeansBoolean == null ) { WebSphereBeanDeploymentArchive bda = deploymentDBAs . get ( bdaId ) ; if ( bda == null ) { // turns out that JAXWS create modules dynamically at runtime. That should be the only way // that there is no bda for a valid module/bda id. At the moment, CDI is not supported in // a module unless it exists at startup. hasBeans = false ; } else { hasBeans = isCDIEnabled ( bda ) ; } } else { hasBeans = hasBeansBoolean ; } } return hasBeans ; }
Does the specified BDA or any of BDAs accessible by it have any beans or an extension which might add beans .
201
24
158,840
private BeanDeploymentArchive createBDAOntheFly ( Class < ? > beanClass ) throws CDIException { //Add the class in one of the bdas if an existing bda share the same classloader as the beanClass //Otherwise, we need to create a brand new bda and then add the bda to the graph //when it reaches here, it means no bda found for this class. We need to create a bda //Let's see whether there is a bda with the same classloader as the beanClass, if there is, let's add this class BeanDeploymentArchive bdaToReturn = findCandidateBDAtoAddThisClass ( beanClass ) ; if ( bdaToReturn != null ) { return bdaToReturn ; } else { //If it comes here, it means no bda exists with the same classloader as the bean class, so we need to create a bda for it. return createNewBdaAndMakeWiring ( beanClass ) ; } }
Create a bda and wire it in the deployment graph
215
11
158,841
private BeanDeploymentArchive createNewBdaAndMakeWiring ( Class < ? > beanClass ) { try { OnDemandArchive onDemandArchive = new OnDemandArchive ( cdiRuntime , application , beanClass ) ; WebSphereBeanDeploymentArchive newBda = BDAFactory . createBDA ( this , onDemandArchive , cdiRuntime ) ; ClassLoader beanClassCL = onDemandArchive . getClassLoader ( ) ; // need to make this bda to be accessible to other bdas according to classloader hierarchy for ( WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives ( ) ) { ClassLoader thisBDACL = wbda . getClassLoader ( ) ; //If the current archive is an extension bda, let's add this newly created bda accessible to it if ( wbda . getType ( ) == ArchiveType . RUNTIME_EXTENSION ) { newBda . addBeanDeploymentArchive ( wbda ) ; } else { //let's check to see whether the wbda needs to be accessible to this new bda //The current bda should be accessible to the newly created bda if the newly created bda's classloader // is the same or the child classloader of the current bda makeWiring ( newBda , wbda , thisBDACL , beanClassCL ) ; } if ( ( wbda . getType ( ) == ArchiveType . RUNTIME_EXTENSION ) && wbda . extensionCanSeeApplicationBDAs ( ) ) { wbda . addBeanDeploymentArchive ( newBda ) ; } else { //Let's check whether the wbda's classloader is the descendant classloader of the new bda makeWiring ( wbda , newBda , beanClassCL , thisBDACL ) ; } } //Add this new bda to the deployment graph addBeanDeploymentArchive ( newBda ) ; return newBda ; } catch ( CDIException e ) { throw new IllegalStateException ( e ) ; } }
Create a new bda and put the beanClass to the bda and then wire this bda in the deployment according to the classloading hierarchy
447
29
158,842
private BeanDeploymentArchive findCandidateBDAtoAddThisClass ( Class < ? > beanClass ) throws CDIException { for ( WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives ( ) ) { if ( wbda . getClassLoader ( ) == beanClass . getClassLoader ( ) ) { wbda . addToBeanClazzes ( beanClass ) ; return wbda ; } //if the cl is null, which means the classloader is the root classloader //for this kind of bda, its id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER //all classes loaded by the root classloader should be in a bda with the id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER if ( ( beanClass . getClassLoader ( ) == null ) && ( wbda . getId ( ) . endsWith ( CDIUtils . BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER ) ) ) { wbda . addToBeanClazzes ( beanClass ) ; return wbda ; } } return null ; }
Find the bda with the same classloader as the beanClass and then add the beanclasses to it
278
21
158,843
private void makeWiring ( WebSphereBeanDeploymentArchive wireFromBda , WebSphereBeanDeploymentArchive wireToBda , ClassLoader wireToBdaCL , ClassLoader wireFromBdaCL ) { while ( wireFromBdaCL != null ) { if ( wireFromBdaCL == wireToBdaCL ) { wireFromBda . addBeanDeploymentArchive ( wireToBda ) ; break ; } else { wireFromBdaCL = wireFromBdaCL . getParent ( ) ; } } //if we are here, it means the wireToBdaCL is root classloader, loading java.xx classes. All other bdas should be accessible to this new bda. if ( wireFromBdaCL == wireToBdaCL ) { wireFromBda . addBeanDeploymentArchive ( wireToBda ) ; } }
Make a wiring from the wireFromBda to the wireToBda if the wireFromBda s classloader is the descendant of the wireToBda s classloader
193
36
158,844
@ Override public void addBeanDeploymentArchive ( WebSphereBeanDeploymentArchive bda ) throws CDIException { deploymentDBAs . put ( bda . getId ( ) , bda ) ; extensionClassLoaders . add ( bda . getClassLoader ( ) ) ; ArchiveType type = bda . getType ( ) ; if ( type != ArchiveType . SHARED_LIB && type != ArchiveType . RUNTIME_EXTENSION ) { applicationBDAs . add ( bda ) ; } }
Add a BeanDeploymentArchive to this deployment
113
10
158,845
@ Override public void addBeanDeploymentArchives ( Set < WebSphereBeanDeploymentArchive > bdas ) throws CDIException { for ( WebSphereBeanDeploymentArchive bda : bdas ) { addBeanDeploymentArchive ( bda ) ; } }
Add a Set of BDAs to the deployment
65
9
158,846
@ Override public void scan ( ) throws CDIException { Collection < WebSphereBeanDeploymentArchive > allBDAs = new ArrayList < WebSphereBeanDeploymentArchive > ( deploymentDBAs . values ( ) ) ; for ( WebSphereBeanDeploymentArchive bda : allBDAs ) { bda . scanForBeanDefiningAnnotations ( true ) ; } for ( WebSphereBeanDeploymentArchive bda : allBDAs ) { if ( ! bda . hasBeenScanned ( ) ) { bda . scan ( ) ; } } }
Scan all the BDAs in the deployment to see if there are any bean classes .
128
17
158,847
@ Override public void initializeInjectionServices ( ) throws CDIException { Set < ReferenceContext > cdiReferenceContexts = new HashSet < ReferenceContext > ( ) ; //first we need to initialize the injection service and collect the reference contexts and the injection classes for ( WebSphereBeanDeploymentArchive bda : getApplicationBDAs ( ) ) { // Don't initialize child libraries, instead aggregate for the whole module if ( bda . getType ( ) != ArchiveType . MANIFEST_CLASSPATH && bda . getType ( ) != ArchiveType . WEB_INF_LIB ) { ReferenceContext referenceContext = bda . initializeInjectionServices ( ) ; cdiReferenceContexts . add ( referenceContext ) ; } } // now we need to process the injections for ( ReferenceContext referenceContext : cdiReferenceContexts ) { try { referenceContext . process ( ) ; } catch ( InjectionException e ) { throw new CDIException ( e ) ; } } }
Initialize the Resource Injection Service with each BDA s bean classes .
212
15
158,848
@ Override public void shutdown ( ) { if ( this . bootstrap != null ) { AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { @ Override public Void run ( ) { bootstrap . shutdown ( ) ; return null ; } } ) ; this . bootstrap = null ; this . deploymentDBAs . clear ( ) ; this . applicationBDAs . clear ( ) ; this . classloader = null ; this . extensionClassLoaders . clear ( ) ; this . cdiEnabled = false ; this . cdiStatusMap . clear ( ) ; this . application = null ; this . classBDAMap . clear ( ) ; } }
Shutdown and clean up the whole deployment . The deployment will not be usable after this call has been made .
142
22
158,849
boolean isConfigValid ( ConvergedClientConfig config ) { boolean valid = true ; String clientId = config . getClientId ( ) ; String clientSecret = config . getClientSecret ( ) ; String authorizationEndpoint = config . getAuthorizationEndpointUrl ( ) ; String jwksUri = config . getJwkEndpointUrl ( ) ; if ( clientId == null || clientId . length ( ) == 0 ) { Tr . error ( tc , "INVALID_CONFIG_PARAM" , new Object [ ] { OidcLoginConfigImpl . KEY_clientId , clientId } ) ; //CWWKS5500E valid = false ; } if ( clientSecret == null || clientSecret . length ( ) == 0 ) { Tr . error ( tc , "INVALID_CONFIG_PARAM" , new Object [ ] { OidcLoginConfigImpl . KEY_clientSecret , "" } ) ; //CWWKS5500E valid = false ; } if ( authorizationEndpoint == null || authorizationEndpoint . length ( ) == 0 || ( ! authorizationEndpoint . toLowerCase ( ) . startsWith ( "http" ) ) ) { Tr . error ( tc , "INVALID_CONFIG_PARAM" , new Object [ ] { OidcLoginConfigImpl . KEY_authorizationEndpoint , authorizationEndpoint } ) ; //CWWKS5500E valid = false ; } // TODO: we need a message when we have bad jwks uri's, but this kind of check fails when jwks uri is not set. /* * if (jwksUri == null || jwksUri.length() == 0 * || (!jwksUri.toLowerCase().startsWith("http"))) { * Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_jwksUri, jwksUri }); //CWWKS5500E * * } */ return valid ; }
Check for some things that will always fail and emit message about bad config . Do here so 1 ) classic oidc messages don t change and 2 ) put error message closer in log to failure .
444
40
158,850
protected void cleanOutBifurcatedMessages ( BifurcatedConsumerSessionImpl owner , boolean bumpRedeliveryOnClose ) throws SIResourceException , SISessionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "cleanOutBifurcatedMessages" , new Object [ ] { new Integer ( hashCode ( ) ) , this } ) ; int unlockedMessages = 0 ; synchronized ( this ) { if ( firstMsg != null ) { LMEMessage message = firstMsg ; LMEMessage unlockMsg = null ; while ( message != null ) { unlockMsg = message ; message = message . next ; // Only unlock messages that are owned by the bifurcated consumer. if ( unlockMsg . owner == owner ) { // Unlock the message from the message store if ( unlockMsg . isStored ) { try { unlockMessage ( unlockMsg . message , bumpRedeliveryOnClose ) ; } catch ( SIMPMessageNotLockedException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; // See defect 387591 // We should only get this exception if the message was deleted via // the controllable objects i.e. the admin console. If we are here for // another reason that we have a real error. } } // Remove the element from the liss removeMessage ( unlockMsg ) ; unlockedMessages ++ ; } } } } if ( unlockedMessages != 0 ) localConsumerPoint . removeActiveMessages ( unlockedMessages ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "cleanOutBifurcatedMessages" , this ) ; }
When a bifurcated consumer is closed all locked messages owned by that consumer must be unlocked
390
20
158,851
protected int getNumberOfLockedMessages ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getNumberOfLockedMessages" ) ; int count = 0 ; synchronized ( this ) { LMEMessage message ; message = firstMsg ; while ( message != null ) { count ++ ; message = message . next ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getNumberOfLockedMessages" , new Integer ( count ) ) ; return count ; }
Return the number of locked messages that are part of this locked message enumeration . The count will start from thr firstMsg unlike th getRemainingMessageCount which starts from the currentMsg .
140
38
158,852
protected void removeMessage ( LMEMessage message ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeMessage" , new Object [ ] { new Integer ( hashCode ( ) ) , message , this } ) ; // If this was the message we entered the callback with we need // to move the start point back a bit if ( message == callbackEntryMsg ) callbackEntryMsg = message . previous ; // If this is our current message we need to move the cursor // back a bit if ( message == currentMsg ) currentMsg = message . previous ; // If this message was the next to expire we move the expiry cursor on to // the next eligible message. We leave any alarm registered so that it pops, // when this happens it realises the alarm is not valid for the next expiring // message and re-registers itself for the correct time. This gives us the // best performance when no locks are expiring as we're not continually // registering and de-registering alarms for every message if ( message == nextMsgToExpire ) { do { nextMsgToExpire = nextMsgToExpire . next ; } while ( ( nextMsgToExpire != null ) && ( nextMsgToExpire . expiryTime == 0 ) ) ; } if ( message == nextMsgReferenceToExpire ) { do { nextMsgReferenceToExpire = nextMsgReferenceToExpire . next ; } while ( ( nextMsgReferenceToExpire != null ) && ( nextMsgReferenceToExpire . expiryTime == 0 ) ) ; } // Unlink this message from the list if ( message . previous != null ) message . previous . next = message . next ; else firstMsg = message . next ; if ( message . next != null ) message . next . previous = message . previous ; else lastMsg = message . previous ; // Pool the element if there's space if ( pooledCount < poolSize ) { message . message = null ; message . next = pooledMsg ; message . previous = null ; message . owner = null ; message . jsMessage = null ; message . expiryTime = 0 ; message . expiryMsgReferenceTime = 0 ; pooledMsg = message ; pooledCount ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeMessage" , this ) ; }
Remove a message object from the list
518
7
158,853
protected void resetCallbackCursor ( ) throws SIResourceException , SISessionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "resetCallbackCursor" , new Integer ( hashCode ( ) ) ) ; synchronized ( this ) { unlockAllUnread ( ) ; callbackEntryMsg = lastMsg ; currentMsg = lastMsg ; messageAvailable = false ; endReached = false ; validState = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "resetCallbackCursor" , this ) ; }
This is called when a consumeMessages call has completed it returns the LME to a consistent state ready for the next consumeMessages .
150
28
158,854
protected void unlockAll ( boolean closingSession ) throws SIResourceException , SIMPMessageNotLockedException , SISessionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "unlockAll" , new Object [ ] { new Integer ( hashCode ( ) ) , this } ) ; int unlockedMessages = 0 ; SIMPMessageNotLockedException notLockedException = null ; int notLockedExceptionMessageIndex = 0 ; synchronized ( this ) { messageAvailable = false ; if ( firstMsg != null ) { LMEMessage pointerMsg = firstMsg ; LMEMessage removedMsg = null ; SIMessageHandle [ ] messageHandles = new SIMessageHandle [ getNumberOfLockedMessages ( ) ] ; boolean more = true ; while ( more ) { // See if this is the last message in the list if ( pointerMsg == lastMsg ) more = false ; // Only unlock messages that are in the MS (and haven't already // been unlocked by us) if ( pointerMsg != currentUnlockedMessage ) { if ( pointerMsg . isStored ) { try { unlockMessage ( pointerMsg . message , true ) ; } catch ( SIMPMessageNotLockedException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; // See defect 387591 // We should only get this exception if the message was deleted via // the controllable objects i.e. the admin console. If we are here for // another reason that we have a real error. SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration" , "1:2229:1.154.3.1" , e } ) ; messageHandles [ notLockedExceptionMessageIndex ] = pointerMsg . getJsMessage ( ) . getMessageHandle ( ) ; notLockedExceptionMessageIndex ++ ; if ( notLockedException == null ) notLockedException = e ; } catch ( SISessionDroppedException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll" , "1:2243:1.154.3.1" , this ) ; if ( ! closingSession ) { handleSessionDroppedException ( e ) ; } SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll" , "1:2255:1.154.3.1" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "unlockAll" , e ) ; throw e ; } } unlockedMessages ++ ; } removedMsg = pointerMsg ; pointerMsg = pointerMsg . next ; // Remove the element from the list removeMessage ( removedMsg ) ; } currentUnlockedMessage = null ; } } if ( unlockedMessages != 0 ) localConsumerPoint . removeActiveMessages ( unlockedMessages ) ; if ( notLockedException != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "unlockAll" , this ) ; throw notLockedException ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "unlockAll" , this ) ; }
Unlock all the messages in the list
843
8
158,855
private void unlockAllUnread ( ) throws SIResourceException , SISessionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "unlockAllUnread" , new Object [ ] { new Integer ( hashCode ( ) ) , this } ) ; int unlockedMessages = 0 ; synchronized ( this ) { messageAvailable = false ; // Only unlock messages if we have reached the end of the list. if ( firstMsg != null && ! endReached ) { LMEMessage pointerMsg = null ; if ( currentMsg == null ) pointerMsg = firstMsg ; else pointerMsg = currentMsg . next ; LMEMessage removedMsg = null ; boolean more = true ; if ( pointerMsg != null ) { while ( more ) { // See if this is the last message in the list if ( pointerMsg == lastMsg ) more = false ; // Only unlock messages that are in the MS (and haven't already // been unlocked by us) if ( pointerMsg != currentUnlockedMessage ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unlocking Message " + pointerMsg ) ; if ( pointerMsg . isStored ) { try { unlockMessage ( pointerMsg . message , false ) ; } catch ( SIMPMessageNotLockedException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; // See defect 387591 // We should only get this exception if the message was deleted via // the controllable objects i.e. the admin console. If we are here for // another reason that we have a real error. } } unlockedMessages ++ ; } removedMsg = pointerMsg ; pointerMsg = pointerMsg . next ; // Remove the element from the list removeMessage ( removedMsg ) ; } } } } if ( unlockedMessages != 0 ) localConsumerPoint . removeActiveMessages ( unlockedMessages ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "unlockAllUnread" , this ) ; }
Method to unlock all messages which haven t been read
474
10
158,856
public boolean containsValue ( Token value , Transaction transaction ) throws ObjectManagerException { try { for ( Iterator iterator = entrySet ( ) . iterator ( ) ; ; ) { Entry entry = ( Entry ) iterator . next ( transaction ) ; Token entryValue = entry . getValue ( ) ; if ( value == entryValue ) { return true ; } } } catch ( java . util . NoSuchElementException exception ) { // No FFDC code needed, just exited search. return false ; } // try. }
Determines if the Map contains the Token
106
9
158,857
public long countAllMessagesOnStream ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "countAllMessagesOnStream" ) ; long count = 0 ; _targetStream . setCursor ( 0 ) ; // Get the first TickRange TickRange tr = _targetStream . getNext ( ) ; while ( tr . endstamp < RangeList . INFINITY ) { if ( tr . type == TickRange . Value ) { count ++ ; } if ( tr . type == TickRange . Requested ) { // If we are an restarted IME (gathering) then we may have to restore msgs from the // DME which were previously Value msgs in this stream. We need to count any re-requests // in our count as they contribute to the total. if ( ( ( AIRequestedTick ) tr . value ) . getRestoringAOValue ( ) != null ) count ++ ; } tr = _targetStream . getNext ( ) ; } // end while if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "countAllMessagesOnStream" , Long . valueOf ( count ) ) ; return count ; }
Counts the number of messages in the value state on the stream .
282
14
158,858
public final void incrementUnlockCount ( long tick ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "incrementUnlockCount" , Long . valueOf ( tick ) ) ; _targetStream . setCursor ( tick ) ; TickRange tickRange = _targetStream . getNext ( ) ; if ( tickRange . type == TickRange . Value ) { AIValueTick valueTick = ( AIValueTick ) tickRange . value ; if ( valueTick != null ) valueTick . incRMEUnlockCount ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "incrementUnlockCount" , tickRange ) ; }
sets the unlock count of the value tick s msg .
183
11
158,859
public void processRequestAck ( long tick , long dmeVersion ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "processRequestAck" , new Object [ ] { Long . valueOf ( tick ) , Long . valueOf ( dmeVersion ) } ) ; // Only consider non-stale request acks if ( dmeVersion >= _latestDMEVersion ) { _targetStream . setCursor ( tick ) ; TickRange tickRange = _targetStream . getNext ( ) ; // Make sure that we still have a Q/G if ( tickRange . type == TickRange . Requested ) { AIRequestedTick airt = ( AIRequestedTick ) tickRange . value ; // serialize with get repetition and request timeouts synchronized ( airt ) { // Set the request timer to slow, but only if it is not already slowed if ( ! airt . isSlowed ( ) ) { _eagerGetTOM . removeTimeoutEntry ( airt ) ; airt . setSlowed ( true ) ; airt . setAckingDMEVersion ( dmeVersion ) ; long to = airt . getTimeout ( ) ; if ( to > 0 || to == _mp . getCustomProperties ( ) . get_infinite_timeout ( ) ) { _slowedGetTOM . addTimeoutEntry ( airt ) ; } } } } else { // This can happen if the request ack got in too late and the Q/G was timed out and rejected } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "processRequestAck" ) ; }
A ControlRequestAck message tells the RME to slow down its get repetition timeout since we now know that the DME has received the request .
378
30
158,860
public void processResetRequestAck ( long dmeVersion , SendDispatcher sendDispatcher ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "processResetRequestAck" , Long . valueOf ( dmeVersion ) ) ; // Only consider non-stale request acks if ( dmeVersion >= _latestDMEVersion ) { if ( dmeVersion > _latestDMEVersion ) _latestDMEVersion = dmeVersion ; _slowedGetTOM . applyToEachEntry ( new AddToEagerTOM ( _slowedGetTOM , dmeVersion ) ) ; sendDispatcher . sendResetRequestAckAck ( dmeVersion ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "processResetRequestAck" ) ; }
A ControlResetRequestAck message tells the RME to start re - sending get requests with an eager timeout since the DME has crashed and recovered .
211
32
158,861
public AnycastInputHandler getAnycastInputHandler ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getAnycastInputHandler" ) ; SibTr . exit ( tc , "getAnycastInputHandler" , _parent ) ; } return _parent ; }
Returns the AnycastInputHandler associated with this AIStream
78
11
158,862
public void messagingEngineStarting ( final JsMessagingEngine messagingEngine ) { final String methodName = "messagingEngineStarting" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } try { addMessagingEngine ( messagingEngine ) ; } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:608:1.40" , this ) ; SibTr . error ( TRACE , "MESSAGING_ENGINE_STARTING_CWSIV0555" , new Object [ ] { exception , messagingEngine . getName ( ) , messagingEngine . getBusName ( ) , this } ) ; // To reach this point would mean a more serious error has occurred like // the destination does not exist. Deactivate the MDB so that the user // knows there is a problem. This behaviour is consistent with the MDB // being deactivated if the MDB fails during initial startup (an exception // thrown to J2C and they would deactivate the MDB). deactivate ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Called to indicate that a messaging engine has been started . Adds it to the set of active messaging engines .
301
22
158,863
public void messagingEngineStopping ( final JsMessagingEngine messagingEngine , final int mode ) { final String methodName = "messagingEngineStopping" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { messagingEngine , mode } ) ; } closeConnection ( messagingEngine ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Called to indicate that a messaging engine is stopping . Removes it from the set of active messaging engines and closes any open connection .
131
27
158,864
private SQLException classNotFound ( Object interfaceNames , Set < String > packagesSearched , String dsId , Throwable cause ) { if ( cause instanceof SQLException ) return ( SQLException ) cause ; // TODO need an appropriate message when sharedLib is null and classes are loaded from the application String sharedLibId = sharedLib . id ( ) ; // Determine the list of folders that should contain the JDBC driver files. Collection < String > driverJARs = getClasspath ( sharedLib , false ) ; String message = sharedLibId . startsWith ( "com.ibm.ws.jdbc.jdbcDriver-" ) ? AdapterUtil . getNLSMessage ( "DSRA4001.no.suitable.driver.nested" , interfaceNames , dsId , driverJARs , packagesSearched ) : AdapterUtil . getNLSMessage ( "DSRA4000.no.suitable.driver" , interfaceNames , dsId , sharedLibId , driverJARs , packagesSearched ) ; return new SQLNonTransientException ( message , cause ) ; }
Returns an exception to raise when the data source class is not found .
248
14
158,865
public ConnectionPoolDataSource createConnectionPoolDataSource ( Properties props , String dataSourceID ) throws SQLException { lock . readLock ( ) . lock ( ) ; try { if ( ! isInitialized ) try { // Switch to write lock for lazy initialization lock . readLock ( ) . unlock ( ) ; lock . writeLock ( ) . lock ( ) ; if ( ! isInitialized ) { if ( ! loadFromApp ( ) ) classloader = AdapterUtil . getClassLoaderWithPriv ( sharedLib ) ; isInitialized = true ; } } finally { // Downgrade to read lock for rest of method lock . readLock ( ) . lock ( ) ; lock . writeLock ( ) . unlock ( ) ; } String className = ( String ) properties . get ( ConnectionPoolDataSource . class . getName ( ) ) ; if ( className == null ) { String vendorPropertiesPID = props instanceof PropertyService ? ( ( PropertyService ) props ) . getFactoryPID ( ) : PropertyService . FACTORY_PID ; className = JDBCDrivers . getConnectionPoolDataSourceClassName ( vendorPropertiesPID ) ; if ( className == null ) { //if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated //they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource) if ( "com.ibm.ws.jdbc.dataSource.properties.oracle.ucp" . equals ( vendorPropertiesPID ) ) { throw new SQLNonTransientException ( AdapterUtil . getNLSMessage ( "DSRA4015.no.ucp.connection.pool.datasource" , dataSourceID , ConnectionPoolDataSource . class . getName ( ) ) ) ; } className = JDBCDrivers . getConnectionPoolDataSourceClassName ( getClasspath ( sharedLib , true ) ) ; if ( className == null ) { Set < String > packagesSearched = new LinkedHashSet < String > ( ) ; SimpleEntry < Integer , String > dsEntry = JDBCDrivers . inferDataSourceClassFromDriver // ( classloader , packagesSearched , JDBCDrivers . CONNECTION_POOL_DATA_SOURCE ) ; className = dsEntry == null ? null : dsEntry . getValue ( ) ; if ( className == null ) throw classNotFound ( ConnectionPoolDataSource . class . getName ( ) , packagesSearched , dataSourceID , null ) ; } } } return create ( className , props , dataSourceID ) ; } finally { lock . readLock ( ) . unlock ( ) ; } }
Create a ConnectionPoolDataSource
595
6
158,866
public DataSource createDataSource ( Properties props , String dataSourceID ) throws SQLException { lock . readLock ( ) . lock ( ) ; try { if ( ! isInitialized ) try { // Switch to write lock for lazy initialization lock . readLock ( ) . unlock ( ) ; lock . writeLock ( ) . lock ( ) ; if ( ! isInitialized ) { if ( ! loadFromApp ( ) ) classloader = AdapterUtil . getClassLoaderWithPriv ( sharedLib ) ; isInitialized = true ; } } finally { // Downgrade to read lock for rest of method lock . readLock ( ) . lock ( ) ; lock . writeLock ( ) . unlock ( ) ; } String className = ( String ) properties . get ( DataSource . class . getName ( ) ) ; if ( className == null ) { String vendorPropertiesPID = props instanceof PropertyService ? ( ( PropertyService ) props ) . getFactoryPID ( ) : PropertyService . FACTORY_PID ; className = JDBCDrivers . getDataSourceClassName ( vendorPropertiesPID ) ; if ( className == null ) { className = JDBCDrivers . getDataSourceClassName ( getClasspath ( sharedLib , true ) ) ; if ( className == null ) { Set < String > packagesSearched = new LinkedHashSet < String > ( ) ; SimpleEntry < Integer , String > dsEntry = JDBCDrivers . inferDataSourceClassFromDriver // ( classloader , packagesSearched , JDBCDrivers . DATA_SOURCE ) ; className = dsEntry == null ? null : dsEntry . getValue ( ) ; if ( className == null ) throw classNotFound ( DataSource . class . getName ( ) , packagesSearched , dataSourceID , null ) ; } } } return create ( className , props , dataSourceID ) ; } finally { lock . readLock ( ) . unlock ( ) ; } }
Create a DataSource
425
4
158,867
public Object getDriver ( String url , Properties props , String dataSourceID ) throws Exception { lock . readLock ( ) . lock ( ) ; try { if ( ! isInitialized ) try { // Switch to write lock for lazy initialization lock . readLock ( ) . unlock ( ) ; lock . writeLock ( ) . lock ( ) ; if ( ! isInitialized ) { if ( ! loadFromApp ( ) ) classloader = AdapterUtil . getClassLoaderWithPriv ( sharedLib ) ; isInitialized = true ; } } finally { // Downgrade to read lock for rest of method lock . readLock ( ) . lock ( ) ; lock . writeLock ( ) . unlock ( ) ; } final String className = ( String ) properties . get ( Driver . class . getName ( ) ) ; if ( className == null ) { String vendorPropertiesPID = props instanceof PropertyService ? ( ( PropertyService ) props ) . getFactoryPID ( ) : PropertyService . FACTORY_PID ; //if properties.oracle.ucp is configured do not search for driver impls because the customer has indicated //they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no Driver interface) if ( "com.ibm.ws.jdbc.dataSource.properties.oracle.ucp" . equals ( vendorPropertiesPID ) ) { throw new SQLNonTransientException ( AdapterUtil . getNLSMessage ( "DSRA4015.no.ucp.connection.pool.datasource" , dataSourceID , Driver . class . getName ( ) ) ) ; } } Driver driver = loadDriver ( className , url , classloader , props , dataSourceID ) ; if ( driver == null ) throw classNotFound ( Driver . class . getName ( ) , Collections . singleton ( "META-INF/services/java.sql.Driver" ) , dataSourceID , null ) ; return driver ; } finally { lock . readLock ( ) . unlock ( ) ; } }
Load the Driver instance for the specified URL .
447
9
158,868
public static Collection < String > getClasspath ( Library sharedLib , boolean upperCaseFileNamesOnly ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getClasspath" , sharedLib ) ; Collection < String > classpath = new LinkedList < String > ( ) ; if ( sharedLib != null && sharedLib . getFiles ( ) != null ) for ( File file : sharedLib . getFiles ( ) ) classpath . ( upperCaseFileNamesOnly ? file . getName ( ) . toUpperCase ( ) : file . getAbsolutePath ( ) ) ; if ( sharedLib != null && sharedLib . getFilesets ( ) != null ) for ( Fileset fileset : sharedLib . getFilesets ( ) ) for ( File file : fileset . getFileset ( ) ) classpath . ( upperCaseFileNamesOnly ? file . getName ( ) . toUpperCase ( ) : file . getAbsolutePath ( ) ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getClasspath" , classpath ) ; return classpath ; }
Returns a list of file names for the specified library .
261
11
158,869
private void modified ( Dictionary < String , ? > newProperties , boolean logMessage ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "modified" , newProperties ) ; boolean replaced = false ; lock . writeLock ( ) . lock ( ) ; try { if ( isInitialized ) { if ( classloader != null ) { if ( isDerbyEmbedded . compareAndSet ( true , false ) ) // assume false for any future usage until shown otherwise shutdownDerbyEmbedded ( ) ; classloader = null ; } for ( Iterator < Class < ? extends CommonDataSource > > it = introspectedClasses . iterator ( ) ; it . hasNext ( ) ; it . remove ( ) ) Introspector . flushFromCaches ( it . next ( ) ) ; replaced = true ; isInitialized = false ; } if ( newProperties != null ) properties = newProperties ; } finally { lock . writeLock ( ) . unlock ( ) ; } if ( replaced ) try { setChanged ( ) ; notifyObservers ( ) ; } catch ( Throwable x ) { FFDCFilter . processException ( x , getClass ( ) . getName ( ) , "254" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , x . getMessage ( ) , AdapterUtil . stackTraceToString ( x ) ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "modified" ) ; }
Clears the configuration of this JDBCDriverService so that it can lazily initialize with the new configuration on next use .
359
25
158,870
private static void setProperty ( Object obj , PropertyDescriptor pd , String value , boolean doTraceValue ) throws Exception { Object param = null ; String propName = pd . getName ( ) ; if ( tc . isDebugEnabled ( ) ) { if ( "URL" . equals ( propName ) || "url" . equals ( propName ) ) { Tr . debug ( tc , "set " + propName + " = " + PropertyService . filterURL ( value ) ) ; } else { Tr . debug ( tc , "set " + propName + " = " + ( doTraceValue ? value : "******" ) ) ; } } java . lang . reflect . Method setter = pd . getWriteMethod ( ) ; if ( setter == null ) throw new NoSuchMethodException ( AdapterUtil . getNLSMessage ( "NO_SETTER_METHOD" , propName ) ) ; Class < ? > paramType = setter . getParameterTypes ( ) [ 0 ] ; if ( ! paramType . isPrimitive ( ) ) { if ( paramType . equals ( String . class ) ) // the most common case: String param = value ; else if ( paramType . equals ( Properties . class ) ) // special case: Properties param = AdapterUtil . toProperties ( value ) ; else if ( paramType . equals ( Character . class ) ) // special case: Character param = Character . valueOf ( value . charAt ( 0 ) ) ; else // the generic case: any object with a single parameter String constructor param = paramType . getConstructor ( String . class ) . newInstance ( value ) ; } else if ( paramType . equals ( int . class ) ) param = Integer . valueOf ( value ) ; else if ( paramType . equals ( long . class ) ) param = Long . valueOf ( value ) ; else if ( paramType . equals ( boolean . class ) ) param = Boolean . valueOf ( value ) ; else if ( paramType . equals ( double . class ) ) param = Double . valueOf ( value ) ; else if ( paramType . equals ( float . class ) ) param = Float . valueOf ( value ) ; else if ( paramType . equals ( short . class ) ) param = Short . valueOf ( value ) ; else if ( paramType . equals ( byte . class ) ) param = Byte . valueOf ( value ) ; else if ( paramType . equals ( char . class ) ) param = Character . valueOf ( value . charAt ( 0 ) ) ; setter . invoke ( obj , new Object [ ] { param } ) ; }
Handles the setting of any property for which a public single - parameter setter exists on the DataSource and for which the property data type is either a primitive or has a single - parameter String constructor .
561
41
158,871
protected void setSharedLib ( Library lib ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "setSharedLib" , lib ) ; sharedLib = lib ; }
Declarative Services method for setting the SharedLibrary service
56
11
158,872
private void shutdownDerbyEmbedded ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "shutdownDerbyEmbedded" , classloader , embDerbyRefCount ) ; // Shut down Derby embedded if the reference count drops to 0 if ( embDerbyRefCount . remove ( classloader ) && ! embDerbyRefCount . contains ( classloader ) ) try { Class < ? > EmbDS = AdapterUtil . forNameWithPriv ( "org.apache.derby.jdbc.EmbeddedDataSource40" , true , classloader ) ; DataSource ds = ( DataSource ) EmbDS . newInstance ( ) ; EmbDS . getMethod ( "setShutdownDatabase" , String . class ) . invoke ( ds , "shutdown" ) ; ds . getConnection ( ) . close ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "shutdownDerbyEmbedded" ) ; } catch ( SQLException x ) { // expected for shutdown if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "shutdownDerbyEmbedded" , x . getSQLState ( ) + ' ' + x . getErrorCode ( ) + ' ' + x . getMessage ( ) ) ; } catch ( Throwable x ) { // Work around Derby issue when the JVM is shutting down while Derby shutdown is requested. if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "shutdownDerbyEmbedded" , x ) ; } else if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "shutdownDerbyEmbedded" , false ) ; }
Shut down the Derby system if the reference count for the class loader drops to 0 .
400
17
158,873
protected void unsetSharedLib ( Library lib ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "unsetSharedLib" , lib ) ; modified ( null , false ) ; }
Declarative Services method for unsetting the SharedLibrary service
60
12
158,874
public SIBusMessage nextLocked ( ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "nextLocked" ) ; JsMessage retMsg = null ; synchronized ( lmeOperationMonitor ) { checkValid ( ) ; // At this point we look at each item in the array up to end of the array for the next // non-null item. This is because some points in the array may be null if they have been // deleted or unlocked. while ( nextIndex != messages . length ) { retMsg = messages [ nextIndex ] ; nextIndex ++ ; if ( retMsg != null ) break ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "nextLocked" , retMsg ) ; return retMsg ; }
Returns the next available locked message in the enumeration . A value of null is returned if there is no next message .
247
24
158,875
public void unlockCurrent ( ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SIIncorrectCallException , SIMessageNotLockedException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "unlockCurrent" ) ; synchronized ( lmeOperationMonitor ) { checkValid ( ) ; // If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current // is invalid. Also, if the message is null, then we must have deleted - therefore also // invalid. if ( ( nextIndex == 0 ) || ( messages [ nextIndex - 1 ] == null ) ) { throw new SIIncorrectCallException ( nls . getFormattedMessage ( "LME_UNLOCK_INVALID_MSG_SICO1017" , null , null ) ) ; } JsMessage retMsg = messages [ nextIndex - 1 ] ; if ( CommsUtils . isRecoverable ( retMsg , consumerSession . getUnrecoverableReliability ( ) ) ) { convHelper . unlockSet ( new SIMessageHandle [ ] { retMsg . getMessageHandle ( ) } ) ; } messages [ nextIndex - 1 ] = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "unlockCurrent" ) ; }
Unlocks the current message .
347
6
158,876
public void deleteCurrent ( SITransaction transaction ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SILimitExceededException , SIIncorrectCallException , SIMessageNotLockedException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "deleteCurrent" , transaction ) ; synchronized ( lmeOperationMonitor ) { checkValid ( ) ; // If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current // is invalid. Also, if the message is null, then we must have deleted - therefore also // invalid. if ( ( nextIndex == 0 ) || ( messages [ nextIndex - 1 ] == null ) ) { throw new SIIncorrectCallException ( nls . getFormattedMessage ( "LME_DELETE_INVALID_MSG_SICO1018" , null , null ) ) ; } JsMessage retMsg = messages [ nextIndex - 1 ] ; // Only flow the delete if it would not have been done on the server already. // This will have been done if the message is determined to be 'unrecoverable'. if ( CommsUtils . isRecoverable ( retMsg , consumerSession . getUnrecoverableReliability ( ) ) ) { // Start d181719 JsMessage [ ] msgs = new JsMessage [ ] { retMsg } ; // f191114 if ( transaction != null ) { synchronized ( transaction ) { // Check transaction is in a valid state. // Enlisted for an XA UOW and not rolledback or // completed for a local transaction. if ( ! ( ( Transaction ) transaction ) . isValid ( ) ) { throw new SIIncorrectCallException ( nls . getFormattedMessage ( "TRANSACTION_COMPLETE_SICO1022" , null , null ) ) ; } deleteMessages ( msgs , transaction ) ; // f191114 } } else { deleteMessages ( msgs , null ) ; // f191114 } // End d181719 } // Now remove it from the LME messages [ nextIndex - 1 ] = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "deleteCurrent" ) ; }
Deletes the current message .
547
6
158,877
public void deleteSeen ( SITransaction transaction ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SILimitExceededException , SIIncorrectCallException , SIMessageNotLockedException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "deleteSeen" , transaction ) ; synchronized ( lmeOperationMonitor ) { checkValid ( ) ; // If we have seen any messages.... int numSeenMsgs = getSeenMessageCount ( ) ; if ( numSeenMsgs > 0 ) { // Start d181719 JsMessage [ ] seenRecoverableMessages = new JsMessage [ numSeenMsgs ] ; int numOfMessagesNeedingDeleting = 0 ; // Go through each seen message for ( int i = 0 ; i < nextIndex ; ++ i ) { if ( messages [ i ] != null ) { // Only add the message to the list of messages to delete if it is recoverable if ( CommsUtils . isRecoverable ( messages [ i ] , consumerSession . getUnrecoverableReliability ( ) ) ) // f177889 { // f177889 seenRecoverableMessages [ numOfMessagesNeedingDeleting ] = messages [ i ] ; // f177889 ++ numOfMessagesNeedingDeleting ; } // f177889 // Delete it from the main pile messages [ i ] = null ; } } if ( numOfMessagesNeedingDeleting > 0 ) { if ( transaction != null ) { synchronized ( transaction ) { // Check transaction is in a valid state. // Enlisted for an XA UOW and not rolledback or // completed for a local transaction. if ( ! ( ( Transaction ) transaction ) . isValid ( ) ) { throw new SIIncorrectCallException ( nls . getFormattedMessage ( "TRANSACTION_COMPLETE_SICO1022" , null , null ) ) ; } deleteMessages ( seenRecoverableMessages , transaction ) ; } } else { deleteMessages ( seenRecoverableMessages , null ) ; } } // End d181719 } // End f191114 } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "deleteSeen" ) ; }
Deletes all messages seen so far .
559
8
158,878
private void deleteMessages ( JsMessage [ ] messagesToDelete , SITransaction transaction ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SILimitExceededException , SIIncorrectCallException , SIMessageNotLockedException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "deleteMessages" ) ; int priority = JFapChannelConstants . PRIORITY_MEDIUM ; // d178368 if ( transaction != null ) { Transaction commsTransaction = ( Transaction ) transaction ; priority = commsTransaction . getLowestMessagePriority ( ) ; // d178368 // f181927 // Inform the transaction that our consumer session has deleted // a recoverable message under this transaction. This means that if // a rollback is performed (and strict rollback ordering is enabled) // we can ensure that this message will be redelivered in order. commsTransaction . associateConsumer ( consumerSession ) ; } // begin F219476.2 SIMessageHandle [ ] messageHandles = new SIMessageHandle [ messagesToDelete . length ] ; for ( int x = 0 ; x < messagesToDelete . length ; x ++ ) // f192215 { if ( messagesToDelete [ x ] != null ) { messageHandles [ x ] = messagesToDelete [ x ] . getMessageHandle ( ) ; } } convHelper . deleteMessages ( messageHandles , transaction , priority ) ; // d178368 // end F219476.2 // } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "deleteMessages" ) ; }
This private method actually performs the delete by asking the conversation helper to flow the request across the wire . However this method does not obtain any locks required to perform this operation and as such should be called by a method that does do this .
412
47
158,879
public void resetCursor ( ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "resetCursor" ) ; nextIndex = 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "resetCursor" ) ; }
This method will reset the cursor and allow the LME to be traversed again . Note that any messages that were deleted or unlocked will not be available again .
140
32
158,880
public int getRemainingMessageCount ( ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getRemainingMessageCount" ) ; checkValid ( ) ; int remain = getUnSeenMessageCount ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getRemainingMessageCount" , "" + remain ) ; return remain ; }
Returns the amount of messages left in the locked message enumeration .
147
13
158,881
private int getUnSeenMessageCount ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getUnseenMessageCount" ) ; int remain = 0 ; for ( int x = nextIndex ; x < messages . length ; x ++ ) { if ( messages [ x ] != null ) remain ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getUnseenMessageCount" , "" + remain ) ; return remain ; }
Private method to determine how many messages have not been seen as yet . It does this by looking at the number of non - null elements from the current item to the end of the array .
135
38
158,882
public void unlockUnseen ( ) throws SIResourceException , SIConnectionDroppedException , SIConnectionLostException , // F247845 SIIncorrectCallException , SIMessageNotLockedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "unlockUnseen" ) ; // The conversation helper needs a properly sized array of id's, so first create an array // that is as large as we'll ever need it to be, populate it and then resize it. SIMessageHandle [ ] idsToUnlock = new SIMessageHandle [ getUnSeenMessageCount ( ) ] ; int arrayPos = 0 ; for ( int startingIndex = nextIndex ; startingIndex < messages . length ; startingIndex ++ ) { if ( messages [ startingIndex ] != null ) { // Start F247845 if ( CommsUtils . isRecoverable ( messages [ startingIndex ] , consumerSession . getUnrecoverableReliability ( ) ) ) { idsToUnlock [ arrayPos ] = messages [ startingIndex ] . getMessageHandle ( ) ; arrayPos ++ ; } // End F247845 // Delete it from the main pile messages [ startingIndex ] = null ; } } //Resize array to prevent NPEs. if ( idsToUnlock . length != arrayPos ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "compacting array" ) ; final SIMessageHandle [ ] tempArray = new SIMessageHandle [ arrayPos ] ; System . arraycopy ( idsToUnlock , 0 , tempArray , 0 , arrayPos ) ; idsToUnlock = tempArray ; } convHelper . unlockSet ( idsToUnlock ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "unlockUnseen" ) ; }
begin F219476 . 2
445
6
158,883
public ConsumerSession getConsumerSession ( ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getConsumerSession" ) ; // f173765.2 checkValid ( ) ; // f173765.2 if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getConsumerSession" ) ; // f173765.2 return consumerSession ; }
Returns the consumer session this enumeration contains messages delivered to .
148
12
158,884
protected void markInvalid ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "markInvalid" ) ; invalid = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "markInvalid" ) ; }
Marks the enumeration as invalid . This is called once the asynchronous consumer callback returns to ensure that this locked message enumeration cannot be used from outside the callback .
86
33
158,885
public boolean shouldRedirectToHttps ( WebRequest webRequest ) { HttpServletRequest req = webRequest . getHttpServletRequest ( ) ; return ! req . isSecure ( ) && webRequest . isSSLRequired ( ) ; }
Determines if HTTPS redirect is required for this request .
53
12
158,886
public WebReply getHTTPSRedirectWebReply ( HttpServletRequest req ) { Integer httpsPort = ( Integer ) SRTServletRequestUtils . getPrivateAttribute ( req , "SecurityRedirectPort" ) ; if ( httpsPort == null ) { Tr . error ( tc , "SSL_PORT_IS_NULL" ) ; // return a 403 if we don't know what the port is return new DenyReply ( "Resource must be accessed with a secure connection try again using an HTTPS connection." ) ; } URL originalURL = null ; String urlString = null ; try { urlString = req . getRequestURL ( ) . toString ( ) ; originalURL = new URL ( urlString ) ; } catch ( MalformedURLException e ) { Tr . error ( tc , "SSL_REQ_URL_MALFORMED_EXCEPTION" , urlString ) ; // return a 403 if we can't construct the redirect URL return new DenyReply ( "Resource must be accessed with a secure connection try again using an HTTPS connection." ) ; } String queryString = req . getQueryString ( ) ; try { URL redirectURL = new URL ( "https" , originalURL . getHost ( ) , httpsPort , originalURL . getPath ( ) + ( queryString == null ? "" : "?" + queryString ) ) ; //don't add cookies during the redirect as this results in duplicated and incomplete //cookies on the client side return new RedirectReply ( redirectURL . toString ( ) , null ) ; } catch ( MalformedURLException e ) { Tr . error ( tc , "SSL_REQ_URL_MALFORMED_EXCEPTION" , "https" + originalURL . getHost ( ) + httpsPort + originalURL . getPath ( ) + ( queryString == null ? "" : "?" + queryString ) ) ; // return a 403 if we can't construct the redirect URL return new DenyReply ( "Resource must be accessed with a secure connection try again using an HTTPS connection." ) ; } }
Get the new URL for the redirect which contains the https port .
439
13
158,887
public void receive ( int requestNumber , int tran , long timeout ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "receive" , new Object [ ] { requestNumber , tran , timeout } ) ; if ( subConsumer == null ) { subConsumer = new CATSessSynchConsumer ( this ) ; } subConsumer . receive ( requestNumber , tran , timeout ) ; // f177889 // f187521.2.1 if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "receive" ) ; }
Performs a receive on this consumer . This is only a valid operation when the consumer is in synchronous mode . If the sub consumer has not been set up then this has to be created here .
155
40
158,888
public void unsetAsynchConsumerCallback ( int requestNumber , boolean stoppable ) //SIB0115d.comms { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "unsetAsynchConsumerCallback" , "requestNumber=" + requestNumber + ",stoppable=" + stoppable ) ; checkNotBrowserSession ( ) ; // F171893 if ( subConsumer != null ) { subConsumer . unsetAsynchConsumerCallback ( requestNumber , stoppable ) ; //SIB0115d.comms } subConsumer = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "unsetAsynchConsumerCallback" ) ; }
This method will unset the asynch consumer callback . This means that the client has requested that the session should be converted from asynchronous to synchronous and so the sub consumer must be changed
182
38
158,889
public void start ( int requestNumber , boolean deliverImmediately , boolean sendReply , SendListener sendListener ) { //471642 if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "start" , new Object [ ] { requestNumber , deliverImmediately , sendReply , sendListener } ) ; start ( requestNumber , deliverImmediately , sendReply , sendListener , false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "start" ) ; }
Start the consumer
137
3
158,890
public void setBifurcatedSession ( BifurcatedConsumerSession sess ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setBifurcatedSession" , sess ) ; subConsumer = new CATBifurcatedConsumer ( this , sess ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setBifurcatedSession" ) ; }
This method will put the main consumer into bifurcated mode .
127
15
158,891
private void tryRunNext ( ) { while ( runningSemaphore . tryAcquire ( ) ) { ExecutionTask execution = queue . poll ( ) ; if ( execution != null ) { // Note: we've removed the execution from the queue so we're committed to running it // if we fail to do so for any reason, we need to call the exception handler to fail the execution try { execution . submit ( ) ; } catch ( Throwable e ) { // Any exception here is unexpected runningSemaphore . release ( ) ; execution . exceptionHandler . handle ( e ) ; } } else { runningSemaphore . release ( ) ; break ; } } }
Attempt to run any queued executions
138
7
158,892
public final boolean removeExpirable ( Expirable expirable ) throws SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "removeExpirable" , "objId=" + ( expirable == null ? "null" : String . valueOf ( expirable . expirableGetID ( ) ) ) + " ET=" + ( expirable == null ? "null" : String . valueOf ( expirable . expirableGetExpiryTime ( ) ) ) + " addEnabled=" + addEnabled ) ; } boolean reply = false ; boolean cancelled = false ; // Ignore this request if the expirer has ended or the given entry is null synchronized ( lockObject ) { if ( addEnabled && expirable != null ) { long expiryTime = expirable . expirableGetExpiryTime ( ) ; ExpirableReference expirableRef = new ExpirableReference ( expirable ) ; expirableRef . setExpiryTime ( expiryTime ) ; // Remove the expirable from the expiry index reply = expiryIndex . remove ( expirableRef ) ; if ( reply && expiryIndex . size ( ) <= 0 ) // We just removed the last entry { if ( expiryAlarm != null ) { expiryAlarm . cancel ( ) ; alarmScheduled = false ; cancelled = true ; } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeExpirable" , "reply=" + reply + " cancelled=" + cancelled ) ; return reply ; }
Remove an Expirable reference for an item from the expiry index .
362
15
158,893
public final void start ( long expiryInterval , JsMessagingEngine jsme ) throws SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "start" , "interval=" + expiryInterval + " indexSize=" + expiryIndex . size ( ) ) ; messagingEngine = jsme ; if ( expiryInterval >= 0 ) // If an expiry interval was given, use it { interval = expiryInterval ; } else // Otherwise, get it from the system property { // Get property for expiry interval String value = messageStore . getProperty ( MessageStoreConstants . PROP_EXPIRY_INTERVAL , MessageStoreConstants . PROP_EXPIRY_INTERVAL_DEFAULT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "start" , "Value from property=<" + value + ">" ) ; try { this . interval = Long . parseLong ( value . trim ( ) ) ; } catch ( NumberFormatException e ) { // No FFDC Code Needed. lastException = e ; lastExceptionTime = timeNow ( ) ; SibTr . debug ( this , tc , "start" , "Unable to parse property: " + e ) ; this . interval = 1000 ; // Use hard coded default as last resort } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "start" , "expiryInterval=" + this . interval ) ; // about to tinker with various variables so take the lock now synchronized ( lockObject ) { if ( interval < 1 ) { runEnabled = false ; addEnabled = false ; } else { if ( expiryAlarm == null ) { runEnabled = true ; addEnabled = true ; expirerStartTime = timeNow ( ) ; // Now we look at the size of the index and only schedule the first // alarm if the index is not empty. Remember that expirables can be // added BEFORE the expirer is started so it may not be empty. if ( expiryIndex . size ( ) > 0 ) // If the index is not empty, { scheduleAlarm ( interval ) ; // ... schedule the first alarm. } } else { // Expiry thread already running if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Expiry already started" ) ; SevereMessageStoreException e = new SevereMessageStoreException ( "EXPIRY_THREAD_ALREADY_RUNNING_SIMS2004" ) ; lastException = e ; lastExceptionTime = timeNow ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "start" ) ; throw e ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "start" , "runEnabled=" + runEnabled + " addEnabled=" + addEnabled + " interval=" + interval ) ; }
Start the expiry daemon .
719
6
158,894
public final void stop ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "stop" ) ; synchronized ( lockObject ) { addEnabled = false ; // Prevent further expirables being added if ( runEnabled ) { runEnabled = false ; // This should terminate expiry expirerStopTime = timeNow ( ) ; } if ( expiryAlarm != null ) // Cancel any outstanding alarm { expiryAlarm . cancel ( ) ; expiryAlarm = null ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "stop" ) ; }
Stop the expiry daemon .
160
6
158,895
private final boolean remove ( ExpirableReference expirableRef , boolean expired ) { boolean reply = expiryIndex . remove ( ) ; if ( reply ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Removed (" + ( expired ? "expired" : "gone" ) + ")" + " ET=" + expirableRef . getExpiryTime ( ) + " objId=" + expirableRef . getID ( ) ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unable to remove from index: " + " ET=" + expirableRef . getExpiryTime ( ) + " objId=" + expirableRef . getID ( ) ) ; } return reply ; }
Remove the expirable reference from the expiry index . This will remove the current entry pointed - to by the iterator .
191
24
158,896
private int saveStartTime ( long time ) { int indexUsed = diagIndex ; alarmTime [ diagIndex ++ ] = time ; if ( diagIndex >= MAX_DIAG_LOG ) { diagIndex = 0 ; } return indexUsed ; }
Keep last n expiry cycle start times for diagnostic dump .
56
12
158,897
private void scheduleAlarm ( long timeOut ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "scheduleAlarm timeOut=" + timeOut ) ; // NB PM27294 implementation now means you cannot decrease the the timeOut if an alarm is already scheduled. // This is OK for the expirer as the timeout does not change once Expirer is started. synchronized ( lockObject ) { // if there is not an alarm already scheduled and there exists no thread that will go on to call scheduleAlarm then // create an alarm. if ( ! alarmScheduled && ! alarming ) { expiryAlarm = AlarmManager . createNonDeferrable ( timeOut , this ) ; alarmScheduled = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "scheduleAlarm" , alarmScheduled ) ; }
Schedule the next alarm . Callers of this method would typically hold lockObject already .
220
18
158,898
public void reset ( ) { expirationTimeFlag = UNSET ; inactivityFlag = UNSET ; idFlag = UNSET ; priorityFlag = UNSET ; sharingPolicyFlag = UNSET ; lock = UNSET ; id = null ; timeLimit = - 1 ; inactivity = - 1 ; expirationTime = - 1 ; validatorExpirationTime = - 1 ; priority = - 1 ; sharingPolicy = NOT_SHARED ; persistToDisk = true ; templates . clear ( ) ; template = null ; dataIds . clear ( ) ; aliasList . clear ( ) ; userMetaData = null ; entryInfoPool = null ; cacheType = CacheEntry . CACHE_TYPE_DEFAULT ; externalCacheGroupId = null ; }
resets this EntryInfo for reuse
155
7
158,899
public void setId ( Object id ) { if ( lock == SET ) { throw new IllegalStateException ( "EntryInfo is locked" ) ; } /*if (idFlag == SET) { if (tc.isDebugEnabled()) Tr.debug(tc, "Illegal State: tried to set id to "+id+ ", but id was already set to "+this.id ); throw new IllegalStateException("id was already set"); } */ idFlag = SET ; this . id = id ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "set id=" + id ) ; }
This sets the id variable .
128
6