idx
int64 0
165k
| question
stringlengths 73
4.15k
| target
stringlengths 5
918
| len_question
int64 21
890
| len_target
int64 3
255
|
|---|---|---|---|---|
160,900
|
void balance ( NodeStack stack , GBSNode q ) { GBSNode p ; int bpidx = stack . balancePointIndex ( ) ; int x = bpidx ; GBSNode bpoint = stack . node ( x ) ; GBSNode bfather = stack . node ( x - 1 ) ; /* Adjust balance factors in intervening nodes */ if ( bpoint . leftChild ( ) == stack . node ( x + 1 ) ) p = bpoint . leftChild ( ) ; else p = bpoint . rightChild ( ) ; x ++ ; while ( p != q ) { if ( p . leftChild ( ) == stack . node ( x + 1 ) ) { /* We followed and added to left path */ p . setBalance ( - 1 ) ; /* It is now left heavy */ p = p . leftChild ( ) ; } else /* We followed and added to right path */ { p . setBalance ( 1 ) ; /* It is now right heavy */ p = p . rightChild ( ) ; } x ++ ; } /* Adjust the balance factor at the balance point. */ /* Re-balance if necessary. */ if ( bpoint . leftChild ( ) == stack . node ( bpidx + 1 ) ) { /* Added to left side */ int bpb = bpoint . balance ( ) ; switch ( bpb ) { case 0 : bpoint . setBalance ( - 1 ) ; break ; case 1 : bpoint . clearBalance ( ) ; break ; case - 1 : rotateLeft ( bfather , bpoint ) ; break ; default : String zzz1 = "Help1 !, bpb = " + bpb ; throw new RuntimeException ( zzz1 ) ; } } else /* Added to right side */ { int bpb = bpoint . balance ( ) ; switch ( bpb ) { case 0 : bpoint . setBalance ( 1 ) ; break ; case - 1 : bpoint . clearBalance ( ) ; break ; case 1 : rotateRight ( bfather , bpoint ) ; break ; default : String zzz2 = "Help2 !, bpb = " + bpb ; throw new RuntimeException ( zzz2 ) ; } } }
|
Restore the height balance of a tree following an insert .
| 459
| 12
|
160,901
|
private void rotateLeft ( GBSNode bfather , GBSNode bpoint ) { GBSNode bson = bpoint . leftChild ( ) ; if ( bson . balance ( ) == - 1 ) /* Single LL rotation */ { bpoint . setLeftChild ( bson . rightChild ( ) ) ; bson . setRightChild ( bpoint ) ; if ( bfather . rightChild ( ) == bpoint ) bfather . setRightChild ( bson ) ; else bfather . setLeftChild ( bson ) ; bpoint . clearBalance ( ) ; bson . clearBalance ( ) ; } else /* Double LR rotation */ { GBSNode blift = bson . rightChild ( ) ; bson . setRightChild ( blift . leftChild ( ) ) ; blift . setLeftChild ( bson ) ; bpoint . setLeftChild ( blift . rightChild ( ) ) ; blift . setRightChild ( bpoint ) ; if ( bfather . rightChild ( ) == bpoint ) bfather . setRightChild ( blift ) ; else bfather . setLeftChild ( blift ) ; bpoint . setBalance ( newBalance2 [ blift . balance ( ) + 1 ] ) ; bson . setBalance ( newBalance1 [ blift . balance ( ) + 1 ] ) ; blift . clearBalance ( ) ; } }
|
Do an LL or LR rotation .
| 293
| 7
|
160,902
|
public Entry getPrevious ( ) { checkEntryParent ( ) ; Entry entry = null ; if ( ! isFirst ( ) ) { entry = previous ; } return entry ; }
|
Unsynchronized . Get the previous entry in the list .
| 36
| 13
|
160,903
|
@ Override public boolean analyzeJar ( Analyzer analyzer ) throws Exception { try { if ( scanAgain ) { //this will only have an effect on the first scan, because subsequent scanAgain //will use the errorMarker to decide if to scan again resetErrorMarker ( ) ; List < String > newlyAddedPackages = new ArrayList < String > ( ) ; System . out . println ( "ImportlessPackager plugin: iteration " + iteration ) ; // set up exclude filter setupFilters ( analyzer ) ; // collect dependency packages Set < PackageRef > importedPackages = collectDependencies ( analyzer ) ; Jar outputJar = analyzer . getJar ( ) ; //loop through the referred packages for ( PackageRef ref : importedPackages ) { String packageName = ref . getFQN ( ) ; System . out . println ( "Seeking package " + packageName ) ; boolean foundPackage = false ; // locate the package in the classpath and add it the the export for ( Jar src : analyzer . getClasspath ( ) ) { if ( src . getPackages ( ) . contains ( packageName ) ) { foundPackage = true ; System . out . println ( "Found matching pkg " + packageName + " from " + src . getSource ( ) . getAbsolutePath ( ) ) ; //only want to include the package itself, not any sub-packages //can provide an Instruction to bnd for this, but it gets a bit weird: //match the package name plus a / since everything in the package will //have the package path followed by a separator. //We use [/|/] to match the single / because bnd needs something to serve //as a wildcard to enable regex matching (otherwise it just does an equals match) //we can't use the other wildcards e.g. * ? because bnd processes them into //.?, .* to do an any character match //If we don't want any sub package content we can't allow any more slashes //so use [^/]+ (i.e. not / 1 or more times) outputJar . addAll ( src , new Instruction ( ref . getPath ( ) + "[/|/][^/]+" ) ) ; newlyAddedPackages . add ( packageName ) ; //we don't break the outer loop in case of split packages (ick!) //since we might find some additional content for this package in another jar } } if ( ! foundPackage ) { //we couldn't find the package on the classpath, fail the build //with a helpful message String errorMsg = "Package " + packageName + " not found for inclusion in jar. Is the package available on the projects classpath?" ; error ( errorMsg ) ; } } //add all the newly added packages to our global list so we don't check them again if ( newlyAddedPackages . isEmpty ( ) ) { //no new packages, no further scanning required scanAgain = false ; } else { addedPackages . addAll ( newlyAddedPackages ) ; iteration ++ ; if ( iteration > LAST_ITERATION ) { //there are new packages but we've run out of iterations, fail the build error ( "Maximum number of plugin iterations reached, but there were still new packages to analyze. Consider adding more iterations." ) ; } } //don't bother scanning again if we've already had an error if ( scanAgain == true && errorMarker . exists ( ) ) scanAgain = false ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; System . out . println ( ex . getMessage ( ) ) ; } //tell bnd to reanalyze the classpath if we are going to scan again return scanAgain ; }
|
all class types that need to be exported
| 791
| 8
|
160,904
|
private void collectClassDependencies ( Clazz classInstance , Analyzer analyzer ) throws Exception { // retrieve the imports from the known class path Set < TypeRef > importedClasses = classInstance . parseClassFile ( ) ; for ( TypeRef importedClass : importedClasses ) { if ( canBeSkipped ( importedClass ) ) // validate the import continue ; // find the class in the classpath Clazz classInstanceImported = analyzer . findClass ( importedClass ) ; if ( classInstanceImported == null ) error ( "Referenced class " + importedClass . getFQN ( ) + " not found for inclusion in jar. It is imported by " + classInstance . getAbsolutePath ( ) ) ; // update the imports map importedReferencedTypes . add ( importedClass ) ; allReferencedTypes . add ( importedClass ) ; // collect dependencies introduced by the imports collectClassDependencies ( classInstanceImported , analyzer ) ; } }
|
Collect the imports from a class and add the imported classes to the map of all known classes importedReferencedTypes is updated to contain newly added imports allReferencedTypes is updated to avoid the duplicated process
| 208
| 43
|
160,905
|
private boolean canBeSkipped ( TypeRef importedClass ) { // skip known imported classes and the ones in JRE if ( allReferencedTypes . contains ( importedClass ) || importedReferencedTypes . contains ( importedClass ) || importedClass . isJava ( ) ) return true ; // Skip the imported classes which are excluded String classPackage = importedClass . getPackageRef ( ) . getFQN ( ) ; for ( String excludePrefix : excludePrefixes ) { // skip by the package prefix if ( classPackage . startsWith ( excludePrefix ) ) return true ; } if ( excludes . contains ( classPackage ) ) // skip by the full package name return true ; return classPackage . length ( ) < 2 ; // special situation for the primitive array }
|
check whether a imported class should be considered in further dependency check
| 163
| 12
|
160,906
|
private Set < PackageRef > collectPackageDependencies ( ) { Set < PackageRef > referencedPackages = new HashSet < PackageRef > ( ) ; for ( TypeRef newReferencedType : importedReferencedTypes ) { PackageRef packageRef = newReferencedType . getPackageRef ( ) ; if ( referencedPackages . contains ( packageRef ) ) // package already known continue ; referencedPackages . add ( packageRef ) ; System . out . println ( "Add package: " + packageRef . getFQN ( ) ) ; } return referencedPackages ; }
|
Collect the referenced packages information from the referenced classes information
| 125
| 10
|
160,907
|
public boolean addMetatypeAd ( MetatypeAd metatypeAd ) { if ( this . metatypeAds == null ) this . metatypeAds = new LinkedList < MetatypeAd > ( ) ; for ( MetatypeAd ad : metatypeAds ) if ( ad . getID ( ) . equals ( metatypeAd . getID ( ) ) ) return false ; this . metatypeAds . add ( metatypeAd ) ; return true ; }
|
Adds a metatype AD .
| 110
| 7
|
160,908
|
public synchronized void prepareSocket ( ) throws IOException { if ( ! prepared ) { final long fd = getFileDescriptor ( ) ; if ( fd == INVALID_SOCKET ) { throw new AsyncException ( AsyncProperties . aio_handle_unavailable ) ; } channelIdentifier = provider . prepare2 ( fd , asyncChannelGroup . getCompletionPort ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareSocket - socket prepared, fd = " + fd + " channel id: " + channelIdentifier + " " + ", local: " + channel . socket ( ) . getLocalSocketAddress ( ) + ", remote: " + channel . socket ( ) . getRemoteSocketAddress ( ) ) ; } long callid = 0 ; // init to zero, reset when IO requested readIOCB = ( CompletionKey ) AsyncLibrary . completionKeyPool . get ( ) ; if ( readIOCB != null ) { // initialize the IOCB from the pool readIOCB . initializePoolEntry ( channelIdentifier , callid ) ; writeIOCB = ( CompletionKey ) AsyncLibrary . completionKeyPool . get ( ) ; if ( writeIOCB != null ) { // initialize the IOCB from the pool writeIOCB . initializePoolEntry ( channelIdentifier , callid ) ; } else { writeIOCB = new CompletionKey ( channelIdentifier , callid , defaultBufferCount ) ; } } else { readIOCB = new CompletionKey ( channelIdentifier , callid , defaultBufferCount ) ; writeIOCB = new CompletionKey ( channelIdentifier , callid , defaultBufferCount ) ; } provider . initializeIOCB ( readIOCB ) ; provider . initializeIOCB ( writeIOCB ) ; prepared = true ; } }
|
Perform initialization steps for this new connection .
| 419
| 9
|
160,909
|
public String getParameterClassName ( String attributeName , JspCoreContext context ) throws JspCoreException { String parameterClassName = null ; if ( parameterClassNameMap == null ) { parameterClassNameMap = new HashMap ( ) ; } parameterClassName = ( String ) parameterClassNameMap . get ( attributeName ) ; if ( parameterClassName == null ) { TagAttributeInfo [ ] attributeInfos = ti . getAttributes ( ) ; for ( int i = 0 ; i < attributeInfos . length ; i ++ ) { if ( attributeInfos [ i ] . getName ( ) . equals ( attributeName ) ) { //PK69319 if ( attributeInfos [ i ] . isFragment ( ) ) { parameterClassName = "javax.servlet.jsp.tagext.JspFragment" ; } else { parameterClassName = attributeInfos [ i ] . getTypeName ( ) ; } parameterClassNameMap . put ( attributeName , parameterClassName ) ; break ; } } } return ( parameterClassName ) ; }
|
PK36246 && 417178 override method in TagClassInfo but since we aren t loading a class right now we don t have to worry about the classpath in the context
| 229
| 35
|
160,910
|
public ReturnCode rollback ( ) { while ( ! history . isEmpty ( ) ) { final Action action = ( Action ) history . pop ( ) ; final ReturnCode ret = action . execute ( ) ; if ( ret . getCode ( ) != 0 ) { return ret ; } } return ReturnCode . OK ; }
|
Attempts to undo changes in reverse order of actions taken ;
| 67
| 11
|
160,911
|
public void updateState ( SSLContext context , SSLEngine engine , SSLEngineResult result , WsByteBuffer decNetBuf , int position , int limit ) { this . sslContext = context ; this . sslEngine = engine ; this . sslEngineResult = result ; this . decryptedNetBuffer = decNetBuf ; this . netBufferPosition = position ; this . netBufferLimit = limit ; }
|
Update this state object with current information . This is called when a YES response comes from the discriminator . The position and limit must be saved here so the ready method can adjust them right away .
| 92
| 39
|
160,912
|
private void setXMLBeanInterface ( String homeInterfaceName , String interfaceName ) // F743-32443 throws InjectionException { // If a home or business interface was specified in XML, then set that as // the injection type. Both may be null if the XML just provides an // override of an annotation to add <ejb-link>... in which case the // injection class type will be set when the annotation is processed. // For performance, there is no need to load these classes until first // accessed, which might be never if there is a binding file, so just the // name will be set here. getInjectionClassType() is then overridden to load // the class when needed. Prior to EJB 3.0 these interfaces were completely // ignored, so this behavior allows EJB 2.1 apps to continue to function // even if they had garbage in their deployment descriptor. d739281 if ( homeInterfaceName != null && homeInterfaceName . length ( ) != 0 ) // d668376 { ivHomeInterface = true ; setInjectionClassTypeName ( homeInterfaceName ) ; if ( isValidationLoggable ( ) ) { loadClass ( homeInterfaceName , isValidationFailable ( ) ) ; loadClass ( interfaceName , isValidationFailable ( ) ) ; } } else if ( interfaceName != null && interfaceName . length ( ) != 0 ) // d668376 { ivBeanInterface = true ; setInjectionClassTypeName ( interfaceName ) ; if ( isValidationLoggable ( ) ) { loadClass ( interfaceName , isValidationFailable ( ) ) ; } } }
|
Sets the beanInterface as specified by XML .
| 348
| 10
|
160,913
|
private void setBindingName ( ) // d681743 throws InjectionException { Map < String , String > ejbRefBindings = ivNameSpaceConfig . getEJBRefBindings ( ) ; if ( ejbRefBindings != null ) { ivBindingName = ejbRefBindings . get ( getJndiName ( ) ) ; if ( ivBindingName != null && ivBindingName . equals ( "" ) ) { ivBindingName = null ; Tr . warning ( tc , "EJB_BOUND_TO_EMPTY_STRING_CWNEN0025W" ) ; if ( isValidationFailable ( ) ) // fail if enabled F743-14449 { InjectionConfigurationException icex = new InjectionConfigurationException ( "The " + getJndiName ( ) + " EJB reference in the " + ivModule + " module of the " + ivApplication + " application has been" + " bound to the empty string in the global Java Naming and Directory Interface (JNDI) namespace." ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "resolve : " + icex ) ; throw icex ; } } } }
|
Returns true if the user has configured a binding for this reference .
| 278
| 13
|
160,914
|
@ Override public void addInjectionTarget ( Member member ) throws InjectionException { // If the beanName attribute was found in the constructor or merge // method, then save the class of where it was located. if ( ivBeanName != null && ivBeanNameClass == null ) { ivBeanNameClass = member . getDeclaringClass ( ) ; } super . addInjectionTarget ( member ) ; }
|
d638111 . 1
| 89
| 6
|
160,915
|
@ Override public void visitInsn ( int opcode ) { if ( opcode == ATHROW && ! enabledListeners . isEmpty ( ) ) { String key = createKey ( ) ; ProbeImpl probe = getProbe ( key ) ; long probeId = probe . getIdentifier ( ) ; setProbeInProgress ( true ) ; visitInsn ( DUP ) ; // throwable throwable visitLdcInsn ( Long . valueOf ( probeId ) ) ; // throwable throwable long1 long2 visitInsn ( DUP2_X1 ) ; // throwable long1 long2 throwable long1 long2 visitInsn ( POP2 ) ; // throwable long1 long2 throwable if ( isStatic ( ) ) { visitInsn ( ACONST_NULL ) ; // throwable long1 long2 throwable this } else { visitVarInsn ( ALOAD , 0 ) ; // throwable long1 long2 throwable this } visitInsn ( SWAP ) ; // throwable long1 long2 this throwable visitInsn ( ACONST_NULL ) ; // throwable long1 long2 this throwable null visitInsn ( SWAP ) ; // throwable long1 long2 this null throwable visitFireProbeInvocation ( ) ; // throwable setProbeInProgress ( false ) ; setProbeListeners ( probe , enabledListeners ) ; } super . visitInsn ( opcode ) ; }
|
Inject code to fire a probe before any throw instruction .
| 312
| 12
|
160,916
|
public void addData ( int index , byte [ ] data ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addData" , new java . lang . Object [ ] { new Integer ( index ) , RLSUtils . toHexString ( data , RLSUtils . MAX_DISPLAY_BYTES ) , this } ) ; // If the parent recovery log instance has experienced a serious internal error then prevent // this operation from executing. if ( _recLog . failed ( ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addData" , this ) ; throw new InternalLogException ( null ) ; } // we use an index value of 0 to indicate that it is a singledata RUsection // so adjust now ... if (!_singleData) or if(index != 0) if ( index > 0 ) index -- ; // list items may be added in any order, so it may be necessary to (temporarily) pad the list final int currentSize = _writtenData . size ( ) ; if ( index == currentSize ) _writtenData . add ( /*index,*/ data ) ; else if ( index < currentSize ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "NMTEST: Replacing item (expect trace 'null') at index: " + index , _writtenData . get ( index ) ) ; _writtenData . set ( index , data ) ; } else // index > currentSize { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "NMTEST: Adding null elements: " + ( index - currentSize ) ) ; while ( index -- > currentSize ) _writtenData . add ( null ) ; _writtenData . add ( data ) ; } // set lastdata. This method is called during recovery and we shouldn't get asked for // any data until all log records are read. So set lastdata to be the item at the current size // of the array. Items may be added in random order, so lastitem will be correct when // all items have been added _lastDataItem = ( byte [ ] ) _writtenData . get ( _writtenData . size ( ) - 1 ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addData" ) ; }
|
recovery method to add data directly to _writtenData array
| 507
| 13
|
160,917
|
public int identity ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "identity" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "identity" , new Integer ( _identity ) ) ; return _identity ; }
|
Returns the identity of the recoverable unit section .
| 66
| 10
|
160,918
|
public static int decode ( WsByteBuffer headerBlock , int N ) { // if (!headerBlock.hasRemaining()) { // throw new HeaderFieldDecodingException("No length to decode"); // } int I = HpackUtils . getLSB ( headerBlock . get ( ) , N ) ; if ( I < HpackUtils . ipow ( 2 , N ) - 1 ) { return I ; } else { int M = 0 ; boolean done = false ; byte b ; while ( done == false ) { // If there are no further elements, this is an invalid HeaderBlock. // If this decode method is called, there should always be header // key value bytes after the integer representation. // if (!headerBlock.hasRemaining()) { // throw new HeaderFieldDecodingException(""); // } b = headerBlock . get ( ) ; I = I + ( ( b ) & 127 ) * HpackUtils . ipow ( 2 , M ) ; M = M + 7 ; if ( ( ( b & 128 ) == 128 ) == false ) done = true ; } return I ; } }
|
Decodes a provided byte array that was encoded using an N - bit prefix .
| 235
| 16
|
160,919
|
static protected int getPadBits ( int bitString ) { int val = 0 ; for ( int i = 3 ; i >= 0 ; i -- ) { // // this may look a little odd, but if it isn't done like this pre jdk1.2 // JVM's break! // if ( i != 0 ) { if ( ( bitString >> ( i * 8 ) ) != 0 ) { val = ( bitString >> ( i * 8 ) ) & 0xFF ; break ; } } else { if ( bitString != 0 ) { val = bitString & 0xFF ; break ; } } } if ( val == 0 ) { return 7 ; } int bits = 1 ; while ( ( ( val <<= 1 ) & 0xFF ) != 0 ) { bits ++ ; } return 8 - bits ; }
|
return the correct number of pad bits for a bit string defined in a 32 bit constant
| 175
| 17
|
160,920
|
static protected byte [ ] getBytes ( int bitString ) { int bytes = 4 ; for ( int i = 3 ; i >= 1 ; i -- ) { if ( ( bitString & ( 0xFF << ( i * 8 ) ) ) != 0 ) { break ; } bytes -- ; } byte [ ] result = new byte [ bytes ] ; for ( int i = 0 ; i < bytes ; i ++ ) { result [ i ] = ( byte ) ( ( bitString >> ( i * 8 ) ) & 0xFF ) ; } return result ; }
|
return the correct number of bytes for a bit string defined in a 32 bit constant
| 118
| 16
|
160,921
|
public static DERBitString getInstance ( Object obj ) { if ( obj == null || obj instanceof DERBitString ) { return ( DERBitString ) obj ; } if ( obj instanceof ASN1OctetString ) { byte [ ] bytes = ( ( ASN1OctetString ) obj ) . getOctets ( ) ; int padBits = bytes [ 0 ] ; byte [ ] data = new byte [ bytes . length - 1 ] ; System . arraycopy ( bytes , 1 , data , 0 , bytes . length - 1 ) ; return new DERBitString ( data , padBits ) ; } if ( obj instanceof ASN1TaggedObject ) { return getInstance ( ( ( ASN1TaggedObject ) obj ) . getObject ( ) ) ; } throw new IllegalArgumentException ( "illegal object in getInstance: " + obj . getClass ( ) . getName ( ) ) ; }
|
return a Bit String from the passed in object
| 200
| 9
|
160,922
|
private AuthenticationResult handleBasicAuth ( String inRealm , HttpServletRequest req , HttpServletResponse res ) { AuthenticationResult result = null ; String hdrValue = req . getHeader ( BASIC_AUTH_HEADER_NAME ) ; if ( hdrValue == null || ! hdrValue . startsWith ( "Basic " ) ) { result = new AuthenticationResult ( AuthResult . SEND_401 , inRealm , AuditEvent . CRED_TYPE_BASIC , null , AuditEvent . OUTCOME_CHALLENGE ) ; return result ; } // Parse the username & password from the header. String encoding = req . getHeader ( "Authorization-Encoding" ) ; hdrValue = decodeBasicAuth ( hdrValue . substring ( 6 ) , encoding ) ; int idx = hdrValue . indexOf ( ' ' ) ; if ( idx < 0 ) { result = new AuthenticationResult ( AuthResult . SEND_401 , inRealm , AuditEvent . CRED_TYPE_BASIC , null , AuditEvent . OUTCOME_CHALLENGE ) ; return result ; } String username = hdrValue . substring ( 0 , idx ) ; String password = hdrValue . substring ( idx + 1 ) ; return basicAuthenticate ( inRealm , username , password , req , res ) ; }
|
handleBasicAuth generates AuthenticationResult This routine invokes basicAuthenticate which also generates AuthenticationResult .
| 298
| 19
|
160,923
|
protected String getBasicAuthRealmName ( WebRequest webRequest ) { SecurityMetadata securityMetadata = webRequest . getSecurityMetadata ( ) ; if ( securityMetadata != null ) { LoginConfiguration loginConfig = securityMetadata . getLoginConfiguration ( ) ; if ( loginConfig != null && loginConfig . getRealmName ( ) != null ) { return loginConfig . getRealmName ( ) ; } if ( config . getDisplayAuthenticationRealm ( ) ) { return userRegistry . getRealm ( ) ; } } String realm = "defaultRealm" ; return realm ; }
|
Return a realm name if it s defined in the web . xml file . If it s not defined in the web . xml and displayAuthenticationRealm is set to true then return the userRegistry realm . Otherwise return the realm as Default Realm .
| 128
| 51
|
160,924
|
@ Sensitive protected String decodeBasicAuth ( String data , String encoding ) { String output = "" ; byte decodedByte [ ] = null ; decodedByte = Base64Coder . base64DecodeString ( data ) ; if ( decodedByte != null && decodedByte . length > 0 ) { boolean decoded = false ; if ( encoding != null ) { try { output = new String ( decodedByte , encoding ) ; decoded = true ; } catch ( Exception e ) { // fall back not to use encoding.. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "An exception is caught using the encoder: " + encoding + ". The exception is: " + e . getMessage ( ) ) ; } } } if ( ! decoded ) { output = new String ( decodedByte ) ; } } return output ; }
|
2 . This method intentionally returns empty string in case of error . With that a caller doesn t need to check null object prior to introspect it .
| 195
| 30
|
160,925
|
public static boolean isUninstallable ( Set < IFixInfo > installedFixes , IFixInfo fixToBeUninstalled ) { if ( Boolean . valueOf ( System . getenv ( S_DISABLE ) ) . booleanValue ( ) ) { return true ; } if ( fixToBeUninstalled != null ) { for ( IFixInfo fix : installedFixes ) { if ( ! ( fixToBeUninstalled . getId ( ) . equals ( fix . getId ( ) ) ) && ! confirmNoFileConflicts ( fixToBeUninstalled . getUpdates ( ) . getFiles ( ) , fix . getUpdates ( ) . getFiles ( ) ) ) { if ( ! isSupersededBy ( fix . getResolves ( ) . getProblems ( ) , fixToBeUninstalled . getResolves ( ) . getProblems ( ) ) ) { return false ; } } } return true ; } return false ; }
|
Return true if fixToBeUninstalled can be uninstalled . fixToBeUninstalled can only be uninstalled if there are no file conflicts with other fixes in the installedFixes Set that supersedes fixToBeUninstalled
| 202
| 47
|
160,926
|
public boolean isUninstallable ( UninstallAsset uninstallAsset , Set < IFixInfo > installedFixes , List < UninstallAsset > uninstallAssets ) { if ( Boolean . valueOf ( System . getenv ( S_DISABLE ) ) . booleanValue ( ) ) { return true ; } IFixInfo fixToBeUninstalled = uninstallAsset . getIFixInfo ( ) ; for ( IFixInfo fix : installedFixes ) { if ( ! ( fixToBeUninstalled . getId ( ) . equals ( fix . getId ( ) ) ) ) { if ( ( ! confirmNoFileConflicts ( fixToBeUninstalled . getUpdates ( ) . getFiles ( ) , fix . getUpdates ( ) . getFiles ( ) ) ) && ( ! isSupersededBy ( fix . getResolves ( ) . getProblems ( ) , fixToBeUninstalled . getResolves ( ) . getProblems ( ) ) ) ) if ( ! isToBeUninstalled ( fix . getId ( ) , uninstallAssets ) ) return false ; } } return true ; }
|
Verfiy whether the fix is uninstallable and there is no other installed fix still require this feature .
| 235
| 21
|
160,927
|
public static ArrayList < String > fixRequiredByFeature ( String fixApar , Map < String , ProvisioningFeatureDefinition > installedFeatures ) { ArrayList < String > dependencies = new ArrayList < String > ( ) ; for ( ProvisioningFeatureDefinition fd : installedFeatures . values ( ) ) { String requireFixes = fd . getHeader ( "IBM-Require-Fix" ) ; if ( requireFixes != null && requireFixes . length ( ) > 0 ) { String [ ] apars = requireFixes . split ( ";" ) ; for ( String apar : apars ) { if ( apar . trim ( ) . equals ( fixApar . trim ( ) ) ) { dependencies . add ( apar ) ; } } } } if ( dependencies . isEmpty ( ) ) return null ; return dependencies ; }
|
Determine the fix apar is required by one of the installed features
| 179
| 15
|
160,928
|
public List < UninstallAsset > determineOrder ( List < UninstallAsset > list ) { if ( list != null ) { List < FixDependencyComparator > fixCompareList = new ArrayList < FixDependencyComparator > ( ) ; // Initialize the feature comparator for ( UninstallAsset asset : list ) { fixCompareList . add ( new FixDependencyComparator ( asset . getIFixInfo ( ) ) ) ; } // Sort the feature list Collections . sort ( fixCompareList , new FixDependencyComparator ( ) ) ; List < UninstallAsset > newList = new ArrayList < UninstallAsset > ( ) ; for ( FixDependencyComparator f : fixCompareList ) { newList . add ( new UninstallAsset ( f . getIfixInfo ( ) ) ) ; } return newList ; } return list ; }
|
Determine the order of the fixes according to their dependency
| 186
| 12
|
160,929
|
private static boolean isSupersededBy ( List < Problem > apars1 , List < Problem > apars2 ) { boolean result = true ; // Now iterate over the current list of problems, and see if the incoming IFixInfo contains all of the problems from this IfixInfo. // If it does then return true, to indicate that this IFixInfo object has been superseded. for ( Iterator < Problem > iter1 = apars1 . iterator ( ) ; iter1 . hasNext ( ) ; ) { boolean currAparMatch = false ; Problem currApar1 = iter1 . next ( ) ; for ( Iterator < Problem > iter2 = apars2 . iterator ( ) ; iter2 . hasNext ( ) ; ) { Problem currApar2 = iter2 . next ( ) ; if ( currApar1 . getDisplayId ( ) . equals ( currApar2 . getDisplayId ( ) ) ) { currAparMatch = true ; } } if ( ! currAparMatch ) result = false ; } return result ; }
|
Returns if the apars list apars1 is superseded by apars2 . Apars1 is superseded by apars2 if all the apars in apars1 is also included in apars2
| 233
| 43
|
160,930
|
private static boolean confirmNoFileConflicts ( Set < UpdatedFile > updatedFiles1 , Set < UpdatedFile > updatedFiles2 ) { for ( Iterator < UpdatedFile > iter1 = updatedFiles1 . iterator ( ) ; iter1 . hasNext ( ) ; ) { UpdatedFile currFile1 = iter1 . next ( ) ; for ( Iterator < UpdatedFile > iter2 = updatedFiles2 . iterator ( ) ; iter2 . hasNext ( ) ; ) { UpdatedFile currFile2 = iter2 . next ( ) ; if ( currFile1 . getId ( ) . equals ( currFile2 . getId ( ) ) ) { return false ; } } } return true ; }
|
Confirms that UpdatedFile lists does not contain any common files
| 150
| 12
|
160,931
|
@ Override public void close ( boolean deleteProgressFile ) { final String methodName = "close()" ; traceDebug ( methodName , "cacheName=" + this . cacheName + " deleteProgressFile=" + deleteProgressFile ) ; if ( deleteProgressFile ) { // 316654 // remove the InProgress (dummy) file when close deleteInProgressFile ( ) ; } try { htod . close ( ) ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.close" , "574" , this ) ; traceDebug ( methodName , "cacheName=" + this . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } }
|
Call this method to close the disk file manager and operation .
| 180
| 12
|
160,932
|
@ Override public int writeAuxiliaryDepTables ( ) { int returnCode = htod . writeAuxiliaryDepTables ( ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } else { updatePropertyFile ( ) ; } return returnCode ; }
|
Call this method to offload auxiliary dependency tables to the disk and update property file .
| 83
| 17
|
160,933
|
private void readLastScanFile ( ) { final String methodName = "readLastScanFile()" ; final File f = new File ( lastScanFileName ) ; traceDebug ( methodName , "cacheName=" + this . cacheName ) ; if ( f . exists ( ) ) { final CacheOnDisk cod = this ; AccessController . doPrivileged ( new PrivilegedAction ( ) { @ Override public Object run ( ) { FileInputStream fis = null ; ObjectInputStream ois = null ; try { fis = new FileInputStream ( f ) ; ois = new ObjectInputStream ( fis ) ; cod . lastScanTime = ois . readLong ( ) ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.readLastScanFile" , "611" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } finally { try { if ( ois != null ) { ois . close ( ) ; } if ( fis != null ) { fis . close ( ) ; } } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.readLastScanFile" , "622" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } } return null ; } } ) ; } }
|
Call this method to read the timestamp of the last scan in Last Scan file .
| 379
| 16
|
160,934
|
protected void updateLastScanFile ( ) { final String methodName = "updateLastScanFile()" ; final File f = new File ( lastScanFileName ) ; final CacheOnDisk cod = this ; traceDebug ( methodName , "cacheName=" + this . cacheName ) ; AccessController . doPrivileged ( new PrivilegedAction ( ) { @ Override public Object run ( ) { FileOutputStream fos = null ; ObjectOutputStream oos = null ; try { fos = new FileOutputStream ( f ) ; oos = new ObjectOutputStream ( fos ) ; oos . writeLong ( System . currentTimeMillis ( ) ) ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.updateLastScanFile" , "650" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } finally { try { if ( oos != null ) { oos . close ( ) ; } if ( fos != null ) { fos . close ( ) ; } } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.updateLastScanFile" , "661" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } } return null ; } } ) ; }
|
Call this method to update the timestamp of the last scan in Last Scan file .
| 369
| 16
|
160,935
|
private void deletePropertyFile ( ) { final String methodName = "deletePropertyFile()" ; final File f = new File ( htodPropertyFileName ) ; final CacheOnDisk cod = this ; traceDebug ( methodName , "cacheName=" + this . cacheName ) ; AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { try { f . delete ( ) ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.deletePropertyFile" , "883" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } return null ; } } ) ; }
|
Call this method to delete the HTOD property file .
| 187
| 11
|
160,936
|
public void deleteDiskCacheFiles ( ) { final String methodName = "deleteDiskCacheFiles()" ; final File f = new File ( swapDirPath ) ; final CacheOnDisk cod = this ; traceDebug ( methodName , "cacheName=" + this . cacheName ) ; AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { // delete files File fl [ ] = f . listFiles ( ) ; for ( int i = 0 ; i < fl . length ; i ++ ) { try { fl [ i ] . delete ( ) ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.deleteDiskCacheFiles" , "908" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } } return null ; } } ) ; }
|
Call this method to delete all disk cache files per cache instance .
| 224
| 13
|
160,937
|
protected ValueSet readAndDeleteInvalidationFile ( ) { final String methodName = "readAndDeleteInvalidationFile()" ; final File f = new File ( invalidationFileName ) ; final CacheOnDisk cod = this ; this . valueSet = new ValueSet ( 1 ) ; if ( f . exists ( ) ) { AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { FileInputStream fis = null ; ObjectInputStream ois = null ; try { fis = new FileInputStream ( f ) ; ois = new ObjectInputStream ( fis ) ; int size = ois . readInt ( ) ; cod . valueSet = new ValueSet ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { cod . valueSet . add ( ois . readObject ( ) ) ; } } catch ( Throwable t1 ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t1 , "com.ibm.ws.cache.CacheOnDisk.readAndDeleteInvalidationFile" , "1056" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t1 ) ) ; } finally { try { if ( ois != null ) { ois . close ( ) ; } if ( fis != null ) { fis . close ( ) ; } f . delete ( ) ; } catch ( Throwable t2 ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t2 , "com.ibm.ws.cache.CacheOnDisk.readAndDeleteInvalidationFile" , "1068" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t2 ) ) ; } } return null ; } } ) ; } traceDebug ( methodName , "cacheName=" + this . cacheName + " " + invalidationFileName + " valueSet=" + valueSet . size ( ) ) ; return this . valueSet ; }
|
Call this method to read in all invalidation cache ids if the invalidation file exists . and then delete the invalidation file .
| 476
| 27
|
160,938
|
protected void createInvalidationFile ( ) { final String methodName = "createInvalidationFile()" ; final File f = new File ( invalidationFileName ) ; final CacheOnDisk cod = this ; traceDebug ( methodName , "cacheName=" + this . cacheName + " valueSet=" + cod . valueSet . size ( ) ) ; AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { FileOutputStream fos = null ; ObjectOutputStream oos = null ; try { fos = new FileOutputStream ( f ) ; oos = new ObjectOutputStream ( fos ) ; oos . writeInt ( cod . valueSet . size ( ) ) ; Iterator it = valueSet . iterator ( ) ; while ( it . hasNext ( ) ) { Object entryId = it . next ( ) ; oos . writeObject ( entryId ) ; } } catch ( Throwable t1 ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t1 , "com.ibm.ws.cache.CacheOnDisk.createInvalidationFile" , "1106" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t1 ) ) ; } finally { try { oos . close ( ) ; fos . close ( ) ; } catch ( Throwable t2 ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t2 , "com.ibm.ws.cache.CacheOnDisk.createInvalidationFile" , "1113" , cod ) ; traceDebug ( methodName , "cacheName=" + cod . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t2 ) ) ; } } return null ; } } ) ; }
|
Call this method to create invalidation file to offload the invalidation cache ids . When the server is restarted the invalidation cache ids are read back . The LPBT will be called to remove these cache ids from the disk .
| 412
| 50
|
160,939
|
public void alarm ( final Object alarmContext ) { final String methodName = "alarm()" ; synchronized ( this ) { if ( ! stopping && ! this . htod . invalidationBuffer . isDiskClearInProgress ( ) ) { this . htod . invalidationBuffer . invokeBackgroundInvalidation ( HTODInvalidationBuffer . SCAN ) ; } else if ( stopping ) { traceDebug ( methodName , "cacheName=" + this . cacheName + " abort disk cleanup because of server is stopping." ) ; } else { if ( cleanupFrequency == 0 ) { sleepTime = calculateSleepTime ( ) ; } traceDebug ( methodName , "cacheName=" + this . cacheName + " disk clear is in progress - skip disk scan and set alarm sleepTime=" + sleepTime ) ; Scheduler . createNonDeferrable ( sleepTime , alarmContext , new Runnable ( ) { @ Override public void run ( ) { alarm ( alarmContext ) ; } } ) ; } } }
|
Call this method when the alarm is triggered . It is being checked to see whether a disk cleanup is scheduled to run .
| 214
| 24
|
160,940
|
public void clearDiskCache ( ) { if ( htod . clearDiskCache ( ) == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } else { updateLastScanFile ( ) ; updatePropertyFile ( ) ; createInProgressFile ( ) ; } }
|
Call this method to clear the disk cache per cache instance .
| 75
| 12
|
160,941
|
public int writeCacheEntry ( CacheEntry ce ) { // @A5C int returnCode = htod . writeCacheEntry ( ce ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } return returnCode ; }
|
Call this method to write a cache entry to the disk .
| 72
| 12
|
160,942
|
public CacheEntry readCacheEntry ( Object id ) { // SKS-O Result result = htod . readCacheEntry ( id ) ; if ( result . returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( result . diskException ) ; this . htod . returnToResultPool ( result ) ; return null ; } CacheEntry cacheEntry = ( CacheEntry ) result . data ; this . htod . returnToResultPool ( result ) ; return cacheEntry ; }
|
Call this method to read a cache entry from the disk .
| 112
| 12
|
160,943
|
public void delCacheEntry ( CacheEntry ce , int cause , int source , boolean fromDepIdTemplateInvalidation ) { htod . delCacheEntry ( ce , cause , source , fromDepIdTemplateInvalidation ) ; }
|
Call this method to a cache entry from the disk .
| 48
| 11
|
160,944
|
public void delCacheEntry ( ValueSet removeList , int cause , int source , boolean fromDepIdTemplateInvalidation , boolean fireEvent ) { htod . delCacheEntry ( removeList , cause , source , fromDepIdTemplateInvalidation , fireEvent ) ; }
|
Call this method to remove multiple of cache ids from the disk .
| 57
| 14
|
160,945
|
public ValueSet readDependency ( Object id , boolean delete ) { // SKS-O Result result = htod . readDependency ( id , delete ) ; if ( result . returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( result . diskException ) ; this . htod . returnToResultPool ( result ) ; return HTODDynacache . EMPTY_VS ; } ValueSet valueSet = ( ValueSet ) result . data ; if ( valueSet == null ) { valueSet = HTODDynacache . EMPTY_VS ; } this . htod . returnToResultPool ( result ) ; return valueSet ; }
|
Call this method to read a specified dependency id which contains the cache ids from the disk .
| 153
| 19
|
160,946
|
public ValueSet readTemplate ( String template , boolean delete ) { Result result = htod . readTemplate ( template , delete ) ; if ( result . returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( result . diskException ) ; this . htod . returnToResultPool ( result ) ; return HTODDynacache . EMPTY_VS ; } ValueSet valueSet = ( ValueSet ) result . data ; if ( valueSet == null ) { valueSet = HTODDynacache . EMPTY_VS ; } this . htod . returnToResultPool ( result ) ; return valueSet ; }
|
Call this method to read a specified template which contains the cache ids from the disk .
| 144
| 18
|
160,947
|
public ValueSet readTemplatesByRange ( int index , int length ) { Result result = htod . readTemplatesByRange ( index , length ) ; if ( result . returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( result . diskException ) ; this . htod . returnToResultPool ( result ) ; return HTODDynacache . EMPTY_VS ; } ValueSet valueSet = ( ValueSet ) result . data ; if ( valueSet == null ) { valueSet = HTODDynacache . EMPTY_VS ; } this . htod . returnToResultPool ( result ) ; return valueSet ; }
|
Call this method to get the template ids based on the index and the length from the disk .
| 150
| 20
|
160,948
|
public int getCacheIdsSize ( boolean filter ) { if ( filter == CacheOnDisk . FILTER ) { return htod . getCacheIdsSize ( filter ) - htod . invalidationBuffer . size ( ) ; } else { return htod . getCacheIdsSize ( filter ) ; } }
|
Call this method to get the number of the cache ids in the disk .
| 69
| 16
|
160,949
|
public void delDependencyEntry ( Object id , Object entry ) { // SKS-O if ( htod . delDependencyEntry ( id , entry ) == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } }
|
Call this method to delete a cache id from a specified dependency in the disk .
| 69
| 16
|
160,950
|
public void delTemplateEntry ( String template , Object entry ) { if ( htod . delTemplateEntry ( template , entry ) == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } }
|
Call this method to delete a cache id from a specified template in the disk .
| 60
| 16
|
160,951
|
public void delDependency ( Object id ) { // SKS-O if ( htod . delDependency ( id ) == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } }
|
Call this method to delete speciifed dependency id from the disk .
| 62
| 15
|
160,952
|
public void delTemplate ( String template ) { if ( htod . delTemplate ( template ) == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } }
|
Call this method to delete speciifed template from the disk .
| 53
| 14
|
160,953
|
public int writeDependency ( Object id , ValueSet vs ) { // SKS-O int returnCode = htod . writeDependency ( id , vs ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } return returnCode ; }
|
Call this method to write a dependency id with a collection of cache ids to the disk .
| 79
| 19
|
160,954
|
public int writeTemplate ( String template , ValueSet vs ) { int returnCode = htod . writeTemplate ( template , vs ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } return returnCode ; }
|
Call this method to write a template with a collection of cache ids to the disk .
| 70
| 18
|
160,955
|
public int writeDependencyEntry ( Object id , Object entry ) { // SKS-O int returnCode = htod . writeDependencyEntry ( id , entry ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } return returnCode ; }
|
Call this method to add a cache id for a specified dependency id to the disk .
| 80
| 17
|
160,956
|
public int writeTemplateEntry ( String template , Object entry ) { int returnCode = htod . writeTemplateEntry ( template , entry ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } return returnCode ; }
|
Call this method to add a cache id for a specified template to the disk .
| 71
| 16
|
160,957
|
protected long calculateSleepTime ( ) { Calendar c = new GregorianCalendar ( ) ; int currentHour = c . get ( Calendar . HOUR_OF_DAY ) ; int currentMin = c . get ( Calendar . MINUTE ) ; int currentSec = c . get ( Calendar . SECOND ) ; long stime = SECONDS_FOR_24_HOURS - ( ( currentHour * 60 + currentMin ) * 60 + currentSec ) + cleanupHour * 60 * 60 ; if ( stime > SECONDS_FOR_24_HOURS ) { stime = stime - SECONDS_FOR_24_HOURS ; } if ( stime < 10 ) { stime = 10 ; } stime = stime * 1000 ; // convert to msec return stime ; }
|
return the sleep time in msec
| 170
| 6
|
160,958
|
public void clearInvalidationBuffers ( ) { this . htod . invalidationBuffer . clear ( HTODInvalidationBuffer . EXPLICIT_BUFFER ) ; // 3821 NK begin this . htod . invalidationBuffer . clear ( HTODInvalidationBuffer . SCAN_BUFFER ) ; if ( this . evictionPolicy != CacheConfig . EVICTION_NONE ) { this . htod . invalidationBuffer . clear ( HTODInvalidationBuffer . GC_BUFFER ) ; // 3821 NK end } }
|
This method clears invalidaiton buffers in HTODDynacache
| 115
| 14
|
160,959
|
public Result readHashcodeByRange ( int index , int length , boolean debug , boolean useValue ) { // LI4337-17 Result result = this . htod . readHashcodeByRange ( index , length , debug , useValue ) ; if ( result . returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( result . diskException ) ; } return result ; }
|
This method find the hashcode based on index and length .
| 90
| 12
|
160,960
|
public int updateExpirationTime ( Object id , long oldExpirationTime , int size , long newExpirationTime , long newValidatorExpirationTime ) { int returnCode = this . htod . updateExpirationTime ( id , oldExpirationTime , size , newExpirationTime , newValidatorExpirationTime ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } return returnCode ; }
|
This method is used to update expiration times in GC and disk emtry header
| 112
| 15
|
160,961
|
protected int checkDirectoryWriteable ( String location ) { final String methodName = "checkDirectoryWriteable()" ; int rc = CacheOnDisk . LOCATION_OK ; if ( location . equals ( "" ) ) { rc = CacheOnDisk . LOCATION_NOT_DEFINED ; } else if ( location . startsWith ( "${" ) && location . indexOf ( "}" ) > 0 ) { rc = CacheOnDisk . LOCATION_NOT_VALID ; } else { try { File f = new File ( location ) ; if ( ! f . exists ( ) ) { if ( ! f . mkdirs ( ) ) { rc = CacheOnDisk . LOCATION_CANNOT_MAKE_DIR ; } } else if ( ! f . isDirectory ( ) ) { rc = CacheOnDisk . LOCATION_NOT_DIRECTORY ; } else if ( ! f . canWrite ( ) ) { rc = CacheOnDisk . LOCATION_NOT_WRITABLE ; } } catch ( Throwable t ) { rc = CacheOnDisk . LOCATION_NOT_WRITABLE ; com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable" , "1779" , this ) ; traceDebug ( methodName , "cacheName=" + this . cacheName + " location=" + location + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } } traceDebug ( methodName , "cacheName=" + this . cacheName + " location=" + location + " rc=" + rc ) ; return rc ; }
|
Check the location whether it is writable or not
| 359
| 10
|
160,962
|
public static String getRepositorySubpath ( MavenCoordinates artifact ) { StringBuffer buf = new StringBuffer ( ) ; String [ ] groupDirs = artifact . getGroupId ( ) . split ( "\\." ) ; for ( String dir : groupDirs ) { buf . append ( dir ) . append ( "/" ) ; } buf . append ( artifact . getArtifactId ( ) ) . append ( "/" ) . append ( artifact . getVersion ( ) ) ; return buf . toString ( ) ; }
|
Gets the expected path within a Maven repository for the given Maven artifact based on its Maven coordinates .
| 112
| 23
|
160,963
|
public static String getFileName ( MavenCoordinates artifact , Constants . ArtifactType type ) { return artifact . getArtifactId ( ) + "-" + artifact . getVersion ( ) + type . getMavenFileExtension ( ) ; }
|
Gets the expected file name for a Maven artifact based on its Maven coordinates .
| 54
| 18
|
160,964
|
@ Override public void clearBody ( ) throws javax . jms . JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "clearBody" ) ; // Set the message into write-only mode, handle generic actions super . clearBody ( ) ; // Clear the locally stored reference to body of the message, and ensure the // 'read' stream is set to null dataBuffer = null ; dataStart = 0 ; // @P2A readStream = null ; // remove the encoding and character set properties as these pertain to the // body which is being cleared. // SIB0121: also clear the underlying MFP payload if ( jsBytesMsg != null ) { jsBytesMsg . setBytes ( null ) ; jsBytesMsg . setObjectProperty ( ApiJmsConstants . ENCODING_PROPERTY , null ) ; jsBytesMsg . setObjectProperty ( ApiJmsConstants . CHARSET_PROPERTY , null ) ; } integerEncoding = ApiJmsConstants . ENC_INTEGER_NORMAL ; // reset to standard Java encoding floatEncoding = ApiJmsConstants . ENC_FLOAT_IEEE_NORMAL ; // reset to standard Java encoding // Invalidate the cached toString object. cachedBytesToString = null ; // This class has different behaviour depending on the whether the // producer might modify the payload after it's been set or not if ( ! producerWontModifyPayloadAfterSet ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Producer might modify the payload after set - encoding is required, so reinitialise encoding relating variables" ) ; // Prepare a new stream for the client to write to _writeBytes = new ByteArrayOutputStream ( ) ; writeStream = new DataOutputStream ( _writeBytes ) ; // Initialise the arrays used to record the position of numeric items integer_count = 0 ; // number of integer items recorded in the current arrays integer_offsets = new int [ ARRAY_SIZE ] ; // offset of start of each numeric item integer_sizes = new int [ ARRAY_SIZE ] ; // length in byte of the item in question if ( integers != null ) integers . removeAllElements ( ) ; // arrays which we filled up are stored in this vector - remove them all if ( float_offsets != null ) float_offsets . removeAllElements ( ) ; if ( float_values != null ) float_values . removeAllElements ( ) ; // Ensure that the new data gets exported when the time comes. bodySetInJsMsg = false ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Producer has promised not to modify payload - ensure write streams used for encoding are null" ) ; // Ensure the write stream variables are null - they are never used when the // producer has promised not to modify the payload after it's been set _writeBytes = null ; writeStream = null ; // Ensure the producer promise flag is checked correctly in the writeBytes method writeByteArrayCalled = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "clearBody" ) ; }
|
Clear out the message body . All other parts of the message are left untouched .
| 752
| 16
|
160,965
|
@ Override public byte readByte ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readByte" ) ; try { // Check that we are in read mode checkBodyReadable ( "readByte" ) ; if ( requiresInit ) lazyInitForReading ( ) ; // Read the byte from the input stream byte byteRead = readStream . readByte ( ) ; // read the byte if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readByte" , byteRead ) ; return byteRead ; } catch ( IOException e ) { JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( MessageEOFException . class , "END_BYTESMESSAGE_CWSIA0183" , null , tc ) ; jmse . initCause ( e ) ; throw jmse ; } }
|
Read a signed 8 - bit value from the stream message .
| 229
| 12
|
160,966
|
@ Override public int readBytes ( byte [ ] value , int length ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readBytes" , new Object [ ] { value , length } ) ; try { // Check that we are in read mode checkBodyReadable ( "readBytes" ) ; if ( requiresInit ) lazyInitForReading ( ) ; // Check that there's enough room in the byte array supplied by the application for the number of // bytes requested if ( value . length < length || length < 0 ) throw new IndexOutOfBoundsException ( ) ; // Attempt to read into the application's byte array. If there are insufficient bytes in the message readStream // then this method returns the number actually read. If we've reached the end of data, it returns -1 int result = readStream . read ( value , 0 , length ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readBytes" , result ) ; return result ; } catch ( IOException e ) { JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( MessageEOFException . class , "END_BYTESMESSAGE_CWSIA0183" , null , tc ) ; jmse . initCause ( e ) ; throw jmse ; } }
|
Read a portion of the bytes message stream .
| 324
| 9
|
160,967
|
@ Override public char readChar ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readChar" ) ; try { // Check that we are in read mode checkBodyReadable ( "readChar" ) ; if ( requiresInit ) lazyInitForReading ( ) ; // Mark the current position, so we can return to it if there's an error readStream . mark ( 2 ) ; char result = readStream . readChar ( ) ; // Byte swap the character if required if ( integerEncoding == ApiJmsConstants . ENC_INTEGER_REVERSED ) { result = Character . reverseBytes ( result ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readChar" , result ) ; return result ; } catch ( IOException e ) { try { readStream . reset ( ) ; // return to the marked position } catch ( IOException e2 ) { } JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( MessageEOFException . class , "END_BYTESMESSAGE_CWSIA0183" , null , tc ) ; jmse . initCause ( e ) ; throw jmse ; } }
|
Read a Unicode character value from the stream message .
| 307
| 10
|
160,968
|
@ Override public long readLong ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readLong" ) ; try { // Check that we are in read mode checkBodyReadable ( "readLong" ) ; if ( requiresInit ) lazyInitForReading ( ) ; // Mark the current position, so we can return to it if there's an error readStream . mark ( 8 ) ; // the argument appears to be ignored long result = readStream . readLong ( ) ; // Byte swap the long if required if ( integerEncoding == ApiJmsConstants . ENC_INTEGER_REVERSED ) { result = Long . reverseBytes ( result ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readLong" , result ) ; return result ; } catch ( IOException e ) { try { readStream . reset ( ) ; } catch ( IOException e2 ) { } throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0190" , new Object [ ] { e , "JmsBytesMessageImpl.readLong" } , e , "JmsBytesMessageImpl.readLong#1" , this , tc ) ; } }
|
Read a signed 64 - bit integer from the stream message .
| 319
| 12
|
160,969
|
@ Override public String readUTF ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readUTF" ) ; String result ; try { // Check that we are in read mode checkBodyReadable ( "readUTF" ) ; if ( requiresInit ) lazyInitForReading ( ) ; // Mark the current position, so we can return to it if there's an error readStream . mark ( 8 ) ; // the argument appears to be ignored result = readStream . readUTF ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readUTF" , result ) ; return result ; } catch ( IOException e ) { try { readStream . reset ( ) ; // return to the marked position } catch ( IOException e2 ) { } JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( MessageEOFException . class , "END_BYTESMESSAGE_CWSIA0183" , null , tc ) ; jmse . initCause ( e ) ; throw jmse ; } }
|
Read in a string that has been encoded using a modified UTF - 8 format from the stream message .
| 273
| 20
|
160,970
|
@ Override public void reset ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "reset" ) ; // After reset has been called, the message body is immutable (the only way of changing it is to // call clearBody and start again). If we're in Write Mode, we need to convert the writeStream // to a byte array and switch into read mode. If we're in Read Mode, we must have already done this, // so we don't want to do it again if ( ! isBodyReadOnly ( ) ) { // If the producer won't modify the payload after set,skip the // encoding of the write stream because encoding is not needed if ( ! producerWontModifyPayloadAfterSet ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Body is writeable & producer might modify the payload, so encode the write stream" ) ; // Convert the stream in which the message was being assembled to a byte array dataBuffer = _writeBytes . toByteArray ( ) ; // store the content in the JS msg lastEncoding = integerEncoding | floatEncoding ; jsBytesMsg . setBytes ( _exportBody ( lastEncoding ) ) ; bodySetInJsMsg = true ; // Throw away the write stream writeStream = null ; _writeBytes = null ; } dataStart = 0 ; // start from the first byte in the buffer // The message is now read only setBodyReadOnly ( ) ; } // For some odd reason, after receiving an 'empty' message the dataBuffer // is null rather than pointing to an empty array. This will compensate // hopefully without any side effects - SXA #58832 if ( dataBuffer == null ) dataBuffer = new byte [ 0 ] ; // Create a Byte array input stream for the readxxx methods to operate on. We have to create a new // stream each time (rather than call the stream's read method), as the stream may have a position // marked in it that isn't at the start. _readBytes = new ByteArrayInputStream ( dataBuffer ) ; readStream = new DataInputStream ( _readBytes ) ; // Jump over any header that might be present in the dataBuffer // JBK - I don't think we will ever have dataStart!=0 in JS, but I'm // leaving the capability here until I understand better. try { readStream . skip ( dataStart ) ; } catch ( IOException e ) { } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "reset" ) ; }
|
Put the message in read - only mode and reposition the stream of bytes to the beginning .
| 591
| 19
|
160,971
|
@ Override public void writeBytes ( byte [ ] value ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeBytes" , value ) ; try { // Check that we are in write mode checkBodyWriteable ( "writeBytes" ) ; // This method has different behaviours for storing the byte array, based on the whether the producer // has promised not to mess with data after it's been written... if ( producerWontModifyPayloadAfterSet ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Producer has promised not to modify the payload after setting it in the message - check if they've violated that promise" ) ; // The producer has promised not to modify the payload after it's been set, so check // the flag to see whether this is the first, or a subsequent call to writeBytes. if ( ! writeByteArrayCalled ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "This is the first call to writeBytes(byte[] value) - storing the byte array reference directly in the underlying MFP object" ) ; writeByteArrayCalled = true ; // Set the data buffer & MFP data references to the value param & reset // the dataStart attribute jsBytesMsg . setBytes ( value ) ; dataBuffer = value ; dataStart = 0 ; } else { // The producer has promised not to modify the payload after it's been set, but the producer has // been naughty by calling this method more than once! Throw exception to admonish the producer. throw ( JMSException ) JmsErrorUtils . newThrowable ( IllegalStateException . class , // JMS illegal state exception "PROMISE_BROKEN_EXCEPTION_CWSIA0511" , // promise broken null , // No inserts null , // no cause - original exception "JmsBytesMessageImpl.writeBytes#3" , // Probe ID this , // Caller (?) tc ) ; // Trace component } } else { // Producer makes no promises relating to the accessing the message payload, so // make a copy of the byte array at this point to ensure the message is transmitted safely. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Producer 'payload modification' promise is not in place - make a copy of the byte array" ) ; // Write the byte array to the output stream // We don't check for value==null as JDK1.1.6 DataOutputStream doesn't writeStream . write ( value , 0 , value . length ) ; // Ensure that the new data gets exported when the time comes. bodySetInJsMsg = false ; } // Invalidate the cached toString object, because the message payload has changed. cachedBytesToString = null ; } catch ( IOException ex ) { // No FFDC code needed //(exception repro'ed from 3-param writeBytes method) throw ( JMSException ) JmsErrorUtils . newThrowable ( ResourceAllocationException . class , "WRITE_PROBLEM_CWSIA0186" , null , ex , "JmsBytesMessageImpl.writeBytes#4" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "writeBytes" ) ; }
|
Write a byte array to the stream message .
| 783
| 9
|
160,972
|
@ Override public void writeBytes ( byte [ ] value , int offset , int length ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeBytes" , new Object [ ] { value , offset , length } ) ; try { // Check if the producer has promised not to modify the payload after it's been set checkProducerPromise ( "writeBytes(byte[], int, int)" , "JmsBytesMessageImpl.writeBytes#2" ) ; // Check that we are in write mode checkBodyWriteable ( "writeBytes" ) ; // Write the byte array to the output stream // We don't check for value==null as JDK1.1.6 DataOutputStream doesn't writeStream . write ( value , offset , length ) ; // Invalidate the cached toString object. cachedBytesToString = null ; // Ensure that the new data gets exported when the time comes. bodySetInJsMsg = false ; } // We don't expect the writeBytes to fail, but we need to catch the exception anyway catch ( IOException ex ) { // No FFDC code needed // d238447 review. Generate FFDC for this case. throw ( JMSException ) JmsErrorUtils . newThrowable ( ResourceAllocationException . class , "WRITE_PROBLEM_CWSIA0186" , null , ex , "JmsBytesMessageImpl.writeBytes#1" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "writeBytes" ) ; }
|
Write a portion of a byte array to the stream message .
| 370
| 12
|
160,973
|
@ Override public void writeObject ( Object value ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writeObject" ) ; // Check if the producer has promised not to modify the payload after it's been set checkProducerPromise ( "writeObject(Object)" , "JmsBytesMessageImpl.writeObject#1" ) ; // Check that we are in write mode (doing this test here ensures // any error message refers to the correct method) checkBodyWriteable ( "writeObject" ) ; if ( value instanceof byte [ ] ) writeBytes ( ( byte [ ] ) value ) ; else if ( value instanceof String ) writeUTF ( ( String ) value ) ; else if ( value instanceof Integer ) writeInt ( ( ( Integer ) value ) . intValue ( ) ) ; else if ( value instanceof Byte ) writeByte ( ( ( Byte ) value ) . byteValue ( ) ) ; else if ( value instanceof Short ) writeShort ( ( ( Short ) value ) . shortValue ( ) ) ; else if ( value instanceof Long ) writeLong ( ( ( Long ) value ) . longValue ( ) ) ; else if ( value instanceof Float ) writeFloat ( ( ( Float ) value ) . floatValue ( ) ) ; else if ( value instanceof Double ) writeDouble ( ( ( Double ) value ) . doubleValue ( ) ) ; else if ( value instanceof Character ) writeChar ( ( ( Character ) value ) . charValue ( ) ) ; else if ( value instanceof Boolean ) writeBoolean ( ( ( Boolean ) value ) . booleanValue ( ) ) ; else if ( value == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "given null, throwing NPE" ) ; throw new NullPointerException ( ) ; } else { // d238447 FFDC review. Passing in an object of the wrong type is an app error, // so no FFDC needed here. throw ( JMSException ) JmsErrorUtils . newThrowable ( MessageFormatException . class , "BAD_OBJECT_CWSIA0185" , new Object [ ] { value . getClass ( ) . getName ( ) } , tc ) ; } // Invalidate the cached toString object. cachedBytesToString = null ; // Ensure that the new data gets exported when the time comes. bodySetInJsMsg = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeObject" ) ; }
|
Write a Java object to the stream message .
| 581
| 9
|
160,974
|
@ Override protected JsJmsMessage getMsgReference ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getMsgReference" ) ; // If the body is read only, the contents should already be in the // JS message, so only do the copy over if we are in write mode. // SIB0121: ... and if the producer might modify the payload after it's been set if ( ! isBodyReadOnly ( ) && ! producerWontModifyPayloadAfterSet ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Body is writeable & producer hasn't promised not to modify the payload - attempt encoding" ) ; try { int encoding = integerEncoding | floatEncoding ; // NB bitwise or (|), not logical or (||) // check if JMS_IBM_Encoding has been set if ( propertyExists ( ApiJmsConstants . ENCODING_PROPERTY ) ) { encoding = getIntProperty ( ApiJmsConstants . ENCODING_PROPERTY ) ; } if ( bodySetInJsMsg && ( encoding == lastEncoding ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Body cached - encoding not necessary" ) ; } else { // flatten and encode the data streams byte [ ] encodedBody = _exportBody ( encoding ) ; // and set it into the Jetstream message jsBytesMsg . setBytes ( encodedBody ) ; lastEncoding = encoding ; bodySetInJsMsg = true ; } } catch ( JMSException e ) { // No FFDC code needed // d222942 review JMSException could be thrown by _exportBody if passed an unknown // value for encoding, or if there was an IO error handling the streams. These already // have good nls messages, so we should simply pass on, not wrap with a generic message. // Similarly, getIntProperty can throw a JMSException which can also be passed on. throw e ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getMsgReference" , jsBytesMsg ) ; return jsBytesMsg ; }
|
override the getMsgReference method of the parent class . We need to ensure that the message body is written into the JS message before returning the reference to it .
| 535
| 33
|
160,975
|
private void recordInteger ( int offset , int length ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "recordInteger" , new Object [ ] { offset , length } ) ; // If the current arrays are full, save them in the vector and allocate some new ones if ( integer_count == ARRAY_SIZE ) { if ( integers == null ) integers = new Vector ( ) ; integers . addElement ( integer_offsets ) ; integers . addElement ( integer_sizes ) ; integer_offsets = new int [ ARRAY_SIZE ] ; integer_sizes = new int [ ARRAY_SIZE ] ; integer_count = 0 ; } // Add the offset and size of the current numeric item to the arrays integer_offsets [ integer_count ] = offset ; integer_sizes [ integer_count ++ ] = length ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "recordInteger" ) ; }
|
Records the presence of an integer - style item in the bytes message stream . This method is called by the writeXXX methods to keep a track of where the integer items are so they can be byteswapped if necessary at send time .
| 236
| 48
|
160,976
|
private void reverse ( byte [ ] buffer , int offset , int length ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "reverse" , new Object [ ] { buffer , offset , length } ) ; byte temp ; for ( int i = 0 ; i < length / 2 ; i ++ ) { temp = buffer [ offset + i ] ; buffer [ offset + i ] = buffer [ offset + ( length - 1 ) - i ] ; buffer [ offset + ( length - 1 ) - i ] = temp ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "reverse" ) ; }
|
This method reverses a sequence of bytes within a byte array . It is used for byte swapping numeric values
| 166
| 21
|
160,977
|
private void checkProducerPromise ( String jmsMethod , String ffdcProbeID ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "checkProducerPromise" , new Object [ ] { jmsMethod , ffdcProbeID } ) ; // Only proceed if the producer hasn't promised not to modify the payload // after setting it. if ( producerWontModifyPayloadAfterSet ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( IllegalStateException . class , // JMS illegal state exception "PROMISE_BROKEN_EXCEPTION_CWSIA0510" , // promise broken new Object [ ] { jmsMethod } , // insert = jms method name null , // no cause, original exception ffdcProbeID , // Probe ID this , // caller (?) tc ) ; // Trace component } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "checkProducerPromise" ) ; }
|
Checks to see if the producer has promised not to modify the payload after it s been set . If they have then throw a JMS exception based on the parameters
| 255
| 33
|
160,978
|
public void stopConsumer ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "stopConsumer" ) ; try { // lock the consumerSession to ensure visibility of update to started. synchronized ( consumerSession ) { consumerSession . getConsumerSession ( ) . stop ( ) ; consumerSession . started = false ; } } catch ( Throwable t ) { FFDCFilter . processException ( t , CLASS_NAME + ".consumeMessages" , CommsConstants . CATASYNCHRHREADER_CONSUME_MSGS_02 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Unable to stop consumer session due to Throwable: " + t ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "stopConsumer" ) ; }
|
Safely stop the consumer
| 226
| 5
|
160,979
|
public boolean setClassifications ( Flow [ ] newFlows ) throws InvalidFlowsException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setClassifications" , newFlows ) ; boolean noClassChange = true ; // Do we have the same set of flows but with different weightings only? if ( flows == null || ( flows . length != newFlows . length ) ) { // We know that this is more than a weight change noClassChange = false ; } // Set up the new data structures to hold classification information ArrayList < String > newClassificationNames = new ArrayList < String > ( ) ; HashMap < String , ClassWeight > newMessageClasses = new HashMap < String , ClassWeight > ( ) ; HashMap < Integer , Integer > newWeightMap = new HashMap < Integer , Integer > ( ) ; // Set the new default classification newClassificationNames . add ( 0 , "$SIdefault" ) ; // Iterate over the new flows for ( int i = 0 ; i < newFlows . length ; i ++ ) { // Get the next classification name String nextClassificationName = newFlows [ i ] . getClassification ( ) ; if ( noClassChange && ! classificationNames . contains ( nextClassificationName ) ) { // This classification was not in the old list noClassChange = false ; } // The zeroth position is reserved for default, non-classified messages ClassWeight classWeight = new ClassWeight ( i + 1 , newFlows [ i ] . getWeighting ( ) ) ; // Put the new weight in the messageClasses map ClassWeight cw = newMessageClasses . put ( nextClassificationName , classWeight ) ; // Check for duplicate classification names if ( cw != null ) { InvalidFlowsException ife = new InvalidFlowsException ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setClassifications" , ife ) ; throw ife ; } newClassificationNames . add ( i + 1 , nextClassificationName ) ; // Put the new value in the weightMap newWeightMap . put ( Integer . valueOf ( i + 1 ) , Integer . valueOf ( newFlows [ i ] . getWeighting ( ) ) ) ; } // Have set up the new data structures, reset the old ones. classificationNames = newClassificationNames ; messageClasses = newMessageClasses ; weightMap = newWeightMap ; // And clone the flows this . flows = newFlows . clone ( ) ; // The number of classifications numberOfClasses = flows . length ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setClassifications" , Boolean . valueOf ( noClassChange ) ) ; return noClassChange ; }
|
Supports the setting of a new set of classifications based on a set of Flows provided by the caller .
| 635
| 23
|
160,980
|
public int getNumberOfClasses ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getNumberOfClasses" ) ; SibTr . exit ( tc , "getNumberOfClasses" , Integer . valueOf ( numberOfClasses ) ) ; } return numberOfClasses ; }
|
Retrieve the number of classifications specified in the current set .
| 85
| 13
|
160,981
|
public int getPosition ( String classificationName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getPosition" , classificationName ) ; int classPos = 0 ; // Get the position of the classification ClassWeight cw = messageClasses . get ( classificationName ) ; if ( cw != null ) classPos = cw . getPosition ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPosition" , Integer . valueOf ( classPos ) ) ; return classPos ; }
|
Get the index of a named classification .
| 143
| 8
|
160,982
|
public int getWeight ( String classificationName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getWeight" , classificationName ) ; int weight = 0 ; // Get the weight of the classification ClassWeight cw = messageClasses . get ( classificationName ) ; if ( cw != null ) weight = cw . getWeight ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getWeight" , Integer . valueOf ( weight ) ) ; return weight ; }
|
Get the weight of a named classification .
| 139
| 8
|
160,983
|
public int findClassIndex ( HashMap < Integer , Integer > weightMap ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "findClassIndex" ) ; int classPos = 0 ; int randWeight = 0 ; // First of all determine total weight int totalWeight = 0 ; Iterator < Integer > iter = weightMap . values ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Integer weight = iter . next ( ) ; totalWeight = totalWeight + weight . intValue ( ) ; } // TotalWeight might be zero if a zero weighting has been applied to a class. In // that case we need to return a zero classPos if ( totalWeight > 0 ) { // Generate a random number that is between zero and the total weight randWeight = Math . abs ( rand . nextInt ( ) % totalWeight ) ; // Iterate over the weightMap again so that we can find a class index to use. // We search for the index that corresponds to the generated random value. // // So if we had 3 classes with weights 7, 2 and 1, then we'll have a total // weight of 10 and will generate a pseudo random number between 0 and 10. The // code will see if the random number... // * is less than 7, in which case it chooses index 1, // * is between 7 and 9, in which case it chooses index 2, // * is between 9 and 10, in which case it chooses index 3. Iterator < Map . Entry < Integer , Integer > > iter2 = weightMap . entrySet ( ) . iterator ( ) ; // An aggregate of the weight int aggregateWeight = 0 ; while ( iter2 . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iter2 . next ( ) ; Integer mappos = ( Integer ) entry . getKey ( ) ; Integer weight = ( Integer ) entry . getValue ( ) ; aggregateWeight = aggregateWeight + weight . intValue ( ) ; // Move the classPos to the next value classPos = mappos . intValue ( ) ; if ( randWeight <= aggregateWeight ) break ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "findClassIndex" , classPos ) ; return classPos ; }
|
Find a pseudo random classification index based on the weightings table .
| 512
| 13
|
160,984
|
public Flow [ ] getFlows ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getFlows" ) ; } Flow [ ] clonedFlows = flows . clone ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "getFlows" , clonedFlows ) ; } return clonedFlows ; }
|
Returns the array of flows defined in this classification specified by XD .
| 112
| 13
|
160,985
|
public Map < Object , Object > getPropertyBag ( ) { if ( this . properties == null ) { this . properties = new HashMap < Object , Object > ( ) ; } return this . properties ; }
|
Fetch the property bag associated with this Chain .
| 45
| 10
|
160,986
|
public ChainDataImpl getExternalChainData ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "getExternalChainData" ) ; } // Create the list of the parents of the child data objects. ChannelData [ ] parents = new ChannelData [ this . channelDataArray . length ] ; for ( int i = 0 ; i < parents . length ; i ++ ) { parents [ i ] = ( ( ChildChannelDataImpl ) this . channelDataArray [ i ] ) . getParent ( ) ; } ChainDataImpl externalChainData = null ; try { externalChainData = new ChainDataImpl ( getName ( ) , getType ( ) , parents , null ) ; } catch ( IncoherentChainException e ) { // No FFDC Needed // This should never happen if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Unable to build external version of chain data, " + getName ( ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "getExternalChainData" ) ; } return externalChainData ; }
|
Create a cloned representation of this chain data which only includes references to parent channel data objects . It hides the children and their names .
| 280
| 27
|
160,987
|
public final void addChainEventListener ( ChainEventListener listener ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "addChainEventListener: " + listener ) ; } if ( null != listener ) { this . chainEventListeners . add ( listener ) ; } }
|
Enables external entities to be notified of chain events described in ChainEventListener interface .
| 77
| 17
|
160,988
|
public final void removeChainEventListener ( ChainEventListener listener ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "removeChainEventListener: " + listener ) ; } if ( null != listener ) { if ( ! this . chainEventListeners . remove ( listener ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Cannot find listener to be removed" ) ; } } } }
|
Removes a listener from the list of those being informed of chain events on this chain .
| 124
| 18
|
160,989
|
public Set < ChainEventListener > removeAllChainEventListeners ( ) { Set < ChainEventListener > returnListeners = new HashSet < ChainEventListener > ( this . chainEventListeners ) ; this . chainEventListeners . clear ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "removeAllChainEventListeners" , returnListeners ) ; } return returnListeners ; }
|
Remove the chain event listeners from this configuration and return them in a new hash set . This method is called during the updateChain in order to move the event listeners from the old config to the new one .
| 105
| 41
|
160,990
|
public void setChainEventListeners ( Set < ChainEventListener > newListeners ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "removeAllChainEventListeners" , newListeners ) ; } chainEventListeners . clear ( ) ; chainEventListeners . addAll ( newListeners ) ; }
|
Set the list of chain event listeners for this chain configuration . This method was originally created to pass along chain event listeners from one chain config to another chain config during the updateChain method .
| 87
| 37
|
160,991
|
public final void chainInitialized ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "chainInitialized, chain: " + this . name ) ; } // Clone the list in case one of the event listeners modifies // the chain during this iteration. for ( ChainEventListener listener : chainEventListeners ) { listener . chainInitialized ( this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "chainInitialized" ) ; } }
|
This method is called when the chain has been initialized . It informs each of the chain event listeners .
| 132
| 20
|
160,992
|
public final void chainStartFailed ( int attemptsMade , int attemptsLeft ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "chainStartFailed, chain: " + this . name ) ; } // Clone the list in case one of the event listeners modifies // the chain during this iteration. for ( ChainEventListener listener : chainEventListeners ) { if ( listener instanceof RetryableChainEventListener ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Calling chain retryable chain event listener" ) ; } ( ( RetryableChainEventListener ) listener ) . chainStartFailed ( this , attemptsMade , attemptsLeft ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "chainStartFailed" ) ; } }
|
This method is called when the chain start fails . It informs each of the chain event listeners .
| 218
| 19
|
160,993
|
public CFEndPoint getEndPoint ( ) throws ChannelFrameworkException { if ( null == this . endPoint ) { if ( FlowType . INBOUND . equals ( this . type ) ) { this . endPoint = new CFEndPointImpl ( this ) ; } else { throw new ChannelFrameworkException ( this . name + " is not inbound chain" ) ; } } return this . endPoint ; }
|
Access the possible endpoint representation of this chain . This will throw an exception if the chain is not inbound .
| 88
| 22
|
160,994
|
@ Trivial protected String getRawProperty ( String key ) { String rawValue = source . getValue ( key ) ; if ( rawValue != null ) { current . put ( key , rawValue ) ; } return rawValue ; }
|
Return the raw unconverted String associated with a key .
| 50
| 11
|
160,995
|
protected final TagAttribute getRequiredAttribute ( String localName ) throws TagException { TagAttribute attr = this . getAttribute ( localName ) ; if ( attr == null ) { throw new TagException ( this . tag , "Attribute '" + localName + "' is required" ) ; } return attr ; }
|
Utility method for fetching a required TagAttribute
| 67
| 10
|
160,996
|
public void setInputHandler ( ProducerInputHandler inputHandler ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setInputHandler" , inputHandler ) ; this . inputHandler = inputHandler ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setInputHandler" ) ; }
|
Sets the inputHandler for this destination .
| 97
| 9
|
160,997
|
void setBus ( String busName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setBus" , busName ) ; this . busName = busName ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setBus" ) ; }
|
Sets the bus name for this destination .
| 91
| 9
|
160,998
|
public void setForeignBusSendAllowed ( boolean sendAllowed ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "setForeignBusSendAllowed" , Boolean . valueOf ( sendAllowed ) ) ; } // Set the flag on this handler _sendAllowedOnTargetForeignBus = Boolean . valueOf ( sendAllowed ) ; // Tell any destinations that target this destination to refresh their // sendAllowed setting if ( aliasesThatTargetThisDest != null ) { synchronized ( aliasesThatTargetThisDest ) { Iterator i = aliasesThatTargetThisDest . iterator ( ) ; while ( i . hasNext ( ) ) { AbstractAliasDestinationHandler abstractAliasDestinationHandler = ( AbstractAliasDestinationHandler ) i . next ( ) ; abstractAliasDestinationHandler . setForeignBusSendAllowed ( sendAllowed ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "setForeignBusSendAllowed" ) ; } }
|
Set the Foreign Bus Level sendAllowed flag
| 239
| 9
|
160,999
|
@ Trivial public static < U > CompletableFuture < U > failedFuture ( Throwable x ) { throw new UnsupportedOperationException ( Tr . formatMessage ( tc , "CWWKC1156.not.supported" , "ManagedExecutor.failedFuture" ) ) ; }
|
Because CompletableFuture . failedFuture is static this is not a true override . It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static failedFuture method on that .
| 63
| 53
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.