idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
35,900
public List getCacheIdsInPushPullTable ( ) { final String methodName = "getCacheIdsInPushPullTable()" ; List list = new ArrayList ( ) ; if ( this . featureSupport . isReplicationSupported ( ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet" ) ; } } else { Tr . error ( tc , "DYNA1065E" , new Object [ ] { methodName , cacheName , this . cacheProviderName } ) ; } return list ; }
Returns all of the cache IDs in the PushPullTable
35,901
public boolean shouldPull ( int share , Object id ) { final String methodName = "shouldPull()" ; boolean shouldPull = false ; if ( this . featureSupport . isReplicationSupported ( ) ) { } else { } return shouldPull ; }
Return to indicate the entry can be pulled from other remote caches which caching this value .
35,902
public int getDepIdsSizeDisk ( ) { final String methodName = "getDepIdsSizeDisk()" ; if ( this . swapToDisk ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet" ) ; } } else { if ( this . featureSupport . isDiskCacheSupported ( ) == false ) { Tr . error ( tc , "DYNA1064E" , new Object [ ] { methodName , cacheName , this . cacheProviderName } ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled" ) ; } } } return 0 ; }
Returns the current dependency IDs size for the disk cache .
35,903
public Exception getDiskCacheException ( ) { final String methodName = "getDiskCacheException()" ; Exception ex = null ; if ( this . swapToDisk ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet" ) ; } } else { if ( this . featureSupport . isDiskCacheSupported ( ) == false ) { Tr . error ( tc , "DYNA1064E" , new Object [ ] { methodName , cacheName , this . cacheProviderName } ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled" ) ; } } } return ex ; }
Returns the exception object from the disk cache because disk cache reported the error .
35,904
public void resetPMICounters ( ) { final String methodName = "resetPMICounters()" ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName ) ; } }
This method needs to change if cache provider supports PMI counters .
35,905
public void updateStatisticsForVBC ( com . ibm . websphere . cache . CacheEntry cacheEntry , boolean directive ) { final String methodName = "updateStatisticsForVBC()" ; Object id = null ; if ( cacheEntry != null ) { id = cacheEntry . getIdObject ( ) ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " id=" + id + " directive=" + directive ) ; } }
This method needs to change if cache provider supports PMI and CacheStatisticsListener .
35,906
private static String reduceStringLiteralToken ( String image ) { image = image . substring ( 1 , image . length ( ) - 1 ) ; for ( int i = 0 ; i < image . length ( ) ; i ++ ) if ( image . charAt ( i ) == '\'' ) image = image . substring ( 0 , i + 1 ) + image . substring ( i + 2 ) ; return image ; }
processing characters in the image
35,907
static Selector parseIntegerLiteral ( String val ) { char tag = val . charAt ( val . length ( ) - 1 ) ; boolean mustBeLong = false ; if ( tag == 'l' || tag == 'L' ) { val = val . substring ( 0 , val . length ( ) - 1 ) ; mustBeLong = true ; } long longVal = Long . decode ( val ) . longValue ( ) ; if ( mustBeLong || longVal > Integer . MAX_VALUE || longVal < Integer . MIN_VALUE ) return new LiteralImpl ( new Long ( longVal ) ) ; else return new LiteralImpl ( new Integer ( ( int ) longVal ) ) ; }
Parse an integer literal
35,908
static Selector parseFloatingLiteral ( String val ) { Number value ; char tag = val . charAt ( val . length ( ) - 1 ) ; if ( tag == 'f' || tag == 'F' ) value = new Float ( val ) ; else value = new Double ( val ) ; return new LiteralImpl ( value ) ; }
Parse a floating point literal
35,909
static Selector convertSet ( Selector expr , List set ) { Selector ans = null ; for ( int i = 0 ; i < set . size ( ) ; i ++ ) { Selector comparand = ( Selector ) set . get ( i ) ; Selector comparison = new OperatorImpl ( Operator . EQ , ( Selector ) expr . clone ( ) , comparand ) ; if ( ans == null ) ans = comparison ; else ans = new OperatorImpl ( Operator . OR , ans , comparison ) ; } return ans ; }
Convert a partially parsed set expression into its more primitive form as a disjunction of equalities .
35,910
static Selector convertRange ( Selector expr , Selector bound1 , Selector bound2 ) { return new OperatorImpl ( Operator . AND , new OperatorImpl ( Operator . GE , ( Selector ) expr . clone ( ) , bound1 ) , new OperatorImpl ( Operator . LE , ( Selector ) expr . clone ( ) , bound2 ) ) ; }
Convert a partially parsed BETWEEN expression into its more primitive form as a conjunction of inequalities .
35,911
static Selector convertLike ( Selector arg , String pattern , String escape ) { try { pattern = reduceStringLiteralToken ( pattern ) ; boolean escaped = false ; char esc = 0 ; if ( escape != null ) { escape = reduceStringLiteralToken ( escape ) ; if ( escape . length ( ) != 1 ) return null ; escaped = true ; esc = escape . charAt ( 0 ) ; } return Matching . getInstance ( ) . createLikeOperator ( arg , pattern , escaped , esc ) ; } catch ( Exception e ) { FFDC . processException ( cclass , "com.ibm.ws.sib.matchspace.selector.impl.ParseUtil.convertLike" , e , "1:183:1.19" ) ; throw new RuntimeException ( e ) ; } }
Convert a partially parsed LIKE expression in which the pattern and escape are in the form of token images to the proper Selector expression to represent the LIKE expression
35,912
public SecurityMetadata getSecurityMetadata ( ) { SecurityMetadata sm = super . getSecurityMetadata ( ) ; if ( sm == null ) { return getDefaultAdminSecurityMetadata ( ) ; } else { return sm ; } }
Get the effective SecurityMetadata for this application . First try to defer to the application collaborator to see if the application provides data . If so use it . Otherwise fallback to the default SecurityMetadata .
35,913
private void buildPolicyErrorMessage ( String msgKey , String defaultMessage , Object ... arg1 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isWarningEnabled ( ) ) { String messageFromBundle = Tr . formatMessage ( tc , msgKey , arg1 ) ; Tr . error ( tc , messageFromBundle ) ; } }
Receives the message key like CSIv2_COMMON_AUTH_LAYER_DISABLED from this key we extract the message from the NLS message bundle which contains the message along with the CWWKS message code .
35,914
public void displaySelectionPage ( HttpServletRequest request , HttpServletResponse response , SocialTaiRequest socialTaiRequest ) throws IOException { setRequestAndConfigInformation ( request , response , socialTaiRequest ) ; if ( selectableConfigs == null || selectableConfigs . isEmpty ( ) ) { sendDisplayError ( response , "SIGN_IN_NO_CONFIGS" , new Object [ 0 ] ) ; return ; } generateOrSendToAppropriateSelectionPage ( response ) ; }
Generates the sign in page to allow a user to select from the configured social login services . If no services are configured the user is redirected to an error page .
35,915
String createJavascript ( ) { StringBuilder html = new StringBuilder ( ) ; html . append ( "<script>\n" ) ; html . append ( "function " + createCookieFunctionName + "(value) {\n" ) ; html . append ( "document.cookie = \"" + ClientConstants . LOGIN_HINT + "=\" + value;\n" ) ; html . append ( "}\n" ) ; html . append ( "</script>\n" ) ; return html . toString ( ) ; }
Creates a JavaScript function for creating a social_login_hint cookie with the value provided to the function . Each provider button should be configured to call this function when the button is clicked allowing the login hint to be passed around in a cookie instead of a request parameter .
35,916
public boolean parseMessage ( WsByteBuffer buffer , boolean bExtractValue ) throws Exception { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; boolean rc = false ; if ( ! isFirstLineComplete ( ) ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Parsing First Line" ) ; } rc = parseLine ( buffer ) ; } if ( isFirstLineComplete ( ) ) { rc = parseHeaders ( buffer , bExtractValue ) ; } if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "parseMessage returning " + rc ) ; } return rc ; }
Parse a message from the input buffer . The input flag is whether or not to save the header value immediately or delay the extraction until the header value is queried .
35,917
public WsByteBuffer [ ] marshallMessage ( ) throws MessageSentException { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; if ( bTrace && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "marshallMessage" ) ; } preMarshallMessage ( ) ; WsByteBuffer [ ] marshalledObj = hasFirstLineChanged ( ) ? marshallLine ( ) : null ; headerComplianceCheck ( ) ; marshalledObj = marshallHeaders ( marshalledObj ) ; postMarshallMessage ( ) ; if ( bTrace && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "marshallMessage" ) ; } return marshalledObj ; }
Marshall a message .
35,918
public static URITemplate createTemplate ( Path path , List < Parameter > params , String classNameandPath ) { return createTemplate ( path == null ? null : path . value ( ) , params , classNameandPath ) ; }
Liberty Change start
35,919
private boolean isELReserved ( String id ) { int i = 0 ; int j = reservedWords . length ; while ( i < j ) { int k = ( i + j ) / 2 ; int result = reservedWords [ k ] . compareTo ( id ) ; if ( result == 0 ) { return true ; } if ( result < 0 ) { i = k + 1 ; } else { j = k ; } } return false ; }
Test if an id is a reserved word in EL
35,920
protected synchronized Class < ? > loadClass ( String name , boolean resolve ) throws ClassNotFoundException { synchronized ( getClassLoadingLock ( name ) ) { Class < ? > result = null ; if ( name == null || name . length ( ) == 0 ) return null ; result = findLoadedClass ( name ) ; if ( result == null ) { if ( name . regionMatches ( 0 , BootstrapChildFirstJarClassloader . KERNEL_BOOT_CLASS_PREFIX , 0 , BootstrapChildFirstJarClassloader . KERNEL_BOOT_PREFIX_LENGTH ) ) { result = super . loadClass ( name , resolve ) ; } else { try { result = findClass ( name ) ; } catch ( ClassNotFoundException cnfe ) { result = super . loadClass ( name , resolve ) ; } } } return result ; } }
Any changes must be made to both sources
35,921
private static List < Integer > allocateOffsets ( List < List < Integer > > offsetsStorage ) { if ( offsetsStorage . isEmpty ( ) ) { return new ArrayList < Integer > ( ) ; } else { return ( offsetsStorage . remove ( 0 ) ) ; } }
Allocate an offsets list .
35,922
private static int [ ] releaseOffsets ( List < List < Integer > > offsetsStorage , List < Integer > offsets ) { int numValues = offsets . size ( ) ; int [ ] extractedValues ; if ( numValues == 0 ) { extractedValues = EMPTY_OFFSETS_ARRAY ; } else { extractedValues = new int [ numValues ] ; for ( int valueNo = 0 ; valueNo < numValues ; valueNo ++ ) { extractedValues [ valueNo ] = offsets . get ( valueNo ) . intValue ( ) ; } } offsets . clear ( ) ; offsetsStorage . add ( offsets ) ; return extractedValues ; }
Release an offsets list to storage .
35,923
public static Map < String , IteratorData > collectIteratorData ( ZipEntryData [ ] zipEntryData ) { Map < String , IteratorData > allNestingData = new HashMap < String , IteratorData > ( ) ; List < List < Integer > > offsetsStorage = new ArrayList < List < Integer > > ( 32 ) ; String r_lastPath = "" ; int r_lastPathLen = 0 ; List < Integer > offsets = EMPTY_OFFSETS ; int nestingDepth = 0 ; List < String > r_pathStack = new ArrayList < String > ( 32 ) ; List < List < Integer > > offsetsStack = new ArrayList < List < Integer > > ( 32 ) ; for ( int nextOffset = 0 ; nextOffset < zipEntryData . length ; nextOffset ++ ) { String r_nextPath = zipEntryData [ nextOffset ] . r_getPath ( ) ; int r_nextPathLen = r_nextPath . length ( ) ; while ( ! isChildOf ( r_nextPath , r_nextPathLen , r_lastPath , r_lastPathLen ) ) { if ( offsets != EMPTY_OFFSETS ) { allNestingData . put ( r_lastPath , new IteratorData ( r_lastPath , releaseOffsets ( offsetsStorage , offsets ) ) ) ; } nestingDepth -- ; r_lastPath = r_pathStack . remove ( nestingDepth ) ; r_lastPathLen = r_lastPath . length ( ) ; offsets = offsetsStack . remove ( nestingDepth ) ; } Integer nextOffsetObj = Integer . valueOf ( nextOffset ) ; int lastSlashLoc = r_lastPathLen + 1 ; while ( lastSlashLoc != - 1 ) { int nextSlashLoc = r_nextPath . indexOf ( '/' , lastSlashLoc ) ; String r_nextPartialPath ; int r_nextPartialPathLen ; if ( nextSlashLoc == - 1 ) { r_nextPartialPath = r_nextPath ; r_nextPartialPathLen = r_nextPathLen ; lastSlashLoc = nextSlashLoc ; } else { r_nextPartialPath = r_nextPath . substring ( 0 , nextSlashLoc ) ; r_nextPartialPathLen = nextSlashLoc ; lastSlashLoc = nextSlashLoc + 1 ; } if ( offsets == EMPTY_OFFSETS ) { offsets = allocateOffsets ( offsetsStorage ) ; } offsets . add ( nextOffsetObj ) ; nestingDepth ++ ; r_pathStack . add ( r_lastPath ) ; offsetsStack . add ( offsets ) ; r_lastPath = r_nextPartialPath ; r_lastPathLen = r_nextPartialPathLen ; offsets = EMPTY_OFFSETS ; } } while ( nestingDepth > 0 ) { if ( offsets != EMPTY_OFFSETS ) { allNestingData . put ( r_lastPath , new IteratorData ( r_lastPath , releaseOffsets ( offsetsStorage , offsets ) ) ) ; } nestingDepth -- ; r_lastPath = r_pathStack . remove ( nestingDepth ) ; offsets = offsetsStack . remove ( nestingDepth ) ; } if ( offsets != EMPTY_OFFSETS ) { allNestingData . put ( r_lastPath , new IteratorData ( r_lastPath , releaseOffsets ( offsetsStorage , offsets ) ) ) ; } return allNestingData ; }
Collect the iterator data for a collection of zip entries .
35,924
public static ZipEntryData [ ] collectZipEntries ( ZipFile zipFile ) { final List < ZipEntryData > entriesList = new ArrayList < ZipEntryData > ( ) ; final Enumeration < ? extends ZipEntry > zipEntries = zipFile . entries ( ) ; while ( zipEntries . hasMoreElements ( ) ) { entriesList . add ( createZipEntryData ( zipEntries . nextElement ( ) ) ) ; } ZipEntryData [ ] entryData = entriesList . toArray ( new ZipEntryData [ entriesList . size ( ) ] ) ; Arrays . sort ( entryData , ZIP_ENTRY_DATA_COMPARATOR ) ; return entryData ; }
Collect data for the entries of a zip file .
35,925
public static Map < String , ZipEntryData > setLocations ( ZipEntryData [ ] entryData ) { Map < String , ZipEntryData > entryDataMap = new HashMap < String , ZipEntryData > ( entryData . length ) ; for ( int entryNo = 0 ; entryNo < entryData . length ; entryNo ++ ) { ZipEntryData entry = entryData [ entryNo ] ; entry . setOffset ( entryNo ) ; entryDataMap . put ( entry . r_path , entry ) ; } return entryDataMap ; }
Create a table of entry data using the relative paths of the entries as keys . As a side effect set the offset of each entry data to its location int he entry data array .
35,926
public static int locatePath ( ZipEntryData [ ] entryData , final String r_path ) { ZipEntryData targetData = new SearchZipEntryData ( r_path ) ; return Arrays . binarySearch ( entryData , targetData , ZipFileContainerUtils . ZIP_ENTRY_DATA_COMPARATOR ) ; }
Locate a path in a collection of entries .
35,927
private static String stripPath ( String path ) { int pathLen = path . length ( ) ; if ( pathLen == 0 ) { return path ; } else if ( pathLen == 1 ) { if ( path . charAt ( 0 ) == '/' ) { return "" ; } else { return path ; } } else { if ( path . charAt ( 0 ) == '/' ) { if ( path . charAt ( pathLen - 1 ) == '/' ) { return path . substring ( 1 , pathLen - 1 ) ; } else { return path . substring ( 1 , pathLen ) ; } } else { if ( path . charAt ( pathLen - 1 ) == '/' ) { return path . substring ( 0 , pathLen - 1 ) ; } else { return path ; } } } }
Paths used in the zip entry table are adjusted to never have a leading slash and to never have a trailing slash .
35,928
private static String getDeepestNestedElementName ( String configDisplayId ) { int start = configDisplayId . lastIndexOf ( "]/" ) ; if ( start > 1 ) { int end = configDisplayId . indexOf ( '[' , start += 2 ) ; if ( end > start ) return configDisplayId . substring ( start , end ) ; } return null ; }
Returns the most deeply nested element name .
35,929
public void dump_memory ( Writer out ) throws IOException { int qlist_num ; out . write ( "First quick size: " + first_quick_size + "\n" ) ; out . write ( "Last quick size: " + last_quick_size + "\n" ) ; out . write ( "Grain size: " + grain_size + "\n" ) ; out . write ( "Acceptable waste: " + acceptable_waste + "\n" ) ; out . write ( "Tail pointer in memory: " + tail_ptr + "\n" ) ; out . write ( "First allocatable byte: " + start ( ) + "\n\n" ) ; out . write ( "Free lists from memory structures\n" ) ; for ( qlist_num = 0 ; qlist_num <= last_ql_index ; qlist_num ++ ) { out . write ( qlist_num + ": " ) ; out . write ( "Length = " + ql_heads [ qlist_num ] . length + "; " ) ; print_memory_freelist ( out , ql_heads [ qlist_num ] . first_block ) ; } ; out . write ( "Nonempty free lists: " + nonempty_lists + "\n" ) ; out . write ( "Tail pointer in memory: " + tail_ptr + "\n" ) ; out . write ( "First allocatable byte: " + start ( ) + "\n\n" ) ; }
Outputs storage information stored in main memory . Debugging interface writes interesting stuff to stdout .
35,930
protected Channel createChannel ( ChannelData config ) throws ChannelException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createChannel" , config ) ; Channel retChannel ; if ( config . isInbound ( ) ) { if ( tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "createChannel" , "inbound" ) ; try { Class clazz = Class . forName ( JFapChannelConstants . INBOUND_CHANNEL_CLASS ) ; Constructor contruct = clazz . getConstructor ( new Class [ ] { ChannelFactoryData . class , ChannelData . class } ) ; retChannel = ( Channel ) contruct . newInstance ( new Object [ ] { channelFactoryData , config } ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.jfapchannel.impl.JFapChannelFactory.createChannel" , JFapChannelConstants . JFAPCHANNELFACT_CREATECHANNEL_01 , this ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Unable to instantiate inbound channel" , e ) ; throw new ChannelException ( e ) ; } } else { retChannel = new JFapChannelOutbound ( channelFactoryData , config ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createChannel" , retChannel ) ; return retChannel ; }
Creates a new channel . Uses channel configuration to determine if the channel should be inbound or outbound .
35,931
public Class [ ] getDeviceInterface ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getDeviceInterface" ) ; if ( devSideInterfaceClasses == null ) { devSideInterfaceClasses = new Class [ 1 ] ; devSideInterfaceClasses [ 0 ] = com . ibm . wsspi . tcpchannel . TCPConnectionContext . class ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getDeviceInterface" , devSideInterfaceClasses ) ; return devSideInterfaceClasses ; }
Returns the device side interfaces which our channels can work with . This is always the TCPServiceContext .
35,932
private void addRepository ( String repositoryId , RepositoryWrapper repositoryHolder ) { repositories . put ( repositoryId , repositoryHolder ) ; try { numRepos = getNumberOfRepositories ( ) ; } catch ( WIMException e ) { } }
Pair adding to the repositories map and resetting the numRepos int .
35,933
protected String getRepositoryIdByUniqueName ( String uniqueName ) throws WIMException { boolean isDn = UniqueNameHelper . isDN ( uniqueName ) != null ; if ( isDn ) uniqueName = UniqueNameHelper . getValidUniqueName ( uniqueName ) . trim ( ) ; String repo = null ; int repoMatch = - 1 ; int bestMatch = - 1 ; for ( Map . Entry < String , RepositoryWrapper > entry : repositories . entrySet ( ) ) { repoMatch = entry . getValue ( ) . isUniqueNameForRepository ( uniqueName , isDn ) ; if ( repoMatch == Integer . MAX_VALUE ) { return entry . getKey ( ) ; } else if ( repoMatch > bestMatch ) { repo = entry . getKey ( ) ; bestMatch = repoMatch ; } } if ( repo != null ) { return repo ; } AuditManager auditManager = new AuditManager ( ) ; Audit . audit ( Audit . EventID . SECURITY_MEMBER_MGMT_01 , auditManager . getRESTRequest ( ) , auditManager . getRequestType ( ) , auditManager . getRepositoryId ( ) , uniqueName , vmmService . getConfigManager ( ) . getDefaultRealmName ( ) , null , Integer . valueOf ( "204" ) ) ; throw new InvalidUniqueNameException ( WIMMessageKey . ENTITY_NOT_IN_REALM_SCOPE , Tr . formatMessage ( tc , WIMMessageKey . ENTITY_NOT_IN_REALM_SCOPE , WIMMessageHelper . generateMsgParms ( uniqueName , "defined" ) ) ) ; }
Returns the id of the repository to which the uniqueName belongs to .
35,934
public boolean isSameExecutionZone ( FailureScope anotherScope ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "isSameExecutionZone" , anotherScope ) ; boolean isSameZone = equals ( anotherScope ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "isSameExecutionZone" , new Boolean ( isSameZone ) ) ; return isSameZone ; }
Returns true if this failure scope represents the same general recovery scope as the input parameter . For instance if more than one FailureScope was created which referenced the same server they would be in the same execution zone .
35,935
public static String encodeCookie ( String string ) { if ( string == null ) { return null ; } string = string . replaceAll ( "%" , "%25" ) ; string = string . replaceAll ( ";" , "%3B" ) ; string = string . replaceAll ( "," , "%2C" ) ; return string ; }
Encodes the given string so that it can be used as an HTTP cookie value .
35,936
public static String decodeCookie ( String string ) { if ( string == null ) { return null ; } string = string . replaceAll ( "%2C" , "," ) ; string = string . replaceAll ( "%3B" , ";" ) ; string = string . replaceAll ( "%25" , "%" ) ; return string ; }
Decodes the given string from percent encoding .
35,937
public static String getRequestStringForTrace ( HttpServletRequest request , String [ ] secretStrings ) { if ( request == null || request . getRequestURL ( ) == null ) { return "[]" ; } StringBuffer sb = new StringBuffer ( "[" + stripSecretsFromUrl ( request . getRequestURL ( ) . toString ( ) , secretStrings ) + "]" ) ; String query = request . getQueryString ( ) ; if ( query != null ) { String queryString = stripSecretsFromUrl ( query , secretStrings ) ; if ( queryString != null ) { sb . append ( ", queryString[" + queryString + "]" ) ; } } else { Map < String , String [ ] > pMap = request . getParameterMap ( ) ; String paramString = stripSecretsFromParameters ( pMap , secretStrings ) ; if ( paramString != null ) { sb . append ( ", parameters[" + paramString + "]" ) ; } } return sb . toString ( ) ; }
information and returns a string for tracing
35,938
public void deleteAbstractAliasDestinationHandler ( AbstractAliasDestinationHandler abstractAliasDestinationHandler ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteAbstractAliasDestinationHandler" ) ; if ( abstractAliasDestinationHandler instanceof BusHandler ) { _foreignBusIndex . remove ( abstractAliasDestinationHandler ) ; } else { _destinationIndex . remove ( abstractAliasDestinationHandler ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteAbstractAliasDestinationHandler" ) ; }
Delete the abstract alias destination handler
35,939
public int add ( Object dependency , ValueSet valueSet , Object entry ) { int returnCode = HTODDynacache . NO_EXCEPTION ; dependencyNotUpdatedTable . remove ( dependency ) ; valueSet . add ( entry ) ; if ( valueSet . size ( ) > this . delayOffloadEntriesLimit ) { if ( this . type == DEP_ID_TABLE ) { returnCode = this . htod . writeValueSet ( HTODDynacache . DEP_ID_DATA , dependency , valueSet , HTODDynacache . ALL ) ; this . htod . cache . getCacheStatisticsListener ( ) . depIdsOffloadedToDisk ( dependency ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "***** add dependency id=" + dependency + " size=" + valueSet . size ( ) ) ; } else { returnCode = this . htod . writeValueSet ( HTODDynacache . TEMPLATE_ID_DATA , dependency , valueSet , HTODDynacache . ALL ) ; this . htod . cache . getCacheStatisticsListener ( ) . templatesOffloadedToDisk ( dependency ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "***** add dependency id=" + dependency + " size=" + valueSet . size ( ) ) ; } dependencyToEntryTable . remove ( dependency ) ; if ( returnCode == HTODDynacache . DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet . size ( ) > 0 ) { this . htod . delCacheEntry ( valueSet , CachePerf . DISK_OVERFLOW , CachePerf . LOCAL , ! Cache . FROM_DEPID_TEMPLATE_INVALIDATION , HTODInvalidationBuffer . FIRE_EVENT ) ; returnCode = HTODDynacache . NO_EXCEPTION ; } } return returnCode ; }
This adds a entry to the ValueSet for the specified dependency . The dependency is found in the dependencyToEntryTable .
35,940
public int add ( Object dependency , ValueSet valueSet ) { int returnCode = HTODDynacache . NO_EXCEPTION ; if ( dependencyToEntryTable . size ( ) >= this . maxSize ) { returnCode = reduceTableSize ( ) ; } dependencyNotUpdatedTable . put ( dependency , valueSet ) ; dependencyToEntryTable . put ( dependency , valueSet ) ; return returnCode ; }
This adds a new dependency with its valueSet to the DependencyToEntryTable .
35,941
public int replace ( Object dependency , ValueSet valueSet ) { int returnCode = HTODDynacache . NO_EXCEPTION ; dependencyNotUpdatedTable . remove ( dependency ) ; if ( valueSet != null && valueSet . size ( ) > this . delayOffloadEntriesLimit ) { dependencyToEntryTable . remove ( dependency ) ; if ( this . type == DEP_ID_TABLE ) { returnCode = this . htod . writeValueSet ( HTODDynacache . DEP_ID_DATA , dependency , valueSet , HTODDynacache . ALL ) ; this . htod . cache . getCacheStatisticsListener ( ) . depIdsOffloadedToDisk ( dependency ) ; } else { returnCode = this . htod . writeValueSet ( HTODDynacache . TEMPLATE_ID_DATA , dependency , valueSet , HTODDynacache . ALL ) ; this . htod . cache . getCacheStatisticsListener ( ) . templatesOffloadedToDisk ( dependency ) ; } } else { if ( valueSet . size ( ) > 0 ) { dependencyToEntryTable . put ( dependency , valueSet ) ; } else { dependencyToEntryTable . remove ( dependency ) ; } } if ( returnCode == HTODDynacache . DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet . size ( ) > 0 ) { this . htod . delCacheEntry ( valueSet , CachePerf . DISK_OVERFLOW , CachePerf . LOCAL , ! Cache . FROM_DEPID_TEMPLATE_INVALIDATION , HTODInvalidationBuffer . FIRE_EVENT ) ; returnCode = HTODDynacache . NO_EXCEPTION ; } return returnCode ; }
This replaces the existing dependency with new valueSet in DependencyToEntryTable .
35,942
public Result removeEntry ( Object dependency , Object entry ) { Result result = this . htod . getFromResultPool ( ) ; ValueSet valueSet = ( ValueSet ) dependencyToEntryTable . get ( dependency ) ; if ( valueSet == null ) { return result ; } result . bExist = HTODDynacache . EXIST ; valueSet . remove ( entry ) ; dependencyNotUpdatedTable . remove ( dependency ) ; if ( valueSet . isEmpty ( ) ) { dependencyToEntryTable . remove ( dependency ) ; if ( this . type == DEP_ID_TABLE ) { result . returnCode = this . htod . delValueSet ( HTODDynacache . DEP_ID_DATA , dependency ) ; } else { result . returnCode = this . htod . delValueSet ( HTODDynacache . TEMPLATE_ID_DATA , dependency ) ; } } return result ; }
This removes the specified entry from the specified dependency .
35,943
public ValueSet getEntries ( Object dependency ) { ValueSet valueSet = ( ValueSet ) dependencyToEntryTable . get ( dependency ) ; return valueSet ; }
This returns the ValueSet for the specified dependency from the DependencyToEntryTable .
35,944
private int reduceTableSize ( ) { int returnCode = HTODDynacache . NO_EXCEPTION ; int count = this . entryRemove ; if ( count > 0 ) { int removeSize = 5 ; while ( count > 0 ) { int minSize = Integer . MAX_VALUE ; Iterator < Map . Entry < Object , Set < Object > > > e = dependencyToEntryTable . entrySet ( ) . iterator ( ) ; while ( e . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) e . next ( ) ; Object id = entry . getKey ( ) ; ValueSet vs = ( ValueSet ) entry . getValue ( ) ; int vsSize = vs . size ( ) ; if ( vsSize < removeSize ) { if ( this . type == DEP_ID_TABLE ) { returnCode = this . htod . writeValueSet ( HTODDynacache . DEP_ID_DATA , id , vs , HTODDynacache . ALL ) ; this . htod . cache . getCacheStatisticsListener ( ) . depIdsOffloadedToDisk ( id ) ; Tr . debug ( tc , " reduceTableSize dependency id=" + id + " vs=" + vs . size ( ) + " returnCode=" + returnCode ) ; } else { returnCode = this . htod . writeValueSet ( HTODDynacache . TEMPLATE_ID_DATA , id , vs , HTODDynacache . ALL ) ; this . htod . cache . getCacheStatisticsListener ( ) . templatesOffloadedToDisk ( id ) ; Tr . debug ( tc , "reduceTableSize template id=" + id + " vs=" + vs . size ( ) + " returnCode=" + returnCode ) ; } dependencyToEntryTable . remove ( id ) ; dependencyNotUpdatedTable . remove ( id ) ; count -- ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { return returnCode ; } else if ( returnCode == HTODDynacache . DISK_SIZE_OVER_LIMIT_EXCEPTION ) { this . htod . delCacheEntry ( vs , CachePerf . DISK_OVERFLOW , CachePerf . LOCAL , ! Cache . FROM_DEPID_TEMPLATE_INVALIDATION , HTODInvalidationBuffer . FIRE_EVENT ) ; returnCode = HTODDynacache . NO_EXCEPTION ; return returnCode ; } } else { minSize = vsSize < minSize ? vsSize : minSize ; } if ( count == 0 ) { break ; } } removeSize = minSize ; removeSize += 3 ; } } return returnCode ; }
This reduces the DependencyToEntryTable size by offloading some dependencies to the disk .
35,945
private static String getClassName ( String implClassName ) { implClassName = implClassName . substring ( 0 , implClassName . length ( ) - 4 ) ; return implClassName + "ComponentImpl" ; }
The model interface type has a name ending in Type . For the moment modify it here .
35,946
public void registerThread ( StoppableThread thread ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerThread" , thread ) ; synchronized ( this ) { _threadCache . add ( thread ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerThread" ) ; }
Registers a new thread for stopping
35,947
public void deregisterThread ( StoppableThread thread ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deregisterThread" , thread ) ; synchronized ( this ) { _threadCache . remove ( thread ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deregisterThread" ) ; }
Deregisters a thread for stopping
35,948
public void stopAllThreads ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stopAllThreads" ) ; synchronized ( this ) { Iterator iterator = ( ( ArrayList ) _threadCache . clone ( ) ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { StoppableThread thread = ( StoppableThread ) iterator . next ( ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Attempting to stop thread " + thread ) ; thread . stopThread ( this ) ; iterator . remove ( ) ; _threadCache . remove ( thread ) ; } } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stopAllThreads" ) ; }
Stops all the stoppable threads that haven t already been stopped
35,949
public ArrayList getThreads ( ) { if ( tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getThreads" ) ; SibTr . exit ( tc , "getThreads" , _threadCache ) ; } return _threadCache ; }
Unit test hook to check on connected threads
35,950
private int getAndUpdateTail ( ) { int retMe ; do { retMe = tailIndex . get ( ) ; } while ( tailIndex . compareAndSet ( retMe , getNext ( retMe ) ) == false ) ; return retMe ; }
Atomically update and return the tailIndex .
35,951
public boolean put ( ExpirableReference expirable ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "put" , "ObjId=" + expirable . getID ( ) + " ET=" + expirable . getExpiryTime ( ) ) ; boolean reply = tree . insert ( expirable ) ; if ( reply ) { size ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" , "reply=" + reply ) ; return reply ; }
Add an ExpirableReference to the expiry index .
35,952
protected static Map < String , ProductInfo > getAllProductInfo ( File wlpInstallationDirectory ) throws VersionParsingException { File versionPropertyDirectory = new File ( wlpInstallationDirectory , ProductInfo . VERSION_PROPERTY_DIRECTORY ) ; if ( ! versionPropertyDirectory . exists ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_NO_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } if ( ! versionPropertyDirectory . isDirectory ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_NOT_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } if ( ! versionPropertyDirectory . canRead ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_UNABLE_READ_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } Map < String , ProductInfo > productIdToVersionPropertiesMap ; try { productIdToVersionPropertiesMap = ProductInfo . getAllProductInfo ( wlpInstallationDirectory ) ; } catch ( IllegalArgumentException e ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_UNABLE_READ_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } catch ( ProductInfoParseException e ) { String missingKey = e . getMissingKey ( ) ; if ( missingKey != null ) { throw new VersionParsingException ( CommandUtils . getMessage ( "version.missing.key" , missingKey , e . getFile ( ) . getAbsoluteFile ( ) ) ) ; } throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_UNABLE_READ_FILE" , e . getFile ( ) . getAbsoluteFile ( ) , e . getCause ( ) . getMessage ( ) ) ) ; } catch ( DuplicateProductInfoException e ) { throw new VersionParsingException ( CommandUtils . getMessage ( "version.duplicated.productId" , ProductInfo . COM_IBM_WEBSPHERE_PRODUCTID_KEY , e . getProductInfo1 ( ) . getFile ( ) . getAbsoluteFile ( ) , e . getProductInfo2 ( ) . getFile ( ) . getAbsoluteFile ( ) ) ) ; } catch ( ProductInfoReplaceException e ) { ProductInfo productInfo = e . getProductInfo ( ) ; String replacesId = productInfo . getReplacesId ( ) ; if ( replacesId . equals ( productInfo . getId ( ) ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "version.replaced.product.can.not.itself" , productInfo . getFile ( ) . getAbsoluteFile ( ) ) ) ; } throw new VersionParsingException ( CommandUtils . getMessage ( "version.replaced.product.not.exist" , replacesId , productInfo . getFile ( ) . getAbsoluteFile ( ) ) ) ; } if ( productIdToVersionPropertiesMap . isEmpty ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_NO_PROPERTIES_FILE" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } return productIdToVersionPropertiesMap ; }
This method will create a map of product ID to the VersionProperties for that product .
35,953
public boolean remove ( V value ) { K key = value . getKey ( ) ; Ref < V > ref = map . get ( key ) ; return ( ref != null && ref . get ( ) == value ) ? map . remove ( key , ref ) : false ; }
Remove any mapping for the provided id
35,954
public V retrieveOrCreate ( K key , Factory < V > factory ) { this . cleanUpStaleEntries ( ) ; return retrieveOrCreate ( key , factory , new FutureRef < V > ( ) ) ; }
Create a value for the given key iff one has not already been stored . This method is safe to be called concurrently from multiple threads . It will ensure that only one thread succeeds to create the value for the given key .
35,955
void cleanUpStaleEntries ( ) { for ( KeyedRef < K , V > ref = q . poll ( ) ; ref != null ; ref = q . poll ( ) ) { map . remove ( ref . getKey ( ) , ref ) ; } }
clean up stale entries
35,956
public Object nextElement ( ) { if ( _array == null ) { return null ; } else { synchronized ( this ) { if ( _index < _array . length ) { Object obj = _array [ _index ] ; _index ++ ; return obj ; } else { return null ; } } } }
nextElement method comment .
35,957
public int execute ( String [ ] args ) { Map < String , LevelDetails > levels = readLevels ( System . getProperty ( "logviewer.custom.levels" ) ) ; String [ ] header = readHeader ( System . getProperty ( "logviewer.custom.header" ) ) ; return execute ( args , levels , header ) ; }
Runs LogViewer using values in System Properties to find custom levels and header .
35,958
public int execute ( String [ ] args , Map < String , LevelDetails > levels , String [ ] header ) { levelString = getLevelsString ( levels ) ; RepositoryReaderImpl logRepository ; try { if ( parseCmdLineArgs ( args ) || validateSettings ( ) ) { return 0 ; } if ( header != null ) { theFormatter . setCustomHeader ( header ) ; } logRepository = new RepositoryReaderImpl ( binaryRepositoryDir ) ; if ( mainInstanceId != null ) { ServerInstanceLogRecordList silrl = logRepository . getLogListForServerInstance ( mainInstanceId ) ; if ( silrl == null || silrl . getStartTime ( ) == null || ! silrl . getStartTime ( ) . equals ( mainInstanceId ) || ( subInstanceId != null && ! subInstanceId . isEmpty ( ) && ! silrl . getChildren ( ) . containsKey ( subInstanceId ) ) ) { throw new IllegalArgumentException ( getLocalizedString ( "LVM_ERROR_INSTANCEID" ) ) ; } } PrintStream outps = createOutputStream ( ) ; LogViewerFilter searchCriteria = new LogViewerFilter ( startDate , stopDate , minLevel , maxLevel , includeLoggers , excludeLoggers , hexThreadID , message , excludeMessages , extensions ) ; if ( listInstances ) { Iterable < ServerInstanceLogRecordList > results = logRepository . getLogLists ( ) ; displayInstances ( outps , results ) ; } else { Properties initialProps = logRepository . getLogListForCurrentServerInstance ( ) . getHeader ( ) ; if ( initialProps != null ) { boolean isZOS = "Y" . equalsIgnoreCase ( initialProps . getProperty ( ServerInstanceLogRecordList . HEADER_ISZOS ) ) ; if ( isZOS && ! latestInstance && mainInstanceId == null ) { Iterable < ServerInstanceLogRecordList > results = logRepository . getLogLists ( ) ; displayInstances ( outps , results ) ; } else { displayRecords ( outps , searchCriteria , logRepository , mainInstanceId , subInstanceId ) ; } } } } catch ( IllegalArgumentException e ) { System . err . println ( e . getMessage ( ) ) ; return 1 ; } return 0 ; }
Runs LogViewer .
35,959
private long collectAllKids ( ArrayList < DisplayInstance > result , ServerInstanceLogRecordList list ) { long timestamp = - 1 ; RepositoryLogRecord first = list . iterator ( ) . next ( ) ; if ( first != null ) { timestamp = first . getMillis ( ) ; } for ( Entry < String , ServerInstanceLogRecordList > kid : list . getChildren ( ) . entrySet ( ) ) { ArrayList < DisplayInstance > kidResult = new ArrayList < DisplayInstance > ( ) ; long curTimestamp = collectAllKids ( kidResult , kid . getValue ( ) ) ; if ( curTimestamp > 0 ) { result . add ( new DisplayInstance ( kid . getKey ( ) , Long . toString ( list . getStartTime ( ) . getTime ( ) ) , curTimestamp , kidResult ) ) ; if ( timestamp < curTimestamp ) { timestamp = curTimestamp ; } } } return timestamp ; }
collects all descendant instances into an array and calculates largest timestamp of their first records .
35,960
private Level createLevelByString ( String levelString ) throws IllegalArgumentException { try { return Level . parse ( levelString . toUpperCase ( ) ) ; } catch ( Exception npe ) { throw new IllegalArgumentException ( getLocalizedParmString ( "CWTRA0013E" , new Object [ ] { levelString } ) ) ; } }
This method creates a java . util . Level object from a string with the level name .
35,961
void setInstanceId ( String instanceId ) throws IllegalArgumentException { if ( instanceId != null && ! "" . equals ( instanceId ) ) { subInstanceId = getSubProcessInstanceId ( instanceId ) ; try { long id = getProcessInstanceId ( instanceId ) ; mainInstanceId = id < 0 ? null : new Date ( id ) ; } catch ( NumberFormatException nfe ) { throw new IllegalArgumentException ( getLocalizedString ( "LVM_ERROR_INSTANCEID" ) , nfe ) ; } } }
Parses the instanceId into the requested main process instanceId and the subprocess instanceid . The main process instanceId must be a long value as the main instance Id is a timestamp .
35,962
protected File [ ] listRepositoryChoices ( ) { String currentDir = System . getProperty ( "log.repository.root" ) ; if ( currentDir == null ) currentDir = System . getProperty ( "user.dir" ) ; File logDir = new File ( currentDir ) ; if ( logDir . isDirectory ( ) ) { File [ ] result = RepositoryReaderImpl . listRepositories ( logDir ) ; if ( result . length == 0 && ( RepositoryReaderImpl . containsLogFiles ( logDir ) || tailInterval > 0 ) ) { return new File [ ] { logDir } ; } else { return result ; } } else { return new File [ ] { } ; } }
Lists directories containing HPEL repositories . It is called when repository is not specified explicitly in the arguments
35,963
private int skipPast ( byte [ ] data , int pos , byte target ) { int index = pos ; while ( index < data . length ) { if ( target == data [ index ++ ] ) { return index ; } } return index ; }
Skip until it runs out of input data or finds the target byte .
35,964
private int parseTrailer ( byte [ ] input , int inOffset , List < WsByteBuffer > list ) throws DataFormatException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Parsing trailer, offset=" + this . parseOffset + " val=" + this . parseInt ) ; } int offset = inOffset ; long val = 0L ; while ( 8 > this . parseOffset && offset < input . length ) { switch ( this . parseOffset ) { case 0 : case 2 : case 4 : case 6 : this . parseFirstByte = input [ offset ] & 0xff ; break ; case 1 : case 5 : this . parseInt = ( ( input [ offset ] & 0xff ) << 8 ) | this . parseFirstByte ; break ; case 3 : val = ( ( input [ offset ] & 0xff ) << 8 ) | this . parseFirstByte ; val = ( val << 16 ) | this . parseInt ; if ( this . checksum . getValue ( ) != val ) { String msg = "Checksum does not match; crc=" + this . checksum . getValue ( ) + " trailer=" + val ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , msg ) ; } release ( list ) ; throw new DataFormatException ( msg ) ; } break ; case 7 : val = ( ( input [ offset ] & 0xff ) << 8 ) | this . parseFirstByte ; val = ( val << 16 ) | this . parseInt ; if ( this . inflater . getBytesWritten ( ) != val ) { String msg = "BytesWritten does not match; inflater=" + this . inflater . getBytesWritten ( ) + " trailer=" + val ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , msg ) ; } release ( list ) ; throw new DataFormatException ( msg ) ; } this . resetNeededToProceed = true ; break ; default : break ; } offset ++ ; this . parseOffset ++ ; } return offset ; }
Parse past the GZIP trailer information . This is the two ints for the CRC32 checksum validation .
35,965
public void logClosedException ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Connection closed with exception: " + e . getMessage ( ) ) ; } }
This logs the error if the connection was closed by a higher level channel with an error .
35,966
void outOfScope ( ) { final String methodName = "outOfScope" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } _outOfScope = true ; try { _connectionClone . close ( ) ; } catch ( final SIException exception ) { FFDCFilter . processException ( exception , "com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope" , FFDC_PROBE_1 , this ) ; if ( TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } } catch ( final SIErrorException exception ) { FFDCFilter . processException ( exception , "com.ibm.ws.sib.ra.inbound.impl.SibRaAbstractConsumerSession.outOfScope" , FFDC_PROBE_2 , this ) ; if ( TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } } if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Called to indicate that this session is now out of scope .
35,967
public void createAppToSecurityRolesMapping ( String appName , Collection < SecurityRole > securityRoles ) { appToSecurityRolesMap . putIfAbsent ( appName , securityRoles ) ; }
Creates the application to security roles mapping for a given application .
35,968
public void removeRoleToRunAsMapping ( String appName ) { Map < String , RunAs > roleToRunAsMap = roleToRunAsMappingPerApp . get ( appName ) ; if ( roleToRunAsMap != null ) { roleToRunAsMap . clear ( ) ; } appToSecurityRolesMap . remove ( appName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Updated the appToSecurityRolesMap: " + appToSecurityRolesMap . toString ( ) ) ; } removeRoleToWarningMapping ( appName ) ; }
Removes the role to RunAs mappings for a given application .
35,969
public void removeRoleToWarningMapping ( String appName ) { Map < String , Boolean > roleToWarningMap = roleToWarningMappingPerApp . get ( appName ) ; if ( roleToWarningMap != null ) { roleToWarningMap . clear ( ) ; } roleToWarningMappingPerApp . remove ( appName ) ; }
Removes the role to warning mappings for a given application .
35,970
private static void determineHandlers ( ) { if ( textHandler != null && ! logRepositoryConfiguration . isTextEnabled ( ) ) textHandler = null ; if ( binaryHandler != null && ! logRepositoryConfiguration . isTextEnabled ( ) ) return ; Handler [ ] handlers = Logger . getLogger ( "" ) . getHandlers ( ) ; for ( Handler handler : handlers ) { String name = handler . getClass ( ) . getName ( ) ; if ( BINLOGGER_HANDLER_NAME . equals ( name ) ) { binaryHandler = ( LogRecordHandler ) handler ; } else if ( TEXTLOGGER_HANDLER_NAME . equals ( name ) ) { textHandler = ( LogRecordTextHandler ) handler ; } } }
determine two handlers needed by the repository
35,971
public void close ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "close" ) ; Enumeration streams = null ; synchronized ( this ) { synchronized ( streamTable ) { closed = true ; closeBrowserSessionsInternal ( ) ; streams = streamTable . elements ( ) ; } } while ( streams . hasMoreElements ( ) ) { StreamInfo sinfo = ( StreamInfo ) streams . nextElement ( ) ; if ( sinfo . stream != null ) { sinfo . stream . close ( ) ; } } synchronized ( streamTable ) { streamTable . clear ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "close" ) ; }
Cleans up the non - persistent state . No methods on the ControlHandler interface should be called after this is called .
35,972
public boolean cleanup ( boolean flushStreams , boolean redriveDeletionThread ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "cleanup" , new Object [ ] { Boolean . valueOf ( flushStreams ) , Boolean . valueOf ( redriveDeletionThread ) } ) ; boolean retvalue = false ; synchronized ( streamTable ) { if ( finishedCloseAndFlush ) { retvalue = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "cleanup" , Boolean . valueOf ( retvalue ) ) ; return retvalue ; } } if ( ! flushStreams ) { close ( ) ; retvalue = true ; } else { closeAndFlush ( redriveDeletionThread ) ; synchronized ( streamTable ) { retvalue = finishedCloseAndFlush ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "cleanup" , Boolean . valueOf ( retvalue ) ) ; return retvalue ; }
Cleanup the state in this AnycastOutputHandler . Called when this localisation is being deleted .
35,973
public final AOStream getAOStream ( String streamKey , SIBUuid12 streamId ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getAOStream" , new Object [ ] { streamKey , streamId } ) ; StreamInfo streamInfo = getStreamInfo ( streamKey , streamId ) ; if ( streamInfo != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAOStream" , streamInfo . stream ) ; return streamInfo . stream ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAOStream" , null ) ; return null ; }
for unit testing
35,974
private final void handleControlBrowseStatus ( SIBUuid8 remoteME , SIBUuid12 gatheringTargetDestUuid , long browseId , int status ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "handleControlBrowseStatus" , new Object [ ] { remoteME , gatheringTargetDestUuid , Long . valueOf ( browseId ) , Integer . valueOf ( status ) } ) ; AOBrowserSessionKey key = new AOBrowserSessionKey ( remoteME , gatheringTargetDestUuid , browseId ) ; AOBrowserSession session = ( AOBrowserSession ) browserSessionTable . get ( key ) ; if ( session != null ) { if ( status == SIMPConstants . BROWSE_CLOSE ) { session . close ( ) ; browserSessionTable . remove ( key ) ; } else if ( status == SIMPConstants . BROWSE_ALIVE ) { session . keepAlive ( ) ; } } else { } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "handleControlBrowseStatus" ) ; }
Method to handle a ControlBrowseStatus message from an RME
35,975
public final void removeBrowserSession ( AOBrowserSessionKey key ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeBrowserSession" , key ) ; browserSessionTable . remove ( key ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeBrowserSession" ) ; }
Remove an AOBrowserSession that is already closed
35,976
private final StreamInfo getStreamInfo ( String streamKey , SIBUuid12 streamId ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getStreamInfo" , new Object [ ] { streamKey , streamId } ) ; StreamInfo sinfo = streamTable . get ( streamKey ) ; if ( ( sinfo != null ) && sinfo . streamId . equals ( streamId ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getStreamInfo" , sinfo ) ; return sinfo ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getStreamInfo" , null ) ; return null ; }
Helper method used to dispatch a message received for a particular stream . Handles its own synchronization
35,977
public final void streamIsFlushed ( AOStream stream ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "streamIsFlushed" , stream ) ; synchronized ( streamTable ) { String key = SIMPUtils . getRemoteGetKey ( stream . getRemoteMEUuid ( ) , stream . getGatheringTargetDestUuid ( ) ) ; StreamInfo sinfo = streamTable . get ( key ) ; if ( ( sinfo != null ) && sinfo . streamId . equals ( stream . streamId ) ) { RemovePersistentStream update = null ; synchronized ( sinfo ) { update = new RemovePersistentStream ( key , sinfo . streamId , sinfo . itemStream , sinfo . item ) ; } doEnqueueWork ( update ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "streamIsFlushed" ) ; }
Callback from a stream that it has been flushed
35,978
public final AOValue persistLockAndTick ( TransactionCommon t , AOStream stream , long tick , SIMPMessage msg , int storagePolicy , long waitTime , long prevTick ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "persistLockAndTick" , new Object [ ] { t , stream , Long . valueOf ( tick ) , msg , Integer . valueOf ( storagePolicy ) , Long . valueOf ( waitTime ) , Long . valueOf ( prevTick ) } ) ; AOValue retvalue = null ; try { Transaction msTran = mp . resolveAndEnlistMsgStoreTransaction ( t ) ; msg . persistLock ( msTran ) ; long plockId = msg . getLockID ( ) ; retvalue = new AOValue ( tick , msg , msg . getID ( ) , storagePolicy , plockId , waitTime , prevTick ) ; stream . itemStream . addItem ( retvalue , msTran ) ; } catch ( Exception e ) { retvalue = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "persistLockAndTick" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "persistLockAndTick" , retvalue ) ; return retvalue ; }
Helper method called by the AOStream when to persistently lock a message and create a persistent tick in the protocol stream
35,979
public final void cleanupTicks ( StreamInfo sinfo , TransactionCommon t , ArrayList valueTicks ) throws MessageStoreException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "cleanupTicks" , new Object [ ] { sinfo , t , valueTicks } ) ; try { int length = valueTicks . size ( ) ; for ( int i = 0 ; i < length ; i ++ ) { AOValue storedTick = ( AOValue ) valueTicks . get ( i ) ; ConsumerDispatcher cd = null ; if ( storedTick . getSourceMEUuid ( ) == null || storedTick . getSourceMEUuid ( ) . equals ( getMessageProcessor ( ) . getMessagingEngineUuid ( ) ) ) { cd = ( ConsumerDispatcher ) destinationHandler . getLocalPtoPConsumerManager ( ) ; } else { AnycastInputHandler aih = destinationHandler . getAnycastInputHandler ( storedTick . getSourceMEUuid ( ) , null , true ) ; cd = aih . getRCD ( ) ; } SIMPMessage msg = null ; synchronized ( storedTick ) { msg = ( SIMPMessage ) cd . getMessageByValue ( storedTick ) ; if ( msg == null ) { storedTick . setToBeFlushed ( ) ; } } Transaction msTran = mp . resolveAndEnlistMsgStoreTransaction ( t ) ; if ( msg != null && msg . getLockID ( ) == storedTick . getPLockId ( ) ) msg . unlockMsg ( storedTick . getPLockId ( ) , msTran , true ) ; storedTick . lockItemIfAvailable ( controlItemLockID ) ; storedTick . remove ( msTran , controlItemLockID ) ; } } catch ( MessageStoreException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "cleanupTicks" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "cleanupTicks" ) ; }
Helper method called by the AOStream when a persistent tick representing a persistently locked message should be removed since we are flushing or cleaning up state .
35,980
public final Item writeStartedFlush ( TransactionCommon t , AOStream stream ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writeStartedFlush" ) ; String key = SIMPUtils . getRemoteGetKey ( stream . getRemoteMEUuid ( ) , stream . getGatheringTargetDestUuid ( ) ) ; StreamInfo sinfo = streamTable . get ( key ) ; if ( ( sinfo != null ) && sinfo . streamId . equals ( stream . streamId ) ) { AOStartedFlushItem item = new AOStartedFlushItem ( key , stream . streamId ) ; Transaction msTran = mp . resolveAndEnlistMsgStoreTransaction ( t ) ; this . containerItemStream . addItem ( item , msTran ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeStartedFlush" , item ) ; return item ; } SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:2810:1.89.4.1" } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writeStartedFlush" , "1:2817:1.89.4.1" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:2822:1.89.4.1" } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeStartedFlush" , e ) ; throw e ; }
Helper method used by AOStream to persistently record that flush has been started
35,981
public final void writtenStartedFlush ( AOStream stream , Item startedFlushItem ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writtenStartedFlush" ) ; String key = SIMPUtils . getRemoteGetKey ( stream . getRemoteMEUuid ( ) , stream . getGatheringTargetDestUuid ( ) ) ; StreamInfo sinfo = streamTable . get ( key ) ; if ( ( sinfo != null ) && sinfo . streamId . equals ( stream . streamId ) ) { synchronized ( sinfo ) { sinfo . item = ( AOStartedFlushItem ) startedFlushItem ; } } else { SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:2858:1.89.4.1" } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writtenStartedFlush" , "1:2865:1.89.4.1" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:2872:1.89.4.1" } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writtenStartedFlush" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writtenStartedFlush" ) ; }
Callback when the Item that records that flush has been started has been committed to persistent storage
35,982
public SIMPItemStream getItemStream ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getItemStream" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getItemStream" , containerItemStream ) ; return ( SIMPItemStream ) containerItemStream ; }
Return the SIMPItemStream associated with this AOH . This method is needed for proper cleanup of remote durable subscriptions since the usual item stream owned by the DestinationHandler is not used .
35,983
public final String getDestName ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getDestName" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getDestName" , destName ) ; return destName ; }
Return the destination name which this AOH is associated with .
35,984
public final SIBUuid12 getDestUUID ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getDestUUID" ) ; SibTr . exit ( tc , "getDestUUID" , destName ) ; } return destUuid ; }
Return the destination UUID which this AOH is associated with . This method is needed for proper cleanup of remote durable subscriptions since pseudo destinations are used rather than the destination normally associated with the DestinationHandler .
35,985
public void forceFlushAtSource ( SIBUuid8 remoteUuid , SIBUuid12 gatheringTargetDestUuid ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "forceFlushAtSource" , new Object [ ] { remoteUuid , gatheringTargetDestUuid } ) ; StreamInfo sinfo ; boolean success = false ; String key = SIMPUtils . getRemoteGetKey ( remoteUuid , gatheringTargetDestUuid ) ; synchronized ( streamTable ) { sinfo = streamTable . get ( key ) ; } if ( sinfo == null ) { success = true ; } else if ( sinfo . stream == null ) { SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:3159:1.89.4.1" } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource" , "1:3165:1.89.4.1" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:3171:1.89.4.1" } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "forceFlushAtSource" ) ; throw e ; } else { try { AOStream stream = sinfo . stream ; stream . close ( ) ; ArrayList < AOValue > valueTicks = new ArrayList < AOValue > ( ) ; NonLockingCursor cursor = sinfo . itemStream . newNonLockingItemCursor ( null ) ; AOValue tick ; while ( ( tick = ( AOValue ) cursor . next ( ) ) != null ) { valueTicks . add ( tick ) ; } cursor . finished ( ) ; deleteAndUnlockPersistentStream ( sinfo , valueTicks ) ; synchronized ( streamTable ) { streamTable . remove ( key ) ; } success = true ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.forceFlushAtSource" , "1:3211:1.89.4.1" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:3217:1.89.4.1" } ) ; SIErrorException e2 = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:3226:1.89.4.1" } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "forceFlushAtSource" ) ; throw e2 ; } } if ( success ) { SibTr . info ( tc , "FLUSH_COMPLETE_CWSIP0452" , new Object [ ] { destName , mp . getMessagingEngineName ( ) , key } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "forceFlushAtSource" ) ; }
If the RME has been deleted then the stream needs to be flushed to unlock any messaqes on this DME .
35,986
private void deleteAndUnlockPersistentStream ( StreamInfo sinfo , ArrayList valueTicks ) throws MessageStoreException , SIRollbackException , SIConnectionLostException , SIIncorrectCallException , SIResourceException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteAndUnlockPersistentStream" , new Object [ ] { sinfo , valueTicks } ) ; LocalTransaction tran = getLocalTransaction ( ) ; cleanupTicks ( sinfo , tran , valueTicks ) ; Transaction msTran = mp . resolveAndEnlistMsgStoreTransaction ( tran ) ; sinfo . itemStream . lockItemIfAvailable ( controlItemLockID ) ; sinfo . itemStream . remove ( msTran , controlItemLockID ) ; if ( sinfo . item != null ) { sinfo . item . lockItemIfAvailable ( controlItemLockID ) ; sinfo . item . remove ( msTran , controlItemLockID ) ; } tran . commit ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteAndUnlockPersistentStream" ) ; }
remove the persistent ticks and the itemstream and started - flush item
35,987
protected void init ( boolean useDirect , int outSize , int inSize , int cacheSize ) { this . useDirectBuffer = useDirect ; this . outgoingHdrBufferSize = outSize ; this . incomingBufferSize = inSize ; if ( cacheSize > this . byteCacheSize ) { this . byteCacheSize = cacheSize ; this . byteCache = new byte [ cacheSize ] ; } }
Initialize this class instance with the chosen parse configuration options .
35,988
public void addParseBuffer ( WsByteBuffer buffer ) { int index = ++ this . parseIndex ; if ( null == this . parseBuffers ) { this . parseBuffers = new WsByteBuffer [ BUFFERS_INITIAL_SIZE ] ; this . parseBuffersStartPos = new int [ BUFFERS_INITIAL_SIZE ] ; for ( int i = 0 ; i < BUFFERS_INITIAL_SIZE ; i ++ ) { this . parseBuffersStartPos [ i ] = HeaderStorage . NOTSET ; } } else if ( index == this . parseBuffers . length ) { int size = index + BUFFERS_MIN_GROWTH ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Increasing parse buffer array size to " + size ) ; } WsByteBuffer [ ] tempNew = new WsByteBuffer [ size ] ; System . arraycopy ( this . parseBuffers , 0 , tempNew , 0 , index ) ; this . parseBuffers = tempNew ; int [ ] posNew = new int [ size ] ; System . arraycopy ( this . parseBuffersStartPos , 0 , posNew , 0 , index ) ; for ( int i = index ; i < size ; i ++ ) { posNew [ i ] = HeaderStorage . NOTSET ; } this . parseBuffersStartPos = posNew ; } this . parseBuffers [ index ] = buffer ; }
Save a reference to a new buffer with header parse information . This is not part of the created list and will not be released by this message class .
35,989
public void addToCreatedBuffer ( WsByteBuffer buffer ) { int index = ++ this . createdIndex ; if ( null == this . myCreatedBuffers ) { this . myCreatedBuffers = new WsByteBuffer [ BUFFERS_INITIAL_SIZE ] ; } else if ( index == this . myCreatedBuffers . length ) { int size = index + BUFFERS_MIN_GROWTH ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Increasing created buffer array size to " + size ) ; } WsByteBuffer [ ] tempNew = new WsByteBuffer [ size ] ; System . arraycopy ( this . myCreatedBuffers , 0 , tempNew , 0 , index ) ; this . myCreatedBuffers = tempNew ; } this . myCreatedBuffers [ index ] = buffer ; }
Add a buffer on the list that will be manually released later .
35,990
public void clear ( ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; if ( bTrace && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "clear" ) ; } clearAllHeaders ( ) ; this . eohPosition = HeaderStorage . NOTSET ; this . currentElem = null ; this . stateOfParsing = PARSING_CRLF ; this . binaryParsingState = GenericConstants . PARSING_HDR_FLAG ; this . parsedToken = null ; this . parsedTokenLength = 0 ; this . bytePosition = 0 ; this . byteLimit = 0 ; this . currentReadBB = null ; clearBuffers ( ) ; this . debugContext = this ; this . numCRLFs = 0 ; this . bIsMultiLine = false ; this . lastCRLFBufferIndex = HeaderStorage . NOTSET ; this . lastCRLFPosition = HeaderStorage . NOTSET ; this . lastCRLFisCR = false ; this . headerChangeCount = 0 ; this . headerAddCount = 0 ; this . bOverChangeLimit = false ; this . compactHeaderFlag = false ; this . table = null ; this . isPushPromise = false ; this . processedXForwardedHeader = false ; this . processedForwardedHeader = false ; this . forwardHeaderErrorState = false ; this . forwardedByList = null ; this . forwardedForList = null ; this . forwardedHost = null ; this . forwardedPort = null ; this . forwardedProto = null ; if ( bTrace && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "clear" ) ; } }
Clear out information on this object so that it can be re - used .
35,991
private void clearBuffers ( ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; for ( int i = 0 ; i <= this . parseIndex ; i ++ ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Removing reference to parse buffer: " + this . parseBuffers [ i ] ) ; } this . parseBuffers [ i ] = null ; this . parseBuffersStartPos [ i ] = HeaderStorage . NOTSET ; } this . parseIndex = HeaderStorage . NOTSET ; for ( int i = 0 ; i <= this . createdIndex ; i ++ ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Releasing marshall buffer: " + this . myCreatedBuffers [ i ] ) ; } this . myCreatedBuffers [ i ] . release ( ) ; this . myCreatedBuffers [ i ] = null ; } this . createdIndex = HeaderStorage . NOTSET ; }
Clear the array of buffers used during the parsing or marshalling of headers .
35,992
public void debug ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "*** Begin Header Debug ***" ) ; HeaderElement elem = this . hdrSequence ; while ( null != elem ) { Tr . debug ( tc , elem . getName ( ) + ": " + elem . getDebugValue ( ) ) ; elem = elem . nextSequence ; } Tr . debug ( tc , "*** End Header Debug ***" ) ; } }
Print debug information on the headers to the RAS tracing log .
35,993
protected void destroy ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Destroying these headers: " + this ) ; } if ( null != this . hdrSequence || HeaderStorage . NOTSET != this . parseIndex ) { clear ( ) ; } this . byteCacheSize = DEFAULT_CACHESIZE ; this . incomingBufferSize = DEFAULT_BUFFERSIZE ; this . outgoingHdrBufferSize = DEFAULT_BUFFERSIZE ; this . useDirectBuffer = true ; this . limitNumHeaders = DEFAULT_LIMIT_NUMHEADERS ; this . limitTokenSize = DEFAULT_LIMIT_TOKENSIZE ; this . headerChangeLimit = HeaderStorage . NOTSET ; }
Completely clear out all the information on this object when it is no longer used .
35,994
protected void writeByteArray ( ObjectOutput output , byte [ ] data ) throws IOException { if ( null == data || 0 == data . length ) { output . writeInt ( - 1 ) ; } else { output . writeInt ( data . length ) ; output . write ( data ) ; } }
Write information for the input data to the output stream . If the input data is null or empty this will write a - 1 length marker .
35,995
private void scribbleWhiteSpace ( WsByteBuffer buffer , int start , int stop ) { if ( buffer . hasArray ( ) ) { final byte [ ] data = buffer . array ( ) ; final int offset = buffer . arrayOffset ( ) ; int myStart = start + offset ; int myStop = stop + offset ; for ( int i = myStart ; i < myStop ; i ++ ) { data [ i ] = BNFHeaders . SPACE ; } } else { byte [ ] localWhitespace = whitespace ; if ( null == localWhitespace ) { localWhitespace = getWhiteSpace ( ) ; } buffer . position ( start ) ; int len = stop - start ; while ( len > 0 ) { if ( localWhitespace . length >= len ) { buffer . put ( localWhitespace , 0 , len ) ; break ; } int partial = localWhitespace . length ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Scribbling " + partial + " bytes of whitespace" ) ; } buffer . put ( localWhitespace , 0 , partial ) ; len -= partial ; } } }
Overlay whitespace into the input buffer using the provided starting and stopping positions .
35,996
private void eraseValue ( HeaderElement elem ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Erasing existing header: " + elem . getName ( ) ) ; } int next_index = this . lastCRLFBufferIndex ; int next_pos = this . lastCRLFPosition ; if ( null != elem . nextSequence && ! elem . nextSequence . wasAdded ( ) ) { next_index = elem . nextSequence . getLastCRLFBufferIndex ( ) ; next_pos = elem . nextSequence . getLastCRLFPosition ( ) ; } int start = elem . getLastCRLFPosition ( ) ; for ( int x = elem . getLastCRLFBufferIndex ( ) ; x < next_index ; x ++ ) { this . parseBuffers [ x ] . position ( start ) ; this . parseBuffers [ x ] . limit ( start ) ; start = 0 ; } scribbleWhiteSpace ( this . parseBuffers [ next_index ] , start , next_pos ) ; }
Method to completely erase the input header from the parse buffers .
35,997
private int overlayBytes ( byte [ ] data , int inOffset , int inLength , int inIndex ) { int length = inLength ; int offset = inOffset ; int index = inIndex ; WsByteBuffer buffer = this . parseBuffers [ index ] ; if ( - 1 == length ) { length = data . length ; } while ( index <= this . parseIndex ) { int remaining = buffer . remaining ( ) ; if ( remaining >= length ) { buffer . put ( data , offset , length ) ; return index ; } buffer . put ( data , offset , remaining ) ; offset += remaining ; length -= remaining ; buffer = this . parseBuffers [ ++ index ] ; buffer . position ( 0 ) ; } return index ; }
Utility method to overlay the input bytes into the parse buffers starting at the input index and moving forward as needed .
35,998
private void overlayValue ( HeaderElement elem ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Overlaying existing header: " + elem . getName ( ) ) ; } int next_index = this . lastCRLFBufferIndex ; int next_pos = this . lastCRLFPosition ; if ( null != elem . nextSequence && ! elem . nextSequence . wasAdded ( ) ) { next_index = elem . nextSequence . getLastCRLFBufferIndex ( ) ; next_pos = elem . nextSequence . getLastCRLFPosition ( ) ; } WsByteBuffer buffer = this . parseBuffers [ elem . getLastCRLFBufferIndex ( ) ] ; buffer . position ( elem . getLastCRLFPosition ( ) + ( elem . isLastCRLFaCR ( ) ? 2 : 1 ) ) ; if ( next_index == elem . getLastCRLFBufferIndex ( ) ) { buffer . put ( elem . getKey ( ) . getMarshalledByteArray ( foundCompactHeader ( ) ) ) ; buffer . put ( elem . asRawBytes ( ) , elem . getOffset ( ) , elem . getValueLength ( ) ) ; } else { int index = elem . getLastCRLFBufferIndex ( ) ; index = overlayBytes ( elem . getKey ( ) . getMarshalledByteArray ( foundCompactHeader ( ) ) , 0 , - 1 , index ) ; index = overlayBytes ( elem . asRawBytes ( ) , elem . getOffset ( ) , elem . getValueLength ( ) , index ) ; buffer = this . parseBuffers [ index ] ; } int start = buffer . position ( ) ; if ( start < next_pos ) { scribbleWhiteSpace ( buffer , start , next_pos ) ; } }
Method to overlay the new header value onto the older value in the parse buffers .
35,999
private WsByteBuffer [ ] marshallAddedHeaders ( WsByteBuffer [ ] inBuffers , int index ) { WsByteBuffer [ ] buffers = inBuffers ; buffers [ index ] = allocateBuffer ( this . outgoingHdrBufferSize ) ; for ( HeaderElement elem = this . hdrSequence ; null != elem ; elem = elem . nextSequence ) { if ( elem . wasAdded ( ) ) { buffers = marshallHeader ( buffers , elem ) ; } } buffers = putBytes ( BNFHeaders . EOL , buffers ) ; buffers = flushCache ( buffers ) ; buffers [ buffers . length - 1 ] . flip ( ) ; return buffers ; }
Marshall the newly added headers from the sequence list to the output buffers starting at the input index on the list .