idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,600
public static synchronized void initialise ( ) { // Only initialise if it has not already been created if ( _instance == null ) { // Check what environment we are running in. If we are in server mode we must use the // server diagnostic module. //Liberty COMMS TODO: //For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner // without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat // the purpose of COMMS client independence w.r.to COMMS server //Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server. /* if (RuntimeInfo.isServer()) { if (tc.isDebugEnabled()) SibTr.debug(tc, "We are in Server mode"); try { Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS); Method getInstanceMethod = clazz.getMethod("getInstance", new Class[0]); _instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null); } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".initialise", CommsConstants.COMMSDIAGMODULE_INITIALIZE_01, CommsConstants.SERVER_DIAG_MODULE_CLASS); if (tc.isDebugEnabled()) SibTr.debug(tc, "Unable to load the Comms Server Diagnostic Module", e); // In this case, fall out of here with a null _instance and default to the client // one. At least in that case we get _some_ diagnostics... // This is the point where I mention that that shouldn't ever happen :-). } } */ // In all other cases use the client diagnostic module. Note we can instantiate this // directly as we are located in the same build component if ( _instance == null ) { if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "We are NOT in Server mode" ) ; _instance = ClientCommsDiagnosticModule . getInstance ( ) ; } // Now register the packages _instance . register ( packageList ) ; } }
Initialises the diagnostic module .
502
6
161,601
public void ffdcDumpDefault ( Throwable t , IncidentStream is , Object callerThis , Object [ ] objs , String sourceId ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "ffdcDumpDefault" , new Object [ ] { t , is , callerThis , objs , sourceId } ) ; // Dump the SIB information super . ffdcDumpDefault ( t , is , callerThis , objs , sourceId ) ; is . writeLine ( "\n= ============= SIB Communications Diagnostic Information =============" , "" ) ; is . writeLine ( "Current Diagnostic Module: " , _instance ) ; dumpJFapClientStatus ( is ) ; dumpJFapServerStatus ( is ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "ffdcDumpDefault" ) ; }
Called when an FFDC is generated and the stack matches one of our packages .
200
17
161,602
boolean setObserver ( Observer observer ) { // F16043 boolean success ; Observer oldObserver ; synchronized ( this ) { oldObserver = ivObserver ; success = oldObserver != null || ! isDone ( ) ; ivObserver = success ? observer : null ; } if ( oldObserver != null ) { oldObserver . update ( null , observer ) ; } return success ; }
Sets the current observer and updates the pending one . If the result is already available the existing observer if any will be updated and passed the new observer as data . Otherwise the observer will be updated when the result is available and will be passed null as data .
85
52
161,603
private void cleanup ( ) { // d623593 final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "cleanup" ) ; synchronized ( ivRemoteAsyncResultReaper ) { if ( ivAddedToReaper ) { // d690014 // d690014.3 - The call to remove will remove the result from the // reaper and then call unexportObject itself. this . ivRemoteAsyncResultReaper . remove ( this ) ; } else { unexportObject ( ) ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "cleanup" ) ; }
Clean up all resources associated with this object .
161
9
161,604
RemoteAsyncResult exportObject ( ) throws RemoteException { ivObjectID = ivRemoteRuntime . activateAsyncResult ( ( Servant ) createTie ( ) ) ; return ivRemoteRuntime . getAsyncResultReference ( ivObjectID ) ; }
Export this object so that it is remotely accessible .
50
10
161,605
protected void unexportObject ( ) { // d623593 final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unexportObject: " + this ) ; if ( ivObjectID != null ) { // Either the allowed timeout occurred or a method was called and we // know that the client no longer needs this server resource. try { ivRemoteRuntime . deactivateAsyncResult ( ivObjectID ) ; } catch ( Throwable e ) { // We failed to unexport the object. This should never happen, but // it's not fatal. if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unexportObject exception" , e ) ; FFDCFilter . processException ( e , CLASS_NAME + ".unexportObject" , "237" , this ) ; } this . ivObjectID = null ; } }
Unexport this object so that it is not remotely accessible .
208
13
161,606
public BeanId find ( EJSHome home , Serializable pkey , boolean isHome ) { int hashValue = BeanId . computeHashValue ( home . j2eeName , pkey , isHome ) ; BeanId [ ] buckets = this . ivBuckets ; BeanId element = buckets [ ( hashValue & 0x7FFFFFFF ) % buckets . length ] ; if ( element == null || ! element . equals ( home , pkey , isHome ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { ++ ivCacheFinds ; Tr . debug ( tc , "BeanId not found in BeanId Cache : " + ivCacheHits + " / " + ivCacheFinds ) ; } element = new BeanId ( home , pkey , isHome ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { ++ ivCacheFinds ; ++ ivCacheHits ; Tr . debug ( tc , "BeanId found in BeanId Cache : " + ivCacheHits + " / " + ivCacheFinds ) ; } } return element ; }
d156807 . 3 Begins
257
6
161,607
protected boolean needsToBeRefreshed ( DefaultFacelet facelet ) { // if set to 0, constantly reload-- nocache if ( _refreshPeriod == NO_CACHE_DELAY ) { return true ; } // if set to -1, never reload if ( _refreshPeriod == INFINITE_DELAY ) { return false ; } long target = facelet . getCreateTime ( ) + _refreshPeriod ; if ( System . currentTimeMillis ( ) > target ) { // Should check for file modification URLConnection conn = null ; try { conn = facelet . getSource ( ) . openConnection ( ) ; long lastModified = ResourceLoaderUtils . getResourceLastModified ( conn ) ; return lastModified == 0 || lastModified > target ; } catch ( IOException e ) { throw new FaceletException ( "Error Checking Last Modified for " + facelet . getAlias ( ) , e ) ; } finally { // finally close input stream when finished, if fails just continue. if ( conn != null ) { try { InputStream is = conn . getInputStream ( ) ; if ( is != null ) { is . close ( ) ; } } catch ( IOException e ) { // Ignore } } } } return false ; }
Template method for determining if the Facelet needs to be refreshed .
276
13
161,608
int getState ( ) { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "getState" ) ; int state ; if ( ! prefixDone ) { // Somewhere in the prefix or at beginning and there is no prefix Pattern . Clause prefix = pattern . getPrefix ( ) ; if ( prefix == null || next >= prefix . items . length ) { // There is no prefix or we're at the end of it Pattern . Clause suffix = pattern . getSuffix ( ) ; // Answer depends on the suffix state = suffix == null ? FINAL_MANY : suffix == prefix ? FINAL_EXACT : SWITCH_TO_SUFFIX ; } else // We're somewhere in the body of the prefix state = prefix . items [ next ] == Pattern . matchOne ? SKIP_ONE_PREFIX : PREFIX_CHARS ; } else { // We're in the suffix Pattern . Clause suffix = pattern . getSuffix ( ) ; state = ( next < 0 ) ? FINAL_MANY : suffix . items [ next ] == Pattern . matchOne ? SKIP_ONE_SUFFIX : SUFFIX_CHARS ; } if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "getState" , new Integer ( state ) ) ; return state ; }
Get the state of this Pattern ( which item is next to process
285
13
161,609
void advance ( ) { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "advance" ) ; if ( ! prefixDone ) { Pattern . Clause prefix = pattern . getPrefix ( ) ; if ( prefix == null || next >= prefix . items . length ) { Pattern . Clause suffix = pattern . getSuffix ( ) ; if ( suffix != null && suffix != prefix ) { // SWITCH_TO_SUFFIX prefixDone = true ; next = suffix . items . length - 1 ; } // else in one of the FINAL_ states, so do nothing } else // somewhere in the body of the prefix, so advance by incrementing next ++ ; } else // somewhere in the suffix, so advance by decrementing next -- ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "advance" ) ; }
Advance the state of this pattern
190
7
161,610
char [ ] getChars ( ) { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "getChars" ) ; char [ ] ans ; if ( prefixDone ) ans = ( char [ ] ) pattern . getSuffix ( ) . items [ next -- ] ; else ans = ( char [ ] ) pattern . getPrefix ( ) . items [ next ++ ] ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "getChars" , new String ( ans ) ) ; return ans ; }
Get the characters and advance ( assumes the pattern is in one of the CHARS states
125
17
161,611
public boolean matchMidClauses ( char [ ] chars , int start , int length ) { return pattern . matchMiddle ( chars , start , start + length ) ; }
Test whether the underlying pattern s mid clauses match a set of characters .
35
14
161,612
public String extractPropertyFromURI ( String propName , String uri ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "extractPropertyFromURI" , new Object [ ] { propName , uri } ) ; String result = null ; // only something to do if uri is non-null & non-empty u if ( uri != null ) { uri = uri . trim ( ) ; if ( ! uri . equals ( "" ) ) { String [ ] parts = splitOnNonEscapedChar ( uri , ' ' , 2 ) ; // parts[1] (if present) is the NVPs, so only something to do if present & non-empty if ( parts . length >= 2 ) { String nvps = parts [ 1 ] . trim ( ) ; if ( ! nvps . equals ( "" ) ) { // break the nvps string into an array of name=value strings // Use a regular expression to split on an '&' only if it isn't preceeded by a '\'. String [ ] nvpArray = splitOnNonEscapedChar ( nvps , ' ' , - 1 ) ; // Search the array for the named property String propNameE = propName + "=" ; for ( int i = 0 ; i < nvpArray . length ; i ++ ) { String nvp = nvpArray [ i ] ; if ( nvp . startsWith ( propNameE ) ) { // everything after the = is the value result = nvp . substring ( propNameE . length ( ) ) ; break ; // exit the loop } } } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "extractPropertyFromURI" , result ) ; return result ; }
Extract the value of the named property from URI . Find the named property in the name value pairs of the uri and return the value or null if the property is not present .
414
37
161,613
private String unescape ( String input , char c ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "unescape" , new Object [ ] { input , c } ) ; String result = input ; // if there are no instances of c in the String we can just return the original if ( input . indexOf ( c ) != - 1 ) { int startValue = 0 ; StringBuffer temp = new StringBuffer ( input ) ; String cStr = new String ( new char [ ] { c } ) ; while ( ( startValue = temp . indexOf ( cStr , startValue ) ) != - 1 ) { if ( startValue > 0 && temp . charAt ( startValue - 1 ) == ' ' ) { // remove the preceding slash to leave the escaped character temp . deleteCharAt ( startValue - 1 ) ; } else { startValue ++ ; } } result = temp . toString ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "unescape" , result ) ; return result ; }
Remove \ characters from input String when they precede specified character .
257
13
161,614
private String unescapeBackslash ( String input ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "unescapeBackslash" , input ) ; String result = input ; // If there are no backslashes then don't bother creating the buffer etc. if ( input . indexOf ( "\\" ) != - 1 ) { int startValue = 0 ; StringBuffer tmp = new StringBuffer ( input ) ; while ( ( startValue = tmp . indexOf ( "\\" , startValue ) ) != - 1 ) { // check that the next character is also a \ if ( startValue + 1 < tmp . length ( ) && tmp . charAt ( startValue + 1 ) == ' ' ) { // remove the first slash tmp . deleteCharAt ( startValue ) ; // increment startValue so that the next indexOf begins after the second slash startValue ++ ; } else { // we've found a single \, so throw an exception throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "BAD_ESCAPE_CHAR_CWSIA0387" , new Object [ ] { input } , tc ) ; } } result = tmp . toString ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "unescapeBackslash" , result ) ; return result ; }
Convert escaped backslash to single backslash . This method de - escapes double backslashes whilst at the same time checking that there are no single backslahes in the input string .
332
40
161,615
private String [ ] validateNVP ( String namePart , String valuePart , String uri , JmsDestination dest ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "validateNVP" , new Object [ ] { namePart , valuePart , uri , dest } ) ; // de-escape any escaped &s in the value (we define names, so no & there) if ( valuePart . indexOf ( ' ' ) != - 1 ) { valuePart = valuePart . replaceAll ( "\\\\&" , "&" ) ; } // The only valid escape sequence that should be left is "\\" which // transforms to a single '\' valuePart = unescapeBackslash ( valuePart ) ; // Performing mapping from MA88 names to Jetstream names. // If the name part is any of the following MA88 properties, we leave it because // there is no direct Jetstream equivalent for the property: // 'CCSID', 'encoding', 'brokerDurSubQueue', 'brokerCCDurSubQueue', 'multicast'. // In this event, the unknown property will be silently ignored, and NOT throw an exception. if ( namePart . equalsIgnoreCase ( MA88_EXPIRY ) ) { namePart = JmsInternalConstants . TIME_TO_LIVE ; } if ( namePart . equalsIgnoreCase ( MA88_PERSISTENCE ) ) { namePart = JmsInternalConstants . DELIVERY_MODE ; // map between the MA88 Integer values and the Jetstream String values if ( valuePart . equals ( "1" ) ) { valuePart = ApiJmsConstants . DELIVERY_MODE_NONPERSISTENT ; } else if ( valuePart . equals ( "2" ) ) { valuePart = ApiJmsConstants . DELIVERY_MODE_PERSISTENT ; } else { valuePart = ApiJmsConstants . DELIVERY_MODE_APP ; } } // create a new String[] and populate it with the newly validated element, then return. String [ ] result = new String [ ] { namePart , valuePart } ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "validateNVP" , result ) ; return result ; }
This utility method performs the validation on the name and value parts of the NVP . It performs several checks to make sure that neither part contain any illegal characters unless they are escaped by a backslash .
531
41
161,616
public Destination createDestinationFromURI ( String uri , int qmProcessing ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createDestinationFromURI" , new Object [ ] { uri , qmProcessing } ) ; Destination result = null ; if ( uri != null ) { result = processURI ( uri , qmProcessing , null ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createDestinationFromURI" , result ) ; return result ; }
Create a Destination object from a full URI format String .
153
11
161,617
private static boolean charIsEscaped ( String str , int index ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "charIsEscaped" , new Object [ ] { str , index } ) ; // precondition, null str or out of range index returns false. if ( str == null || index < 0 || index >= str . length ( ) ) return false ; // A character is escaped if it is preceded by an odd number of '\'s. int nEscape = 0 ; int i = index - 1 ; while ( i >= 0 && str . charAt ( i ) == ' ' ) { nEscape ++ ; i -- ; } boolean result = nEscape % 2 == 1 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "charIsEscaped" , result ) ; return result ; }
Test if the specified character is escaped . Checks whether the character at the specified index is preceded by an escape character . The test is non - trivial because it has to check that the escape character is itself non - escaped .
211
44
161,618
public static PrivateKey readPrivateKey ( String pemResName ) throws Exception { InputStream contentIS = TokenUtils . class . getResourceAsStream ( pemResName ) ; byte [ ] tmp = new byte [ 4096 ] ; int length = contentIS . read ( tmp ) ; PrivateKey privateKey = decodePrivateKey ( new String ( tmp , 0 , length ) ) ; return privateKey ; }
Read a PEM encoded private key from the classpath
86
11
161,619
public static PublicKey readPublicKey ( String pemResName ) throws Exception { InputStream contentIS = TokenUtils . class . getResourceAsStream ( pemResName ) ; byte [ ] tmp = new byte [ 4096 ] ; int length = contentIS . read ( tmp ) ; PublicKey publicKey = decodePublicKey ( new String ( tmp , 0 , length ) ) ; return publicKey ; }
Read a PEM encoded public key from the classpath
86
11
161,620
public static KeyPair generateKeyPair ( int keySize ) throws NoSuchAlgorithmException { KeyPairGenerator keyPairGenerator = KeyPairGenerator . getInstance ( "RSA" ) ; keyPairGenerator . initialize ( keySize ) ; KeyPair keyPair = keyPairGenerator . genKeyPair ( ) ; return keyPair ; }
Generate a new RSA keypair .
85
8
161,621
public static PrivateKey decodePrivateKey ( String pemEncoded ) throws Exception { pemEncoded = removeBeginEnd ( pemEncoded ) ; byte [ ] pkcs8EncodedBytes = Base64 . getDecoder ( ) . decode ( pemEncoded ) ; // extract the private key PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec ( pkcs8EncodedBytes ) ; KeyFactory kf = KeyFactory . getInstance ( "RSA" ) ; PrivateKey privKey = kf . generatePrivate ( keySpec ) ; return privKey ; }
Decode a PEM encoded private key string to an RSA PrivateKey
130
14
161,622
public static PublicKey decodePublicKey ( String pemEncoded ) throws Exception { pemEncoded = removeBeginEnd ( pemEncoded ) ; byte [ ] encodedBytes = Base64 . getDecoder ( ) . decode ( pemEncoded ) ; X509EncodedKeySpec spec = new X509EncodedKeySpec ( encodedBytes ) ; KeyFactory kf = KeyFactory . getInstance ( "RSA" ) ; return kf . generatePublic ( spec ) ; }
Decode a PEM encoded public key string to an RSA PublicKey
103
14
161,623
public void registerDeferredService ( BundleContext bundleContext , Class < ? > providedService , Dictionary dict ) { Object obj = serviceReg . get ( ) ; if ( obj instanceof ServiceRegistration < ? > ) { // already registered - nothing to do here return ; } if ( obj instanceof CountDownLatch ) { // another thread is in the process of (de)registering - wait for it to finish try { ( ( CountDownLatch ) obj ) . await ( ) ; if ( serviceReg . get ( ) instanceof ServiceRegistration < ? > ) { // Another thread has successfully registered to return out (so we don't go // into recursive loop). return ; } } catch ( InterruptedException swallowed ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Count down interrrupted" , swallowed ) ; } } } else { // This is probably the first thread to register. // Claim the right to register by setting a latch for other threads to wait on. CountDownLatch latch = new CountDownLatch ( 1 ) ; if ( serviceReg . compareAndSet ( null , latch ) ) { // This thread won the right to register the service try { serviceReg . set ( bundleContext . registerService ( providedService . getName ( ) , this , dict ) ) ; // successfully registered - nothing more to do return ; } finally { // if the serviceReg was not updated for any reason, we need to set it back to null serviceReg . compareAndSet ( latch , null ) ; // in any case we need to allow any blocked threads to proceed latch . countDown ( ) ; } } } // If we get to here we have not successfully registered // nor seen another thread successfully register, so just recurse. registerDeferredService ( bundleContext , providedService , dict ) ; }
Register information available after class loader is created for use by RAR bundle
385
14
161,624
public void deregisterDeferredService ( ) { Object obj = serviceReg . get ( ) ; if ( obj == null ) { // already deregistered so there is nothing to be done return ; } if ( obj instanceof CountDownLatch ) { // If someone else has the latch, then let them do whatever they are doing and we pretend // we've already done the deregister. return ; } else if ( obj instanceof ServiceRegistration < ? > ) { CountDownLatch latch = new CountDownLatch ( 1 ) ; if ( serviceReg . compareAndSet ( obj , latch ) ) { // This thread won the right to deregister the service try { ( ( ServiceRegistration < ? > ) obj ) . unregister ( ) ; // successfully deregistered - nothing more to do return ; } finally { // if the serviceReg was not updated for any reason, we need to restore the previous value serviceReg . compareAndSet ( latch , obj ) ; // in any case we need to allow any blocked threads to proceed latch . countDown ( ) ; } } } }
Unregister information provided after class loader was created
224
9
161,625
public SELF withConfigOption ( String key , String value ) { if ( key == null ) { throw new java . lang . NullPointerException ( "key marked @NonNull but is null" ) ; } if ( value == null ) { throw new java . lang . NullPointerException ( "value marked @NonNull but is null" ) ; } options . put ( key , value ) ; return self ( ) ; }
Add additional configuration options that should be used for this container .
91
12
161,626
public StateStream getStateStream ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "getStateStream" ) ; SibTr . exit ( tc , "getStateStream" , oststream ) ; } return oststream ; }
Used for debug
72
3
161,627
public boolean writeSilence ( SIMPMessage m ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeSilence" , new Object [ ] { m } ) ; boolean sendMessage = true ; JsMessage jsMsg = m . getMessage ( ) ; // There may be Completed ticks after the Value, if so then // write these into the stream too long stamp = jsMsg . getGuaranteedValueValueTick ( ) ; long start = jsMsg . getGuaranteedValueStartTick ( ) ; long end = jsMsg . getGuaranteedValueEndTick ( ) ; if ( end < stamp ) end = stamp ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilence from: " + start + " to " + end + " on Stream " + stream ) ; } TickRange tr = new TickRange ( TickRange . Completed , start , end ) ; // used to send message if it moves inside inDoubt window List sendList = null ; synchronized ( this ) { oststream . writeCompletedRange ( tr ) ; sendMessage = msgCanBeSent ( stamp , false ) ; if ( sendMessage ) { if ( stamp > lastMsgSent ) lastMsgSent = stamp ; } // Check whether removing this message means we have // a message to send TickRange tr1 = null ; if ( ( tr1 = msgRemoved ( stamp , oststream , null ) ) != null ) { sendList = new ArrayList ( ) ; sendList . add ( tr1 ) ; if ( tr1 . valuestamp > lastMsgSent ) lastMsgSent = tr1 . valuestamp ; } // SIB0105 // Message silenced so reset the health state if we've solved a blocking problem if ( blockedStreamAlarm != null ) blockedStreamAlarm . checkState ( false ) ; } // synchronized // Do the send outside of the synchronise if ( sendList != null ) { sendMsgs ( sendList , false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilence" ) ; return sendMessage ; }
This method uses a Value message to write Silence into the stream because a message has been rolled back
502
19
161,628
public boolean writeSilenceForced ( SIMPMessage m ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeSilenceForced" , new Object [ ] { m } ) ; boolean msgRemoved = true ; JsMessage jsMsg = m . getMessage ( ) ; long start = jsMsg . getGuaranteedValueStartTick ( ) ; long end = jsMsg . getGuaranteedValueEndTick ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilenceForced from: " + start + " to " + end + " on Stream " + stream ) ; } TickRange tr = new TickRange ( TickRange . Completed , start , end ) ; // used to send message if it moves inside inDoubt window List sendList = null ; synchronized ( this ) { // If the tick of the new silence has already been set to completed then // the message must already have been processed (either sent+acked or already // silenced) either way, we should class it as a 'removed' message. // This fixes a problem where a message is nacked,sent and acked all in the // window between setting it as a value and actually trying to lock it (in PtoPOutputHandler) // prior to sending it. In this situation, the message no longer exists in the // MsgStore, so PtoPOutputHandler believed it had expired, which then calls this // method to try to remove it - decrementing the totalMessage count and messing // up future sendWindow calculations (which can leave messages left unsent). if ( end <= getCompletedPrefix ( ) ) { msgRemoved = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Message " + end + " already completed" , m ) ; } else { oststream . writeCompletedRangeForced ( tr ) ; // Check whether removing this message means we have // a message to send TickRange str = null ; if ( ( str = msgRemoved ( jsMsg . getGuaranteedValueValueTick ( ) , oststream , null ) ) != null ) { sendList = new LinkedList ( ) ; sendList . add ( str ) ; if ( str . valuestamp > lastMsgSent ) lastMsgSent = str . valuestamp ; } } } // Do the send outside of the synchronise if ( sendList != null ) { sendMsgs ( sendList , false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilenceForced" , Boolean . valueOf ( msgRemoved ) ) ; return msgRemoved ; }
This method uses a Value message to write Silence into the stream because a message which was a Guess is being removed from the stream It forces the stream to be updated to Silence without checking the existing state
629
39
161,629
public void writeSilenceForced ( TickRange vtr ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeSilenceForced" , new Object [ ] { vtr } ) ; long start = vtr . startstamp ; long end = vtr . endstamp ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilenceForced from: " + start + " to " + end + " on Stream " + stream ) ; } TickRange tr = new TickRange ( TickRange . Completed , start , end ) ; // used to send message if it moves inside inDoubt window List sendList = null ; synchronized ( this ) { oststream . writeCompletedRangeForced ( tr ) ; // Check whether removing this message means we have // a message to send TickRange str = null ; if ( ( str = msgRemoved ( vtr . valuestamp , oststream , null ) ) != null ) { sendList = new LinkedList ( ) ; sendList . add ( str ) ; if ( str . valuestamp > lastMsgSent ) lastMsgSent = str . valuestamp ; } } // Do the send outside of the synchronise if ( sendList != null ) { sendMsgs ( sendList , false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilenceForced" ) ; }
This method uses a Value TickRange to write Silence into the stream because a message has expired before it was sent and so needs to be removed from the stream It forces the stream to be updated to Silence without checking the existing state
354
45
161,630
public void writeSilenceForced ( long tick ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeSilenceForced" , Long . valueOf ( tick ) ) ; // Details of the new silence long startTick = - 1 ; long endTick = - 1 ; long completedPrefix = - 1 ; // used to send message if it moves inside inDoubt window List sendList = null ; synchronized ( this ) { oststream . setCursor ( tick ) ; // Get the TickRange containing this tick TickRange tr = oststream . getNext ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilenceForced from: " + tr . startstamp + " to " + tr . endstamp + " on Stream " + stream ) ; } TickRange silenceRange = oststream . writeCompletedRangeForced ( tr ) ; // While we have the stream locked cache the details of the new completed // range if ( silenceRange != null ) { startTick = silenceRange . startstamp ; endTick = silenceRange . endstamp ; completedPrefix = getCompletedPrefix ( ) ; } // Check whether removing this message means we have // a message to send TickRange str = null ; if ( ( str = msgRemoved ( tick , oststream , null ) ) != null ) { sendList = new LinkedList ( ) ; sendList . add ( str ) ; if ( str . valuestamp > lastMsgSent ) lastMsgSent = str . valuestamp ; } } // Do the send outside of the synchronise // If we created a new completed (silenced) range then we actually send this to the // target ME. If we don't do this it's possible for the target to never realise that // this message has been explicitly deleted (via the MBeans), and therefore, if there's // a problem with the message it will never know to give up trying to process it, which // could leave the stream blocked until an ME re-start. if ( startTick != - 1 ) { downControl . sendSilenceMessage ( startTick , endTick , completedPrefix , false , priority , reliability , stream ) ; } if ( sendList != null ) { sendMsgs ( sendList , false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilenceForced" ) ; }
This replaces the specified tick with Silence without checking the existing state
570
12
161,631
public void restoreUncommitted ( SIMPMessage m ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "restoreUncommitted" , new Object [ ] { m } ) ; TickRange tr = null ; JsMessage jsMsg = m . getMessage ( ) ; long stamp = jsMsg . getGuaranteedValueValueTick ( ) ; long starts = jsMsg . getGuaranteedValueStartTick ( ) ; long ends = jsMsg . getGuaranteedValueEndTick ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "restoreUncommitted at: " + stamp + " on Stream " + stream ) ; } synchronized ( this ) { // write into stream tr = TickRange . newUncommittedTick ( stamp ) ; tr . startstamp = starts ; tr . endstamp = ends ; // Save message in the stream while it is Uncommitted // It will be replaced by its index in the ItemStream once it becomes a Value tr . value = m ; oststream . writeCombinedRange ( tr ) ; } // end synchronized if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "restoreUncommitted" ) ; }
This method uses a Value message to write an Uncommitted tick into the stream . It is called at retore time .
311
25
161,632
public void restoreValue ( SIMPMessage m ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "restoreValue" , m ) ; TickRange tr = null ; long msgStoreId = AbstractItem . NO_ID ; try { if ( m . isInStore ( ) ) msgStoreId = m . getID ( ) ; } catch ( MessageStoreException e ) { // FFDC FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.gd.SourceStream.restoreValue" , "1:1484:1.138" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "restoreValue" , e ) ; throw new SIResourceException ( e ) ; } JsMessage jsMsg = m . getMessage ( ) ; long stamp = jsMsg . getGuaranteedValueValueTick ( ) ; long starts = jsMsg . getGuaranteedValueStartTick ( ) ; long ends = jsMsg . getGuaranteedValueEndTick ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "restoreValue at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + stream ) ; } synchronized ( this ) { // Now update Value tick to indicate it is now committed tr = TickRange . newValueTick ( stamp , null , msgStoreId ) ; tr . startstamp = starts ; tr . endstamp = ends ; oststream . writeCombinedRange ( tr ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "restoreValue" ) ; }
This method uses a Value message to write a Value tick into the stream . It is called at retore time .
445
23
161,633
public synchronized void newGuessInStream ( long tick ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "newGuessInStream" , new Object [ ] { Long . valueOf ( tick ) , Boolean . valueOf ( containsGuesses ) , Long . valueOf ( sendWindow ) , Long . valueOf ( totalMessages ) , Long . valueOf ( firstMsgOutsideWindow ) } ) ; // If this is the first guess in the stream if ( ! containsGuesses ) { containsGuesses = true ; if ( sendWindow > totalMessages ) { sendWindow = totalMessages ; persistSendWindow ( sendWindow , null ) ; firstMsgOutsideWindow = tick ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "newGuessInStream" , new Object [ ] { Boolean . valueOf ( containsGuesses ) , Long . valueOf ( sendWindow ) , Long . valueOf ( firstMsgOutsideWindow ) } ) ; }
Also called by writeUncomitted when a guess is written into the stream
248
15
161,634
public synchronized void guessesInStream ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "guessesInStream" , Boolean . valueOf ( containsGuesses ) ) ; containsGuesses = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "guessesInStream" , Boolean . valueOf ( containsGuesses ) ) ; }
any messages while some are being reallocated
112
9
161,635
public synchronized void noGuessesInStream ( ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "noGuessesInStream" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "oldContainesGuesses:" + containsGuesses + "firstMsgOutsideWindow: " + firstMsgOutsideWindow + ", oldSendWindow: " + sendWindow ) ; containsGuesses = false ; // If we have reduced our sendWindow below the definedSendWindow // we now need to send all the messages between the two if ( definedSendWindow > sendWindow ) { long oldSendWindow = sendWindow ; sendWindow = definedSendWindow ; persistSendWindow ( sendWindow , null ) ; // Send the messages up to the new send window // this will update firstMsgOutsideWindow sendMsgsInWindow ( oldSendWindow , sendWindow ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "no processing : definedSendWindow=" + definedSendWindow + ", sendWindow=" + sendWindow ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "noGuessesInStream" ) ; }
ours to send
317
3
161,636
public synchronized void initialiseSendWindow ( long sendWindow , long definedSendWindow ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "initialiseSendWindow" , new Object [ ] { Long . valueOf ( sendWindow ) , Long . valueOf ( definedSendWindow ) } ) ; // Prior to V7 the sendWindow was not persisted unless it was modified due to a change in // reachability, otherwise it was stored as INFINITY (Long.MAX_VALUE). Therefore, if the // defined sendWindow was modified we could be in the situation where before a restart we // had 1000 messages indoubt, then shut the ME down, changes the defined sendWindow to 50 // and restarted. At that point we'd set the sendWindow to 50 and suddenly we'd have 950 // available messages again (not indoubt). We'd then be allowed to reallocate them elsewhere! // Luckily, the ability to modify the sendWindow wasn't correctly exposed prior to V7 (it's // now a custom property), so no-one could have modified it. So, we can interpret a value // of INFINITY as the original sendWindow value, which is 1000. And use that when we see it. if ( sendWindow == RangeList . INFINITY ) { this . definedSendWindow = definedSendWindow ; this . sendWindow = 1000 ; // Original default sendWindow // Now persist the 1000 to make it clearer persistSendWindow ( this . sendWindow , null ) ; } else { this . sendWindow = sendWindow ; this . definedSendWindow = definedSendWindow ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "initialiseSendWindow" ) ; }
this value straight away and also that we don t need to persist it
394
14
161,637
public synchronized void setDefinedSendWindow ( long newSendWindow ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setDefinedSendWindow" , Long . valueOf ( newSendWindow ) ) ; definedSendWindow = newSendWindow ; // PK41355 - Commenting out - should not be sending stuff at reconstitute // updateAndPersistSendWindow(); if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setDefinedSendWindow" , Long . valueOf ( newSendWindow ) ) ; }
This is used to set the sendWindow defined in Admin panels
148
12
161,638
public synchronized void updateAndPersistSendWindow ( ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "updateAndPersistSendWindow" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "definedSendWindow is: " + definedSendWindow + " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses + " totalMessages is " + totalMessages ) ; } // If our current sendWindow is less than this new value // we can move to the new value straight away and send // any messages which were between the two if ( definedSendWindow > sendWindow ) { // If the stream containsGuesses we can't send // anything at the moment so we do the code // below in noGuessesInStream() instead if ( ! containsGuesses ) { long oldSendWindow = sendWindow ; sendWindow = definedSendWindow ; persistSendWindow ( sendWindow , null ) ; // Send the messages up to the new send window // this will update firstMsgOutsideWindow sendMsgsInWindow ( oldSendWindow , sendWindow ) ; } } else { // sendWindow is being reduced if ( definedSendWindow > totalMessages ) { // sendWindow is being reduced but is bigger than // totalMessages so we can just set it sendWindow = definedSendWindow ; persistSendWindow ( sendWindow , null ) ; } else if ( totalMessages < sendWindow ) { sendWindow = totalMessages ; persistSendWindow ( sendWindow , null ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "updateAndPersistSendWindow" ) ; }
ONLY called from tests
401
5
161,639
private synchronized boolean msgCanBeSent ( long stamp , boolean nackMsg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "msgCanBeSent" , new Object [ ] { Long . valueOf ( stamp ) , Boolean . valueOf ( nackMsg ) , Long . valueOf ( firstMsgOutsideWindow ) , Boolean . valueOf ( containsGuesses ) } ) ; boolean sendMessage = true ; // Check whether we can send the message // Don't send any messages once there is a guess in the stream (unless a NACK) if ( ( stamp >= firstMsgOutsideWindow ) || ( containsGuesses && ! nackMsg ) ) { sendMessage = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "firstMsgOutsideWindow is: " + firstMsgOutsideWindow + " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "msgCanBeSent" , Boolean . valueOf ( sendMessage ) ) ; return sendMessage ; }
Method that determines if the message can be sent .
281
10
161,640
private synchronized TickRange msgRemoved ( long tick , StateStream ststream , TransactionCommon tran ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "msgRemoved" , new Object [ ] { Long . valueOf ( tick ) , ststream , tran } ) ; TickRange tr1 = null ; boolean sendMessage = false ; long stamp = tick ; // We know we have reduced the number of messages in the stream totalMessages -- ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "totalMessages: " + totalMessages + ", sendWindow: " + sendWindow + ", definedSendWindow: " + definedSendWindow + ", firstMsgOutsideSendWindow: " + firstMsgOutsideWindow ) ; // We may not send any messages if our stream contains guesses // or if we are supposed to be reducing the sendWindow if ( ( ( containsGuesses ) || ( sendWindow > definedSendWindow ) ) && ( stamp < firstMsgOutsideWindow ) ) { // Just shrink the sendWindow if ( sendWindow > 0 ) { sendWindow -- ; persistSendWindow ( sendWindow , tran ) ; } } else { // If the message we have just removed from the stream was // inside the sendWindow then we can move up our // firstMsgOutsideWindow and possibly send the message which // moves inside the window // If it actually was the first message outside the window // the code below will also work // If it was beyond the window we can afford to ignore it if ( stamp <= firstMsgOutsideWindow ) { // send firstMsgOutsideWindow // first need to get it and check that it is in Value state ststream . setCursor ( firstMsgOutsideWindow ) ; // Get the first TickRange outside the inDoubt window tr1 = ststream . getNext ( ) ; // This range must be either Uncommitted or Value as that is how // we set the firstMsgOutsideWindow pointer // Only want to send this message if it is // committed. Otherwise do nothing as it will // get sent when it commits if ( tr1 . type == TickRange . Value ) { sendMessage = true ; } TickRange tr = null ; if ( totalMessages > sendWindow ) { // Get the next Value or Uncommitted tick from the stream tr = ststream . getNext ( ) ; while ( tr . type == TickRange . Completed && tr . endstamp != RangeList . INFINITY ) { tr = ststream . getNext ( ) ; } firstMsgOutsideWindow = tr . valuestamp ; } // That was the last message outside the send window, so put us back into a state // ignorant of guesses, otherwise we may not realise to re-calculate the firstMsgOutSideWindow // the next time we get a guess. else { firstMsgOutsideWindow = RangeList . INFINITY ; containsGuesses = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "firstMsgOutsideSendWindow: " + firstMsgOutsideWindow ) ; } } // Return a null if nothing to send if ( ! sendMessage ) tr1 = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "msgRemoved" , tr1 ) ; return tr1 ; }
This method is called when the totalMessages on the stream falls and we have the possibility of sending a message because it is now inside the sendWindow
754
30
161,641
public synchronized List getAllMessagesOnStream ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getAllMessagesOnStream" ) ; List < Long > msgs = new LinkedList < Long > ( ) ; oststream . setCursor ( 0 ) ; // Get the first TickRange TickRange tr = oststream . getNext ( ) ; while ( tr . endstamp < RangeList . INFINITY ) { if ( tr . type == TickRange . Value ) { msgs . add ( Long . valueOf ( tr . itemStreamIndex ) ) ; } if ( tr . type == TickRange . Uncommitted ) { // Reallocator needs to be run again when this commits tr . reallocateOnCommit ( ) ; } tr = oststream . getNext ( ) ; } // end while if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAllMessagesOnStream" ) ; return Collections . unmodifiableList ( msgs ) ; }
Get an unmodifiable list of all of the messages in the VALUE state on this stream
249
19
161,642
public synchronized List < TickRange > getAllMessageItemsOnStream ( boolean includeUncommitted ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getAllMessageItemsOnStream" , Boolean . valueOf ( includeUncommitted ) ) ; List < TickRange > msgs = new LinkedList < TickRange > ( ) ; oststream . setCursor ( 0 ) ; // Get the first TickRange TickRange tr = oststream . getNext ( ) ; while ( tr . endstamp < RangeList . INFINITY ) { if ( tr . type == TickRange . Value ) { //get this msg from the downstream control msgs . add ( ( TickRange ) tr . clone ( ) ) ; } else if ( tr . type == TickRange . Uncommitted && includeUncommitted ) { //get this msg directly if ( tr . value != null ) msgs . add ( ( TickRange ) tr . clone ( ) ) ; } tr = oststream . getNext ( ) ; } // end while if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAllMessageItemsOnStream" , msgs ) ; return Collections . unmodifiableList ( msgs ) ; }
Get an unmodifiable list of all of the message items in the VALUE state on this stream and optionally in the Uncommitted state
292
28
161,643
public synchronized TickRange getTickRange ( long tick ) { oststream . setCursor ( tick ) ; // Get the TickRange return ( TickRange ) oststream . getNext ( ) . clone ( ) ; }
Get a tick range given a tick value
46
8
161,644
public OpenAPI read ( Set < Class < ? > > classes ) { Set < Class < ? > > sortedClasses = new TreeSet <> ( new Comparator < Class < ? > > ( ) { @ Override public int compare ( Class < ? > class1 , Class < ? > class2 ) { if ( class1 . equals ( class2 ) ) { return 0 ; } else if ( class1 . isAssignableFrom ( class2 ) ) { return - 1 ; } else if ( class2 . isAssignableFrom ( class1 ) ) { return 1 ; } return class1 . getName ( ) . compareTo ( class2 . getName ( ) ) ; } } ) ; sortedClasses . addAll ( classes ) ; for ( Class < ? > cls : sortedClasses ) { read ( cls , this . applicationPath != null ? applicationPath : "" ) ; } return openAPI ; }
Scans a set of classes for both ReaderListeners and OpenAPI annotations . All found listeners will be instantiated before any of the classes are scanned for OpenAPI annotations - so they can be invoked accordingly .
198
42
161,645
public static MfpDiagnostics initialize ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "initialize" ) ; // We should only do this once if ( singleton == null ) { singleton = new MfpDiagnostics ( ) ; singleton . register ( packageList ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "initialize" ) ; return singleton ; }
Initialise the diagnostic module by creating the singleton instance and registering it with the diagnostic engine in Websphere .
123
23
161,646
public void ffdcDumpDefault ( Throwable t , IncidentStream is , Object callerThis , Object [ ] objs , String sourceId ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "ffdcDumpDefault" ) ; // First trace the Throwable, so that we can actually spot the exception in the trace if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "FFDC for " + t ) ; // Trace the first line of the stacktrace too, as it'll help debugging if ( t != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , " at... " + t . getStackTrace ( ) [ 0 ] ) ; } // Capture the Messaging Engine Name and other default information super . captureDefaultInformation ( is ) ; // The objs parm may contain one request or several. Each call to dumpUsefulStuff() // deals with a single request. If it contains several requests, each entry // in objs is itself an Object[]. If not, the first entry is just an Object. if ( objs != null && objs . length > 0 ) { if ( objs [ 0 ] instanceof Object [ ] ) { for ( int i = 0 ; i < objs . length ; i ++ ) { // Belt & braces - we don't want FFDC to fail because someone inserted something invalid if ( objs [ i ] instanceof Object [ ] ) dumpUsefulStuff ( is , ( Object [ ] ) objs [ i ] ) ; } } else { dumpUsefulStuff ( is , objs ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "ffdcDumpDefault" ) ; }
Default ffdc dump routine - always invoked
434
9
161,647
private void dumpUsefulStuff ( IncidentStream is , Object [ ] objs ) { // The first parameter is a marker telling us what sort of data we have in subsequent // parameters. if ( objs != null && objs . length > 0 ) { if ( objs [ 0 ] == MfpConstants . DM_BUFFER && objs . length >= 4 ) dumpJmfBuffer ( is , ( byte [ ] ) objs [ 1 ] , ( ( Integer ) objs [ 2 ] ) . intValue ( ) , ( ( Integer ) objs [ 3 ] ) . intValue ( ) ) ; else if ( objs [ 0 ] == MfpConstants . DM_MESSAGE && objs . length >= 2 ) dumpJmfMessage ( is , ( JMFMessage ) objs [ 1 ] , objs [ 2 ] ) ; else if ( objs [ 0 ] == MfpConstants . DM_SLICES && objs . length >= 2 ) dumpJmfSlices ( is , ( List < DataSlice > ) objs [ 1 ] ) ; } }
routine to dump it .
238
6
161,648
private void dumpJmfBuffer ( IncidentStream is , byte [ ] frame , int offset , int length ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "dumpJmfBuffer" ) ; if ( frame != null ) { // If the length passed in is 0 we probably have rubbish in both the length // and the offset so display the entire buffer (or at least the first 4k) if ( length == 0 ) { is . writeLine ( "Request to dump offset=" + offset + " length=" + length + " implies bad data so dumping buffer from offset 0." , "" ) ; offset = 0 ; length = frame . length ; } // otherwise ensure we can't fall off the end of the buffer else if ( ( offset + length ) > frame . length ) { length = frame . length - offset ; } try { String buffer = SibTr . formatBytes ( frame , offset , length , getDiagnosticDataLimitInt ( ) ) ; is . writeLine ( "JMF data buffer" , buffer ) ; } catch ( Exception e ) { // No FFDC code needed - we are FFDCing! if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "dumpJmfBuffer failed: " + e ) ; } } else is . writeLine ( "No JMF buffer data available" , "" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "dumpJmfBuffer" ) ; }
to contain the Jetstream headers etc .
357
8
161,649
private void dumpJmfSlices ( IncidentStream is , List < DataSlice > slices ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "dumpJmfSlices" ) ; if ( slices != null ) { try { is . writeLine ( "JMF data slices" , SibTr . formatSlices ( slices , getDiagnosticDataLimitInt ( ) ) ) ; } catch ( Exception e ) { // No FFDC code needed - we are FFDCing! if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "dumpJmfSlices failed: " + e ) ; } } else { is . writeLine ( "No JMF DataSlices available" , "" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "dumpJmfSlices" ) ; }
user data - so we only dump at most the first 4K bytes of each slice .
236
18
161,650
protected void initializeNonPersistent ( MessageProcessor messageProcessor ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "initializeNonPersistent" , messageProcessor ) ; /* * Keep a local reference to the MessageProcessor object, as this allows us * to find the message store and to generate units of work when required. */ this . messageProcessor = messageProcessor ; txManager = messageProcessor . getTXManager ( ) ; destinationIndex = new DestinationIndex ( messageProcessor . getMessagingEngineBus ( ) ) ; foreignBusIndex = new ForeignBusIndex ( ) ; linkIndex = new LinkIndex ( ) ; /* * Create the system-wide hashmap for durable subscriptions. This MUST be available * to every TopicSpace since a subsriptionId is unique across the system. */ durableSubscriptions = new HashMap ( ) ; //initializing nondurableSharedSubscriptions here as it is common flow for cold and warm start //however nondurableSharedSubscriptions not be restored from Message Store. nondurableSharedSubscriptions = new ConcurrentHashMap < String , Object > ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "initializeNonPersistent" ) ; }
Initialize non - persistent fields . These fields are common to both MS reconstitution of DestinationManagers and initial creation .
296
25
161,651
public void moveAllInDoubtToUnreconciled ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "moveAllInDoubtToUnreconciled" ) ; DestinationTypeFilter filter = new DestinationTypeFilter ( ) ; filter . LOCAL = Boolean . TRUE ; filter . INDOUBT = Boolean . TRUE ; SIMPIterator itr = destinationIndex . iterator ( filter ) ; while ( itr . hasNext ( ) ) { BaseDestinationHandler destHand = ( BaseDestinationHandler ) itr . next ( ) ; destinationIndex . putUnreconciled ( destHand ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "moveAllInDoubtToUnreconciled" ) ; }
Before reconciliation we need to move any inDoubt handlers to the Unreconciled state . If the destination gets reconciled then we have recovered . If not we might get moved back to the inDoubt state arguing that the corrupt WCCM file is stil causing problems or finally WCCM might now tell us to remove the destination
197
70
161,652
private void startNewReconstituteThread ( Runnable runnable ) throws InterruptedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "startNewReconstituteThread" ) ; if ( _reconstituteThreadpool == null ) { createReconstituteThreadPool ( ) ; } _reconstituteThreadpool . execute ( runnable ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "startNewReconstituteThread" ) ; }
Starts a new thread for reconstitution
140
9
161,653
private void waitUntilReconstitutionIsCompleted ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "waitUntilReconstitutionISCompleted" ) ; // gracefully shutdown the pool _reconstituteThreadpool . shutdown ( ) ; //awaitTermination() is a blocking call and caller thread will be blocked //until all tasks in pool have completed execution after a shutdown request try { _reconstituteThreadpool . awaitTermination ( Long . MAX_VALUE , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; } //Destroy the thread pool _reconstituteThreadpool = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "waitUntilReconstitutionISCompleted" ) ; }
Will wait until the reconstitution is completed This will be called for each of BaseDestinationHandler LinkHandler and MQLinkHandler The threadpool will be destroyed
212
33
161,654
public final LinkHandler getLink ( String linkName ) { LinkTypeFilter filter = new LinkTypeFilter ( ) ; return ( LinkHandler ) linkIndex . findByName ( linkName , filter ) ; }
Gets the link destination from the set of destinations
43
10
161,655
public DestinationHandler getDestination ( JsDestinationAddress destinationAddr , boolean includeInvisible ) throws SITemporaryDestinationNotFoundException , SIResourceException , SINotPossibleInCurrentConfigurationException { return getDestination ( destinationAddr . getDestinationName ( ) , destinationAddr . getBusName ( ) , includeInvisible , false ) ; }
This method provides lookup of a destination by its address . If the destination is not found it throws SIDestinationNotFoundException .
81
27
161,656
public final void removePseudoDestination ( SIBUuid12 destinationUuid ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removePseudoDestination" , destinationUuid ) ; destinationIndex . removePseudoUuid ( destinationUuid ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removePseudoDestination" ) ; }
Remove a link for a pseudo desintation ID .
118
11
161,657
public void resetDestination ( String destName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "resetDestination" , destName ) ; try { DestinationHandler dh = destinationIndex . findByName ( destName , messageProcessor . getMessagingEngineBus ( ) , null ) ; checkDestinationHandlerExists ( dh != null , destName , messageProcessor . getMessagingEngineBus ( ) ) ; // Only applicable to BaseDestinationHandlers if ( dh instanceof BaseDestinationHandler ) { BaseDestinationHandler bdh = ( BaseDestinationHandler ) dh ; // Need to ensure that this change is persisted - specifically that the // BDH "toBeIgnored" flag is persisted LocalTransaction siTran = txManager . createLocalTransaction ( true ) ; // Drive the object's reset method bdh . reset ( ) ; // Change our entry in the appropriate index. destinationIndex . reset ( dh ) ; // Persist the change bdh . requestUpdate ( ( Transaction ) siTran ) ; // commit the transaction siTran . commit ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Have reset destination " + bdh . getName ( ) ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Not a BDH, cannot reset destination " + dh . getName ( ) ) ; } } catch ( MessageStoreException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; //throw e; } catch ( SIException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; //handleRollback(siTran); // throw e; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "resetDestination" ) ; }
Reset a destination .
448
5
161,658
public void resetLink ( String linkName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "resetLink" , linkName ) ; try { DestinationHandler link = linkIndex . findByName ( linkName , null ) ; checkDestinationHandlerExists ( link != null , linkName , messageProcessor . getMessagingEngineBus ( ) ) ; // Only applicable to BaseDestinationHandlers and their children if ( link instanceof LinkHandler ) { LinkHandler linkhandler = ( LinkHandler ) link ; // Need to ensure that this change is persisted - specifically that the // BDH "toBeIgnored" flag is persisted LocalTransaction siTran = txManager . createLocalTransaction ( true ) ; linkhandler . reset ( ) ; // Change our entry in the appropriate index. linkIndex . reset ( link ) ; // Persist the change linkhandler . requestUpdate ( ( Transaction ) siTran ) ; // commit the transaction siTran . commit ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Have reset link " + linkhandler . getName ( ) ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Not a LinkHandler, cannot reset handler for " + link . getName ( ) ) ; } } catch ( MessageStoreException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; //throw e; } catch ( SIException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; //handleRollback(siTran); // throw e; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "resetLink" ) ; }
Reset a link .
424
5
161,659
public VirtualLinkDefinition getLinkDefinition ( String busName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getLinkDefinition" , busName ) ; ForeignBusDefinition foreignBus = messageProcessor . getForeignBus ( busName ) ; VirtualLinkDefinition link = null ; if ( foreignBus != null && foreignBus . hasLink ( ) ) { try { link = foreignBus . getLink ( ) ; } catch ( SIBExceptionNoLinkExists e ) { // SIBExceptionNoLinkExists shouldn't occur so FFDC. FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.DestinationManager.getLinkDefinition" , "1:1951:1.508.1.7" , this ) ; SibTr . exception ( tc , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getLinkDefinition" , link ) ; return link ; }
Returns the link definition of the link used to connect to the given busname
239
15
161,660
public String getTopicSpaceMapping ( String busName , SIBUuid12 topicSpace ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getTopicSpaceMapping" , new Object [ ] { busName , topicSpace } ) ; VirtualLinkDefinition linkDef = getLinkDefinition ( busName ) ; //this is only called internally so we shall include invisible dests in the lookup String topicSpaceName = getDestinationInternal ( topicSpace , true ) . getName ( ) ; String mapping = null ; if ( linkDef != null && linkDef . getTopicSpaceMappings ( ) != null ) mapping = ( String ) linkDef . getTopicSpaceMappings ( ) . get ( topicSpaceName ) ; else // Local ME mapping = topicSpaceName ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getTopicSpaceMapping" , mapping ) ; return mapping ; }
Returns the topicSpaceName of the foreign topicSpace
224
10
161,661
String createNewTemporaryDestinationName ( String destinationPrefix , SIBUuid8 meUuid , Distribution distribution ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createNewTemporaryDestinationName" , new Object [ ] { destinationPrefix , meUuid , distribution } ) ; if ( destinationPrefix != null ) { if ( destinationPrefix . length ( ) > 12 ) destinationPrefix = destinationPrefix . substring ( 0 , 12 ) ; } else destinationPrefix = "" ; // Get the next available temporary destination count. long count = messageProcessor . nextTick ( ) ; // Suffix is the tempdest count as 8 char hex with leading zeros StringBuffer sb = new StringBuffer ( "0000000000000000" + Long . toHexString ( count ) . toUpperCase ( ) ) ; String uniqueSuffix = sb . substring ( sb . length ( ) - 16 ) . toString ( ) ; String tempPrefix = null ; if ( distribution == Distribution . ONE ) tempPrefix = SIMPConstants . TEMPORARY_QUEUE_DESTINATION_PREFIX ; else tempPrefix = SIMPConstants . TEMPORARY_PUBSUB_DESTINATION_PREFIX ; // Generate the unique name for the temporary destination. String name = tempPrefix + destinationPrefix + SIMPConstants . SYSTEM_DESTINATION_SEPARATOR + meUuid + uniqueSuffix ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createNewTemporaryDestinationName" , name ) ; return name ; }
Creates a new name for a temporary destination . Uses the Message Store Tick count to generate the unique suffix for the temporary destination
393
25
161,662
protected void removeDestination ( DestinationHandler dh ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeDestination" , dh ) ; if ( dh . isLink ( ) ) { if ( linkIndex . containsKey ( dh ) ) { linkIndex . remove ( dh ) ; } } else { if ( destinationIndex . containsKey ( dh ) ) { destinationIndex . remove ( dh ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeDestination" ) ; }
Remove the given destination from the DestinationManager .
142
9
161,663
protected void createTransmissionDestination ( SIBUuid8 remoteMEUuid ) throws SIResourceException , SIMPDestinationAlreadyExistsException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createTransmissionDestination" , remoteMEUuid ) ; String destinationName = remoteMEUuid . toString ( ) ; DestinationDefinition destinationDefinition ; destinationDefinition = messageProcessor . createDestinationDefinition ( DestinationType . QUEUE , destinationName ) ; destinationDefinition . setMaxReliability ( Reliability . ASSURED_PERSISTENT ) ; destinationDefinition . setDefaultReliability ( Reliability . ASSURED_PERSISTENT ) ; Set < String > destinationLocalizingSet = new HashSet < String > ( ) ; destinationLocalizingSet . add ( messageProcessor . getMessagingEngineUuid ( ) . toString ( ) ) ; // Create the transmission destination createDestinationLocalization ( destinationDefinition , messageProcessor . createLocalizationDefinition ( destinationDefinition . getName ( ) ) , destinationLocalizingSet , false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createTransmissionDestination" ) ; }
Method createTransmissionDestination .
284
7
161,664
private void checkDestinationHandlerExists ( boolean condition , String destName , String engineName ) throws SINotPossibleInCurrentConfigurationException , SITemporaryDestinationNotFoundException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkDestinationHandlerExists" , new Object [ ] { new Boolean ( condition ) , destName , engineName } ) ; if ( ! condition ) { if ( destName . startsWith ( SIMPConstants . TEMPORARY_QUEUE_DESTINATION_PREFIX ) || destName . startsWith ( SIMPConstants . TEMPORARY_PUBSUB_DESTINATION_PREFIX ) ) { SIMPTemporaryDestinationNotFoundException e = new SIMPTemporaryDestinationNotFoundException ( nls . getFormattedMessage ( "TEMPORARY_DESTINATION_NAME_ERROR_CWSIP0097" , new Object [ ] { destName } , null ) ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkDestinationHandlerExists" , e ) ; throw e ; } SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException ( nls_cwsik . getFormattedMessage ( "DELIVERY_ERROR_SIRC_15" , // DESTINATION_NOT_FOUND_ERROR_CWSIP0042 new Object [ ] { destName , engineName } , null ) ) ; e . setExceptionReason ( SIRCConstants . SIRC0015_DESTINATION_NOT_FOUND_ERROR ) ; e . setExceptionInserts ( new String [ ] { destName , engineName } ) ; SibTr . exception ( tc , e ) ; // Log a warning message to assist in PD. We use the suppressor to avoid // multiple messages for the same destination. SibTr . warning ( tc_cwsik , SibTr . Suppressor . ALL_FOR_A_WHILE_SIMILAR_INSERTS , "DELIVERY_ERROR_SIRC_15" , new Object [ ] { destName , engineName } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkDestinationHandlerExists" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkDestinationHandlerExists" ) ; }
Asserts that a DestinationHandler exists . Throws out the appropriate exception if the condition has failed .
600
21
161,665
private void checkBusExists ( boolean condition , String foreignBusName , boolean linkError , Throwable cause ) throws SINotPossibleInCurrentConfigurationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkBusExists" , new Object [ ] { new Boolean ( condition ) , foreignBusName , Boolean . valueOf ( linkError ) , cause } ) ; if ( ! condition ) { String errorMsg = "DELIVERY_ERROR_SIRC_38" ; int reason = SIRCConstants . SIRC0038_FOREIGN_BUS_NOT_FOUND_ERROR ; if ( linkError && cause != null ) { reason = SIRCConstants . SIRC0041_FOREIGN_BUS_LINK_NOT_DEFINED_ERROR ; errorMsg = "DELIVERY_ERROR_SIRC_41" ; } else if ( cause != null ) { reason = SIRCConstants . SIRC0039_FOREIGN_BUS_NOT_FOUND_ERROR ; errorMsg = "DELIVERY_ERROR_SIRC_39" ; } SIMPNotPossibleInCurrentConfigurationException e = null ; if ( cause == null ) { e = new SIMPNotPossibleInCurrentConfigurationException ( nls_cwsik . getFormattedMessage ( errorMsg , new Object [ ] { foreignBusName , messageProcessor . getMessagingEngineName ( ) , messageProcessor . getMessagingEngineBus ( ) } , null ) ) ; e . setExceptionInserts ( new String [ ] { foreignBusName , messageProcessor . getMessagingEngineName ( ) , messageProcessor . getMessagingEngineBus ( ) } ) ; e . setExceptionReason ( reason ) ; } else { e = new SIMPNotPossibleInCurrentConfigurationException ( nls_cwsik . getFormattedMessage ( errorMsg , new Object [ ] { foreignBusName , messageProcessor . getMessagingEngineName ( ) , messageProcessor . getMessagingEngineBus ( ) , SIMPUtils . getStackTrace ( cause ) } , null ) ) ; e . setExceptionInserts ( new String [ ] { foreignBusName , messageProcessor . getMessagingEngineName ( ) , messageProcessor . getMessagingEngineBus ( ) , SIMPUtils . getStackTrace ( cause ) } ) ; e . setExceptionReason ( reason ) ; } SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkBusExists" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkBusExists" ) ; }
Asserts that a Bus exists . Throws out the appropriate exception if the condition has failed .
629
20
161,666
private void checkMQLinkExists ( boolean condition , String mqlinkName ) throws SINotPossibleInCurrentConfigurationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkMQLinkExists" , new Object [ ] { new Boolean ( condition ) , mqlinkName } ) ; if ( ! condition ) { SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException ( nls_cwsik . getFormattedMessage ( "DELIVERY_ERROR_SIRC_42" , new Object [ ] { mqlinkName , messageProcessor . getMessagingEngineName ( ) , messageProcessor . getMessagingEngineBus ( ) } , null ) ) ; e . setExceptionInserts ( new String [ ] { mqlinkName , messageProcessor . getMessagingEngineName ( ) , messageProcessor . getMessagingEngineBus ( ) } ) ; e . setExceptionReason ( SIRCConstants . SIRC0042_MQ_LINK_NOT_FOUND_ERROR ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkMQLinkExists" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkMQLinkExists" ) ; }
Asserts that an MQLink exists . Throws out the appropriate exception if the condition has failed .
346
22
161,667
private void checkQueuePointContainsLocalME ( Set < String > queuePointLocalizingMEs , SIBUuid8 messagingEngineUuid , DestinationDefinition destinationDefinition , LocalizationDefinition destinationLocalizationDefinition ) { if ( isQueue ( destinationDefinition . getDestinationType ( ) ) && ( destinationLocalizationDefinition != null ) ) { //Queue point locality set must contain local ME if ( ( queuePointLocalizingMEs == null ) || ( ! queuePointLocalizingMEs . contains ( messagingEngineUuid . toString ( ) ) ) ) { throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_CONFIGURATION_ERROR_CWSIP0006" , new Object [ ] { "DestinationManager" , "1:4845:1.508.1.7" , destinationDefinition . getName ( ) } , null ) ) ; } } }
Checks that the Local ME is in the queue point localizing set
192
14
161,668
private void checkQueuePointLocalizingSize ( Set < String > queuePointLocalizingMEs , DestinationDefinition destinationDefinition ) { //There must be at least one queue point if ( ( ( destinationDefinition . getDestinationType ( ) != DestinationType . SERVICE ) && ( queuePointLocalizingMEs . size ( ) == 0 ) ) || ( ( destinationDefinition . getDestinationType ( ) == DestinationType . SERVICE ) && ( queuePointLocalizingMEs . size ( ) != 0 ) ) ) { throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_CONFIGURATION_ERROR_CWSIP0006" , new Object [ ] { "DestinationManager" , "1:4867:1.508.1.7" , destinationDefinition . getName ( ) } , null ) ) ; } }
Checks that the queuePointLocalising size is valid
180
11
161,669
private void setIsAsyncDeletionThreadStartable ( boolean isStartable ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setIsAsyncDeletionThreadStartable" , new Boolean ( isStartable ) ) ; synchronized ( deletionThreadLock ) { _isAsyncDeletionThreadStartable = isStartable ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setIsAsyncDeletionThreadStartable" ) ; }
Indicates whether the async deletion thread should be startable or not .
133
14
161,670
public JsDestinationAddress createSystemDestination ( String prefix , Reliability reliability ) throws SIResourceException , SIMPDestinationAlreadyExistsException , SIIncorrectCallException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createSystemDestination" , new Object [ ] { prefix , reliability } ) ; //there is no detailed prefix validation here as System Destinations are purely //internal if ( prefix == null || prefix . length ( ) > 24 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createSystemDestination" , "SIInvalidDestinationPrefixException" ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0005" , new Object [ ] { "com.ibm.ws.sib.processor.impl.DestinationManager" , "1:5324:1.508.1.7" , prefix } ) ; throw new SIInvalidDestinationPrefixException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0005" , new Object [ ] { "com.ibm.ws.sib.processor.impl.DestinationManager" , "1:5329:1.508.1.7" , prefix } , null ) ) ; } JsDestinationAddress destAddr = SIMPUtils . createJsSystemDestinationAddress ( prefix , messageProcessor . getMessagingEngineUuid ( ) ) ; destAddr . setBusName ( messageProcessor . getMessagingEngineBus ( ) ) ; // Check and see if the destination already exists. //note that this is treated as an application call so we don't want to see //those that are being deleted DestinationHandler handler = getDestinationInternal ( destAddr . getDestinationName ( ) , destAddr . getBusName ( ) , false ) ; if ( handler != null ) { // The system destination exists for the destination prefix set so // just return. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createSystemDestination" , destAddr ) ; return destAddr ; } DestinationDefinition destDef = messageProcessor . createDestinationDefinition ( DestinationType . QUEUE , destAddr . getDestinationName ( ) ) ; destDef . setMaxReliability ( reliability ) ; destDef . setDefaultReliability ( reliability ) ; destDef . setUUID ( new SIBUuid12 ( ) ) ; Set < String > destinationLocalizingSet = new HashSet < String > ( ) ; destinationLocalizingSet . add ( messageProcessor . getMessagingEngineUuid ( ) . toString ( ) ) ; createDestinationLocalization ( destDef , messageProcessor . createLocalizationDefinition ( destDef . getName ( ) ) , destinationLocalizingSet , false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createSystemDestination" , destAddr ) ; return destAddr ; }
Creates a System destination with the given prefix and reliability
714
11
161,671
public void addSubscriptionToDelete ( SubscriptionItemStream stream ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addSubscriptionToDelete" , stream ) ; synchronized ( deletableSubscriptions ) { deletableSubscriptions . add ( stream ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addSubscriptionToDelete" ) ; }
Add a subscription to the list of subscriptions to be deleted .
115
12
161,672
public DestinationHandler getDestination ( SIBUuid12 destinationUuid , boolean includeInvisible ) throws SITemporaryDestinationNotFoundException , SINotPossibleInCurrentConfigurationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getDestination" , destinationUuid ) ; // Get the destination, include invisible dests DestinationHandler destinationHandler = getDestinationInternal ( destinationUuid , includeInvisible ) ; checkDestinationHandlerExists ( destinationHandler != null , destinationUuid . toString ( ) , messageProcessor . getMessagingEngineName ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getDestination" , destinationHandler ) ; return destinationHandler ; }
Method getDestination .
187
5
161,673
public MQLinkHandler getMQLinkLocalization ( SIBUuid8 mqLinkUuid , boolean includeInvisible ) throws SIMPMQLinkCorruptException , SINotPossibleInCurrentConfigurationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getMQLinkLocalization" , mqLinkUuid ) ; // Get the destination LinkTypeFilter filter = new LinkTypeFilter ( ) ; filter . MQLINK = Boolean . TRUE ; if ( ! includeInvisible ) filter . VISIBLE = Boolean . TRUE ; MQLinkHandler mqLinkHandler = ( MQLinkHandler ) linkIndex . findByMQLinkUuid ( mqLinkUuid , filter ) ; checkMQLinkExists ( mqLinkHandler != null , mqLinkUuid . toString ( ) ) ; if ( mqLinkHandler . isCorruptOrIndoubt ( ) ) { String message = nls . getFormattedMessage ( "LINK_HANDLER_CORRUPT_ERROR_CWSIP0054" , new Object [ ] { mqLinkHandler . getName ( ) , mqLinkUuid . toString ( ) } , null ) ; SIMPMQLinkCorruptException e = new SIMPMQLinkCorruptException ( message ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getMQLinkLocalization" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getMQLinkLocalization" , mqLinkHandler ) ; return mqLinkHandler ; }
Lookup a destination by its uuid .
424
9
161,674
void announceMPStarted ( int startMode ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "announceMPStarted" ) ; DestinationTypeFilter destFilter = new DestinationTypeFilter ( ) ; SIMPIterator itr = destinationIndex . iterator ( destFilter ) ; while ( itr . hasNext ( ) ) { DestinationHandler dh = ( DestinationHandler ) itr . next ( ) ; dh . announceMPStarted ( ) ; } itr . finished ( ) ; LinkTypeFilter linkFilter = new LinkTypeFilter ( ) ; linkFilter . LOCAL = Boolean . TRUE ; itr = linkIndex . iterator ( linkFilter ) ; while ( itr . hasNext ( ) ) { DestinationHandler dh = ( DestinationHandler ) itr . next ( ) ; dh . announceMPStarted ( ) ; } itr . finished ( ) ; itr = foreignBusIndex . iterator ( ) ; while ( itr . hasNext ( ) ) { DestinationHandler dh = ( DestinationHandler ) itr . next ( ) ; dh . announceMPStarted ( ) ; } itr . finished ( ) ; // Iterate over the MQLinks, calling the MQLink component to // alert it that MP has started LinkTypeFilter mqLinkFilter = new LinkTypeFilter ( ) ; mqLinkFilter . MQLINK = Boolean . TRUE ; itr = linkIndex . iterator ( mqLinkFilter ) ; while ( itr . hasNext ( ) ) { MQLinkHandler mqLinkHandler = ( MQLinkHandler ) itr . next ( ) ; try { mqLinkHandler . announceMPStarted ( startMode , messageProcessor . getMessagingEngine ( ) ) ; } catch ( SIResourceException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; // The MQLink component will have FFDC'd we'll trace // the problem but allow processing to continue } catch ( SIException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; // The MQLink component will have FFDC'd we'll trace // the problem but allow processing to continue } } itr . finished ( ) ; //Allow the async deletion thread to start up now if it wants. setIsAsyncDeletionThreadStartable ( true ) ; // Explicitly start the async deletion thread if there is anything to do. startAsynchDeletion ( ) ; //start DeletePubSubMsgsThread. startDeletePubSubMsgsThread ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "announceMPStarted" ) ; }
Find the mediated destinations and tell them that the MP is now ready for mediations to start work . In addition alert the MQLink component that MP has started and set the flag to allow asynch deletion .
594
43
161,675
public BusHandler findBus ( String busName ) throws SIResourceException , SINotPossibleInCurrentConfigurationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "findBus" , new Object [ ] { busName } ) ; // Get the bus ForeignBusTypeFilter filter = new ForeignBusTypeFilter ( ) ; filter . VISIBLE = Boolean . TRUE ; BusHandler busHandler = ( BusHandler ) foreignBusIndex . findByName ( busName , filter ) ; // If the bus was not found in DestinationLookups, ask Admin if ( busHandler == null ) { busHandler = findBusInternal ( busName ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "findBus" , busHandler ) ; return busHandler ; }
Method findBus .
198
4
161,676
private boolean isLocalizationAvailable ( BaseDestinationHandler baseDestinationHandler , DestinationAvailability destinationAvailability ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isLocalizationAvailable" , new Object [ ] { baseDestinationHandler , destinationAvailability } ) ; boolean available = false ; if ( baseDestinationHandler . hasLocal ( ) ) { // Look at the stream for the destination which represents all localizations LocalizationPoint localizationPoint = baseDestinationHandler . getQueuePoint ( messageProcessor . getMessagingEngineUuid ( ) ) ; if ( destinationAvailability == DestinationAvailability . SEND ) { available = localizationPoint . isSendAllowed ( ) ; } else { available = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isLocalizationAvailable" , new Object [ ] { new Boolean ( available ) } ) ; return available ; }
This method determines whether a localization for a destination is available .
219
12
161,677
public List < JsDestinationAddress > getAllSystemDestinations ( SIBUuid8 meUuid ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getAllSystemDestinations" , meUuid ) ; DestinationTypeFilter filter = new DestinationTypeFilter ( ) ; filter . LOCAL = Boolean . FALSE ; filter . DELETE_PENDING = Boolean . FALSE ; filter . DELETE_DEFERED = Boolean . FALSE ; filter . ACTIVE = Boolean . TRUE ; List < JsDestinationAddress > destAddresses = new ArrayList < JsDestinationAddress > ( ) ; Iterator itr = getDestinationIndex ( ) . iterator ( filter ) ; while ( itr . hasNext ( ) ) { DestinationHandler destinationHandler = ( DestinationHandler ) itr . next ( ) ; String destinationHandlerName = destinationHandler . getName ( ) ; SIBUuid8 found = SIMPUtils . parseME ( destinationHandlerName ) ; if ( found == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Couldn't parse uuid from " + destinationHandlerName ) ; } if ( found != null && found . equals ( meUuid ) ) { if ( destinationHandler . isSystem ( ) ) { destAddresses . add ( SIMPUtils . createJsDestinationAddress ( destinationHandler . getName ( ) , meUuid ) ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAllSystemDestinations" , destAddresses ) ; return destAddresses ; }
Finds all the JsDestinationAddresses that belong to system destinations for the ME that was passed in .
388
23
161,678
protected void activateDestination ( DestinationHandler dh ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "activateDestination" , dh ) ; if ( dh . isLink ( ) ) { linkIndex . create ( dh ) ; } else { destinationIndex . create ( dh ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "activateDestination" ) ; }
Move the destination into ACTIVE state
116
7
161,679
protected void corruptDestination ( DestinationHandler dh ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "corruptDestination" , dh ) ; if ( ! dh . isLink ( ) && destinationIndex . containsDestination ( dh ) ) { destinationIndex . corrupt ( dh ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "corruptDestination" ) ; }
PK54812 Move the destination into CORRUPT state
118
12
161,680
@ Override public void stopThread ( StoppableThreadCache cache ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stopThread" ) ; this . hasToStop = true ; //Remove this thread from the thread cache cache . deregisterThread ( this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stopThread" ) ; }
This get called from MessageProcessor on ME getting stopped .
111
12
161,681
public final void setUncheckedLocalException ( Throwable ex ) throws EJBException { ExceptionMappingStrategy exceptionStrategy = getExceptionMappingStrategy ( ) ; Throwable mappedException = exceptionStrategy . setUncheckedException ( this , ex ) ; if ( mappedException != null ) { if ( mappedException instanceof EJBException ) { throw ( EJBException ) mappedException ; } else if ( mappedException instanceof RuntimeException ) { throw ( RuntimeException ) mappedException ; } else if ( mappedException instanceof Error ) { throw ( Error ) mappedException ; } else { // Unless there is a defect in mapping strategy, this should // never happen. But if it does, we are going to // wrap what is returned with a EJBException. This is added // measure to ensure we do not break applications that // existed prior to EJB 3. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "unexpected Throwable returned by exception mapping strategy" , new Object [ ] { mappedException , exceptionStrategy } ) ; } throw ExceptionUtil . EJBException ( mappedException ) ; } } }
d395666 - rewrote entire method .
252
9
161,682
protected Boolean getApplicationExceptionRollback ( Throwable t ) { Boolean rollback ; if ( ivIgnoreApplicationExceptions ) { rollback = null ; } else { ComponentMetaData cmd = getComponentMetaData ( ) ; EJBModuleMetaDataImpl mmd = ( EJBModuleMetaDataImpl ) cmd . getModuleMetaData ( ) ; rollback = mmd . getApplicationExceptionRollback ( t ) ; } return rollback ; }
d395666 - added entire method .
94
8
161,683
public Map < String , Object > getContextData ( ) { if ( ivContextData == null ) { ivContextData = new HashMap < String , Object > ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getContextData: created empty" ) ; } return ivContextData ; }
Returns the context data associated with this method invocation .
81
10
161,684
public static void addSubStatsToParent ( SPIStats parentStats , SPIStats subStats ) { StatsImpl p = ( StatsImpl ) parentStats ; StatsImpl s = ( StatsImpl ) subStats ; p . add ( s ) ; }
This method adds one Stats object as a subStats of another Stats object
50
14
161,685
public static void addStatisticsToParent ( SPIStats parentStats , SPIStatistic statistic ) { StatsImpl p = ( StatsImpl ) parentStats ; StatisticImpl s = ( StatisticImpl ) statistic ; p . add ( s ) ; }
This method adds one Statistic object as the child of a Stats object
50
14
161,686
void addLastEntry ( Object entry ) { if ( multiple == null ) { if ( ! single . equals ( entry ) ) { multiple = new LinkedList < Object > ( ) ; multiple . addLast ( single ) ; multiple . addLast ( entry ) ; } } else { if ( ! multiple . contains ( entry ) ) { multiple . addLast ( entry ) ; } } single = entry ; }
This method is used to add an entry to the AutoBindNode Note that the node can contain multiple entries . This method is not thread safe and should be externally synchronized such that other modifications do not happen concurrently on another thread .
85
45
161,687
boolean removeEntry ( Object entry ) { if ( multiple == null ) { if ( entry . equals ( single ) ) { single = null ; return true ; } } else { multiple . remove ( entry ) ; if ( single . equals ( entry ) ) { single = multiple . peekLast ( ) ; } if ( multiple . size ( ) == 1 ) { multiple = null ; } } return false ; }
This method is used to remove an entry from the AutoBindNode . This method is not thread safe and should be externally synchronized such that other modifications do not happen concurrently on another thread .
85
37
161,688
public void alarm ( final Object context ) { long sleepInterval = 0 ; do { long startWakeUpTime = System . currentTimeMillis ( ) ; try { wakeUp ( startDaemonTime , startWakeUpTime ) ; } catch ( Exception ex ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ex , "com.ibm.ws.cache.RealTimeDaemon.alarm" , "83" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "exception during wakeUp" , ex ) ; } sleepInterval = timeInterval - ( System . currentTimeMillis ( ) - startWakeUpTime ) ; // keep looping while we are behind... (i.e. execution time is greater than the time interval) } while ( sleepInterval <= 0 ) ; if ( false == stopDaemon ) { Scheduler . createNonDeferrable ( sleepInterval , context , new Runnable ( ) { @ Override public void run ( ) { alarm ( context ) ; } } ) ; } }
It runs in a loop that tries to wake every timeInterval . If it gets behind due to an overload the subclass implementation of the wakeUp method is responsible for resynching itself based on the startDaemonTime and startWakeUpTime .
242
51
161,689
public static String encode ( String decoded_string , String crypto_algorithm , String crypto_key ) throws InvalidPasswordEncodingException , UnsupportedCryptoAlgorithmException { HashMap < String , String > props = new HashMap < String , String > ( ) ; if ( crypto_key != null ) { props . put ( PROPERTY_CRYPTO_KEY , crypto_key ) ; } return encode ( decoded_string , crypto_algorithm , props ) ; }
Encode the provided string with the specified algorithm and the crypto key If the decoded_string is already encoded the string will be decoded and then encoded by using the specified crypto algorithm . Use this method for encoding the string by using the AES encryption with the specific crypto key . Note that this method is only avaiable for the Liberty profile .
103
70
161,690
public static String encode ( String decoded_string , String crypto_algorithm , Map < String , String > properties ) throws InvalidPasswordEncodingException , UnsupportedCryptoAlgorithmException { /* * check input: * * -- decoded_string: any string, any length, cannot be null, * cannot start with crypto algorithm tag * * -- crypto_algorithm: any string, any length, cannot be null, * must be valid (supported) crypto algorithm */ if ( ! isValidCryptoAlgorithm ( crypto_algorithm ) ) { // don't accept unsupported crypto algorithm throw new UnsupportedCryptoAlgorithmException ( ) ; } if ( decoded_string == null ) { // don't accept null password throw new InvalidPasswordEncodingException ( ) ; } String current_crypto_algorithm = getCryptoAlgorithm ( decoded_string ) ; if ( ( current_crypto_algorithm != null && current_crypto_algorithm . startsWith ( crypto_algorithm ) ) || isHashed ( decoded_string ) ) { // don't accept encoded password throw new InvalidPasswordEncodingException ( ) ; } else if ( current_crypto_algorithm != null ) { decoded_string = passwordDecode ( decoded_string ) ; } if ( properties == null || ! properties . containsKey ( PROPERTY_NO_TRIM ) || ! "true" . equalsIgnoreCase ( properties . get ( PROPERTY_NO_TRIM ) ) ) { decoded_string = decoded_string . trim ( ) ; } String encoded_string = encode_password ( decoded_string , crypto_algorithm . trim ( ) , properties ) ; if ( encoded_string == null ) { throw new InvalidPasswordEncodingException ( ) ; } return encoded_string ; }
Encode the provided string with the specified algorithm and the properties If the decoded_string is already encoded the string will be decoded and then encoded by using the specified crypto algorithm . Note that this method is only avaiable for the Liberty profile .
387
51
161,691
public static boolean isHashed ( String encoded_string ) { String algorithm = getCryptoAlgorithm ( encoded_string ) ; return isValidAlgorithm ( algorithm , PasswordCipherUtil . getSupportedHashAlgorithms ( ) ) ; }
Determine if the provided string is hashed by examining the algorithm tag . Note that this method is only avaiable for the Liberty profile .
52
30
161,692
public static String passwordEncode ( String decoded_string , String crypto_algorithm ) { /* * check input: * * -- decoded_string: any string, any length, cannot be null, * may start with valid (supported) crypto algorithm tag * * -- crypto_algorithm: any string, any length, cannot be null, * must be valid (supported) crypto algorithm */ if ( decoded_string == null ) { // don't accept null password return null ; } String current_crypto_algorithm = getCryptoAlgorithm ( decoded_string ) ; if ( current_crypto_algorithm != null && current_crypto_algorithm . equals ( crypto_algorithm ) ) { // Return the decoded_string if it is tagged with a valid crypto algorithm. if ( isValidCryptoAlgorithm ( current_crypto_algorithm ) ) return decoded_string . trim ( ) ; return null ; } else if ( current_crypto_algorithm != null ) { decoded_string = passwordDecode ( decoded_string ) ; } // valid input ... encode password return encode_password ( decoded_string . trim ( ) , crypto_algorithm . trim ( ) , null ) ; // TODO check this }
Encode the provided password with the algorithm . If another algorithm is already applied it will be removed and replaced with the new algorithm .
269
26
161,693
public static String removeCryptoAlgorithmTag ( String password ) { if ( null == password ) { return null ; } String rc = null ; String data = password . trim ( ) ; if ( data . length ( ) >= 2 ) { if ( ' ' == data . charAt ( 0 ) ) { int end = data . indexOf ( ' ' , 1 ) ; if ( end > 0 ) { end ++ ; // we want to jump past the end marker if ( end == data . length ( ) ) { rc = EMPTY_STRING ; } else { rc = data . substring ( end ) . trim ( ) ; } } } } return rc ; }
Remove the algorithm tag from the input encoded password .
141
10
161,694
private static byte [ ] convert_viewable_to_bytes ( String string ) { if ( null == string ) { return null ; } if ( 0 == string . length ( ) ) { return EMPTY_BYTE_ARRAY ; } return Base64Coder . base64Decode ( convert_to_bytes ( string ) ) ; }
Convert the string to bytes using UTF - 8 encoding and then run it through the base64 decoding .
73
21
161,695
private static String convert_viewable_to_string ( byte [ ] bytes ) { String string = null ; if ( bytes != null ) { if ( bytes . length == 0 ) { string = EMPTY_STRING ; } else { string = convert_to_string ( Base64Coder . base64Encode ( bytes ) ) ; } } return string ; }
Use base64 encoding on the bytes and then convert them to a string using UTF - 8 encoding .
78
20
161,696
private static String decode_password ( String encoded_string , String crypto_algorithm ) { /* * decoding process: * * -- check for empty algorithm tag * -- convert input String to byte[] using base64 decoding * -- decipher byte[] * -- convert byte[] to String using UTF8 conversion code */ StringBuilder buffer = new StringBuilder ( ) ; if ( crypto_algorithm . length ( ) == 0 ) { // crypto algorithm is empty ... don't decode password buffer . append ( encoded_string ) ; } else { // decode password with specified crypto algorithm String decoded_string = null ; if ( encoded_string . length ( ) > 0 ) { // convert viewable string to encrypted password byte[] byte [ ] encrypted_bytes = convert_viewable_to_bytes ( encoded_string ) ; logger . logp ( Level . FINEST , PasswordUtil . class . getName ( ) , "decode_password" , "byte array before decoding\n" + PasswordHashGenerator . hexDump ( encrypted_bytes ) ) ; if ( encrypted_bytes == null ) { // base64 decoding failed logger . logp ( Level . SEVERE , PasswordUtil . class . getName ( ) , "decode_password" , "PASSWORDUTIL_INVALID_BASE64_STRING" ) ; return null ; } if ( encrypted_bytes . length > 0 ) { // decrypt encrypted password byte[] with specified crypto algorithm byte [ ] decrypted_bytes = null ; try { decrypted_bytes = PasswordCipherUtil . decipher ( encrypted_bytes , crypto_algorithm ) ; } catch ( InvalidPasswordCipherException e ) { logger . logp ( Level . SEVERE , PasswordUtil . class . getName ( ) , "decode_password" , "PASSWORDUTIL_CYPHER_EXCEPTION" , e ) ; return null ; } catch ( UnsupportedCryptoAlgorithmException e ) { logger . logp ( Level . SEVERE , PasswordUtil . class . getName ( ) , "decode_password" , "PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION" , e ) ; return null ; } if ( ( decrypted_bytes != null ) && ( decrypted_bytes . length > 0 ) ) { // convert decrypted password byte[] to string decoded_string = convert_to_string ( decrypted_bytes ) ; } } } if ( ( decoded_string != null ) && ( decoded_string . length ( ) > 0 ) ) { // append decoded string buffer . append ( decoded_string ) ; } } return buffer . toString ( ) ; }
Decode the provided string with the specified algorithm .
578
10
161,697
public static String encode_password ( String decoded_string , String crypto_algorithm , Map < String , String > properties ) { /* * encoding process: * * -- check for empty algorithm tag * -- convert input String to byte[] UTF8 conversion code * -- encipher byte[] * -- convert byte[] to String using using base64 encoding */ StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( CRYPTO_ALGORITHM_STARTED ) ; if ( crypto_algorithm . length ( ) == 0 ) { // crypto algorithm is empty ... don't encode password buffer . append ( CRYPTO_ALGORITHM_STOPPED ) . append ( decoded_string ) ; } else { // encode password with specified crypto algorithm String encoded_string = null ; EncryptedInfo info = null ; if ( decoded_string . length ( ) > 0 ) { // convert decoded password string to byte[] byte [ ] decrypted_bytes = convert_to_bytes ( decoded_string ) ; if ( decrypted_bytes . length > 0 ) { // encrypt decrypted password byte[] with specified crypto algorithm byte [ ] encrypted_bytes = null ; boolean done = false ; while ( ! done ) { try { info = PasswordCipherUtil . encipher_internal ( decrypted_bytes , crypto_algorithm , properties ) ; if ( info != null ) { encrypted_bytes = info . getEncryptedBytes ( ) ; } done = true ; } catch ( InvalidPasswordCipherException e ) { logger . logp ( Level . SEVERE , PasswordUtil . class . getName ( ) , "encode_password" , "PASSWORDUTIL_CYPHER_EXCEPTION" , e ) ; return null ; } catch ( UnsupportedCryptoAlgorithmException e ) { logger . logp ( Level . SEVERE , PasswordUtil . class . getName ( ) , "encode_password" , "PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION" , e ) ; return null ; } } if ( ( encrypted_bytes != null ) && ( encrypted_bytes . length > 0 ) ) { // convert encrypted password byte[] to viewable string encoded_string = convert_viewable_to_string ( encrypted_bytes ) ; if ( encoded_string == null ) { // base64 encoding failed return null ; } } } } buffer . append ( crypto_algorithm ) ; String alias = ( null == info ) ? null : info . getKeyAlias ( ) ; if ( alias != null && 0 < alias . length ( ) ) { buffer . append ( ' ' ) . append ( alias ) ; } buffer . append ( CRYPTO_ALGORITHM_STOPPED ) ; if ( ( encoded_string != null ) && ( encoded_string . length ( ) > 0 ) ) { // append encoded string buffer . append ( encoded_string ) ; } } return buffer . toString ( ) ; }
Encode the provided string by using the specified encoding algorithm and properties
645
13
161,698
protected Asset getAsset ( final String assetId , final boolean includeAttachments ) throws FileNotFoundException , IOException , BadVersionException { Asset ass = readJson ( assetId ) ; ass . set_id ( assetId ) ; // We always get a wlp info when read back from Massive so create one if there isnt already one WlpInformation wlpInfo = ass . getWlpInformation ( ) ; if ( wlpInfo == null ) { wlpInfo = new WlpInformation ( ) ; ass . setWlpInformation ( wlpInfo ) ; } if ( wlpInfo . getAppliesToFilterInfo ( ) == null ) { wlpInfo . setAppliesToFilterInfo ( Collections . < AppliesToFilterInfo > emptyList ( ) ) ; } if ( includeAttachments ) { if ( exists ( assetId ) ) { Attachment at = new Attachment ( ) ; at . set_id ( assetId ) ; at . setLinkType ( AttachmentLinkType . DIRECT ) ; at . setType ( AttachmentType . CONTENT ) ; at . setName ( getName ( assetId ) ) ; at . setSize ( getSize ( assetId ) ) ; at . setUrl ( at . get_id ( ) ) ; ass . addAttachement ( at ) ; if ( assetId . toLowerCase ( ) . endsWith ( ".jar" ) || assetId . toLowerCase ( ) . endsWith ( ".esa" ) ) { // Create attachment objects for each license if ( hasLicenses ( assetId ) ) { Map < String , Long > licensesMap = getLicenses ( assetId ) ; for ( Map . Entry < String , Long > e : licensesMap . entrySet ( ) ) { String lic = e . getKey ( ) ; String name = getName ( lic ) ; String licId = assetId . concat ( String . format ( "#licenses" + File . separator + "%s" , name ) ) ; Attachment licAt = new Attachment ( ) ; licAt . set_id ( licId ) ; licAt . setLinkType ( AttachmentLinkType . DIRECT ) ; licAt . setName ( name ) ; licAt . setSize ( e . getValue ( ) ) ; String locString = name . substring ( 3 ) ; if ( name . startsWith ( "LI" ) ) { licAt . setType ( AttachmentType . LICENSE_INFORMATION ) ; } else if ( name . startsWith ( "LA" ) ) { licAt . setType ( AttachmentType . LICENSE_AGREEMENT ) ; } else if ( name . endsWith ( ".html" ) ) { licAt . setType ( AttachmentType . LICENSE ) ; locString = name . substring ( 0 , name . lastIndexOf ( "." ) ) ; } // Make sure we've found one if ( licAt . getType ( ) != null ) { Locale locale = RepositoryCommonUtils . localeForString ( locString ) ; licAt . setLocale ( locale ) ; ass . addAttachement ( licAt ) ; licAt . setUrl ( licAt . get_id ( ) ) ; } } } } } } return ass ; }
Gets the specified asset
694
5
161,699
protected String getName ( final String relative ) { return relative . substring ( relative . lastIndexOf ( File . separator ) + 1 ) ; }
Gets the name from the relative path of the asset
32
11