idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
37,400
private static JarFile _getAlternativeJarFile ( URL url ) throws IOException { String urlFile = url . getFile ( ) ; int separatorIndex = urlFile . indexOf ( "!/" ) ; if ( separatorIndex == - 1 ) { separatorIndex = urlFile . indexOf ( '!' ) ; } if ( separatorIndex != - 1 ) { String jarFileUrl = urlFile . substring ( 0 , separatorIndex ) ; if ( jarFileUrl . startsWith ( "file:" ) ) { jarFileUrl = jarFileUrl . substring ( "file:" . length ( ) ) ; } return new JarFile ( jarFileUrl ) ; } return null ; }
taken from org . apache . myfaces . view . facelets . util . Classpath
37,401
private void requestProcessed ( FacesContext facesContext ) { if ( ! _firstRequestProcessed ) { facesContext . getExternalContext ( ) . getApplicationMap ( ) . put ( FIRST_REQUEST_PROCESSED_PARAM , Boolean . TRUE ) ; _firstRequestProcessed = true ; } }
This method places an attribute on the application map to indicate that the first request has been processed . This attribute is used by several methods in ApplicationImpl to determine whether or not to throw an IllegalStateException
37,402
@ Generated ( value = "com.ibm.jtc.jax.tools.xjc.Driver" , date = "2014-06-11T05:49:00-04:00" , comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-" ) public List < Property > getPropertyList ( ) { if ( propertyList == null ) { propertyList = new ArrayList < Property > ( ) ; } return this . propertyList ; }
Gets the value of the propertyList property .
37,403
protected Token current ( ) { final String methodName = "current" ; Token currentToken ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName + toString ( ) ) ; currentToken = objectStore . like ( this ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { currentToken , Integer . toHexString ( currentToken . hashCode ( ) ) } ) ; return currentToken ; }
Give back the current token if there is already one known to the Object Store for the same ManagedObject .
37,404
public final ManagedObject getManagedObject ( ) throws ObjectManagerException { ManagedObject managedObject = null ; if ( managedObjectReference != null ) managedObject = ( ManagedObject ) managedObjectReference . get ( ) ; if ( managedObject == null ) { synchronized ( this ) { if ( managedObjectReference != null ) managedObject = ( ManagedObject ) managedObjectReference . get ( ) ; if ( managedObject == null ) { managedObject = objectStore . get ( this ) ; if ( managedObject != null ) { managedObject . owningToken = this ; managedObjectReference = new java . lang . ref . WeakReference ( managedObject ) ; } } } } return managedObject ; }
Find the ManagedObject handled by this token .
37,405
protected synchronized ManagedObject setManagedObject ( ManagedObject managedObject ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "setManagedObject" + "managedObject=" + managedObject + "(ManagedObject)" + toString ( ) ) ; ManagedObject managedObjectSet ; if ( managedObjectReference == null ) { managedObject . owningToken = this ; managedObjectReference = new java . lang . ref . WeakReference ( managedObject ) ; managedObjectSet = managedObject ; } else { ManagedObject existingManagedObject = ( ManagedObject ) managedObjectReference . get ( ) ; if ( existingManagedObject == null ) { managedObject . owningToken = this ; managedObjectReference = new java . lang . ref . WeakReference ( managedObject ) ; managedObjectSet = managedObject ; } else { existingManagedObject . becomeCloneOf ( managedObject ) ; managedObjectSet = existingManagedObject ; } } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setManagedObject" , new Object [ ] { managedObjectSet } ) ; return managedObjectSet ; }
Associate a new ManagedObject with this token . If there is already a managedObject associated with the Token it is replaced by making it a clone of the new ManagedObject so that existing references to the old ManagedObject becone refrences to the new one .
37,406
void invalidate ( ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "invalidate" ) ; objectStore = null ; if ( managedObjectReference != null ) { ManagedObject managedObject = ( ManagedObject ) managedObjectReference . get ( ) ; if ( managedObject != null ) managedObject . state = ManagedObject . stateError ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "invalidate" ) ; }
Make the token and any ManagedObject it refers to invalid . Used at shutdown to prevent accidental use of a ManagedObject in the ObjectManager that instantiated it or any other Object Manager .
37,407
public static final Token restore ( java . io . DataInputStream dataInputStream , ObjectManagerState objectManagerState ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( cclass , "restore" , new Object [ ] { dataInputStream , objectManagerState } ) ; int objectStoreIdentifier ; long storedObjectIdentifier ; try { byte version = dataInputStream . readByte ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isDebugEnabled ( ) ) trace . debug ( cclass , "restore" , new Object [ ] { new Byte ( version ) } ) ; objectStoreIdentifier = dataInputStream . readInt ( ) ; storedObjectIdentifier = dataInputStream . readLong ( ) ; } catch ( java . io . IOException exception ) { ObjectManager . ffdc . processException ( cclass , "restore" , exception , "1:400:1.14" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( cclass , "restore" , "via PermanentIOException" ) ; throw new PermanentIOException ( cclass , exception ) ; } Token tokenToReturn = new Token ( objectManagerState . getObjectStore ( objectStoreIdentifier ) , storedObjectIdentifier ) ; tokenToReturn = tokenToReturn . current ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( cclass , "restore" , "returns token=" + tokenToReturn + "(Token)" ) ; return tokenToReturn ; }
Recover the token described by a dataInputStream and resolve it ot the definitive token .
37,408
public static HttpEndpointImpl findEndpoint ( String endpointId ) { for ( HttpEndpointImpl i : instance . get ( ) ) { if ( i . getName ( ) . equals ( endpointId ) ) return i ; } return null ; }
Return the endpoint for the given id .
37,409
public synchronized List < Long > getTicksOnStream ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getTicksOnStream" ) ; List < Long > msgs = new ArrayList < Long > ( ) ; StateStream stateStream = getStateStream ( ) ; stateStream . setCursor ( 0 ) ; stateStream . getNext ( ) ; TickRange tr = stateStream . getNext ( ) ; while ( tr . endstamp < RangeList . INFINITY ) { if ( ! ( tr . type == TickRange . Completed ) ) { msgs . add ( new Long ( tr . startstamp ) ) ; } tr = stateStream . getNext ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getTicksOnStream" , msgs ) ; return msgs ; }
Gets a list of all tick values on the state stream
37,410
public void quit ( ) { try { this . keepOn = false ; if ( this . serverSocket != null && ! this . serverSocket . isClosed ( ) ) { this . serverSocket . close ( ) ; this . serverSocket = null ; } } catch ( final IOException e ) { throw new RuntimeException ( e ) ; } }
Exit POP3 server .
37,411
boolean contains ( String normalizedPath ) { if ( normalizedPath == null ) return false ; if ( normalizedPath . length ( ) < normalizedRoot . length ( ) ) return false ; return normalizedPath . regionMatches ( 0 , normalizedRoot , 0 , normalizedRoot . length ( ) ) ; }
Check if the provided path is contained within this root s hierarchy .
37,412
private static String getIPAddress ( ) { String rc ; try { rc = InetAddress . getLocalHost ( ) . getHostAddress ( ) ; } catch ( Exception e ) { rc = Long . valueOf ( new Random ( ) . nextLong ( ) ) . toString ( ) ; } return rc ; }
InetAddress is compatible with both IPv4 & IPv6
37,413
private SecurityMetadata getSecurityMetadata ( WebAppConfig webAppConfig ) { WebModuleMetaData wmmd = ( ( WebAppConfigExtended ) webAppConfig ) . getMetaData ( ) ; return ( SecurityMetadata ) wmmd . getSecurityMetaData ( ) ; }
Gets the security metadata from the web app config
37,414
private boolean isDenyUncoveredHttpMethods ( List < SecurityConstraint > scList ) { for ( SecurityConstraint sc : scList ) { List < WebResourceCollection > wrcList = sc . getWebResourceCollections ( ) ; for ( WebResourceCollection wrc : wrcList ) { if ( wrc . getDenyUncoveredHttpMethods ( ) ) { return true ; } } } return false ; }
Returns whether deny - uncovered - http - methods attribute is set . In order to check this value entire WebResourceCollection objects need to be examined since it only set properly when web . xml is processed .
37,415
public final DataSource createConnectionFactory ( ConnectionManager connMgr ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "createConnectionFactory" , connMgr ) ; DataSource connFactory = jdbcRuntime . newDataSource ( this , connMgr ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "createConnectionFactory" , connFactory ) ; return connFactory ; }
Creates a javax . sql . DataSource that uses the application server provided connection manager to manage its connections .
37,416
private Connection getConnection ( PooledConnection pconn , WSConnectionRequestInfoImpl cri , String userName ) throws ResourceException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getConnection" , AdapterUtil . toString ( pconn ) ) ; Connection conn = null ; boolean isConnectionSetupComplete = false ; try { conn = pconn . getConnection ( ) ; postGetConnectionHandling ( conn ) ; isConnectionSetupComplete = true ; } catch ( SQLException se ) { FFDCFilter . processException ( se , getClass ( ) . getName ( ) , "260" , this ) ; ResourceException x = AdapterUtil . translateSQLException ( se , this , false , getClass ( ) ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getConnection" , se ) ; throw x ; } finally { if ( ! isConnectionSetupComplete ) { if ( conn != null ) try { conn . close ( ) ; } catch ( Throwable x ) { } if ( pconn != null ) try { pconn . close ( ) ; } catch ( Throwable x ) { } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getConnection" , AdapterUtil . toString ( conn ) ) ; return conn ; }
Gets a java . sql . Connection from a PooledConnection use the cri to extract certain information if needed if trused context is supported ...
37,417
public Set < ManagedConnection > getInvalidConnections ( @ SuppressWarnings ( "rawtypes" ) Set connectionSet ) throws ResourceException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getInvalidConnections" , connectionSet ) ; Set < ManagedConnection > badSet = new HashSet < ManagedConnection > ( ) ; WSRdbManagedConnectionImpl mc = null ; for ( Iterator < ? > it = connectionSet . iterator ( ) ; it . hasNext ( ) ; ) { mc = ( WSRdbManagedConnectionImpl ) it . next ( ) ; if ( ! mc . validate ( ) ) badSet . add ( mc ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getInvalidConnections" , badSet ) ; return badSet ; }
The spec interface is defined with raw types so we have no choice but to declare it that way too
37,418
private Object getTraceable ( Object d ) throws ResourceException { WSJdbcTracer tracer = new WSJdbcTracer ( helper . getTracer ( ) , helper . getPrintWriter ( ) , d , type , null , true ) ; Set < Class < ? > > classes = new HashSet < Class < ? > > ( ) ; for ( Class < ? > cl = d . getClass ( ) ; cl != null ; cl = cl . getSuperclass ( ) ) classes . addAll ( Arrays . asList ( cl . getInterfaces ( ) ) ) ; return Proxy . newProxyInstance ( jdbcDriverLoader , classes . toArray ( new Class [ classes . size ( ) ] ) , tracer ) ; }
Enable supplemental tracing for the underlying data source or java . sql . Driver .
37,419
private void onConnect ( Connection con , String [ ] sqlCommands ) throws SQLException { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; TransactionManager tm = connectorSvc . getTransactionManager ( ) ; Transaction suspendedTx = null ; String currentSQL = null ; Throwable failure = null ; try { UOWCoordinator coord = tm == null ? null : ( ( UOWCurrent ) tm ) . getUOWCoord ( ) ; if ( coord != null && coord . isGlobal ( ) ) suspendedTx = tm . suspend ( ) ; Statement stmt = con . createStatement ( ) ; for ( String sql : sqlCommands ) { currentSQL = sql ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "execute onConnect SQL" , sql ) ; stmt . execute ( sql ) ; } stmt . close ( ) ; } catch ( Throwable x ) { failure = x ; } if ( suspendedTx != null ) { try { tm . resume ( suspendedTx ) ; } catch ( Throwable x ) { failure = x ; } } if ( failure != null ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "failed" , AdapterUtil . stackTraceToString ( failure ) ) ; throw new SQLNonTransientConnectionException ( AdapterUtil . getNLSMessage ( "DSRA4004.onconnect.sql" , currentSQL , dsConfig . get ( ) . id ) , "08000" , 0 , failure ) ; } }
Execute the onConnect SQL commands . The connection won t be enlisted in a WAS transaction yet but it s necessary to suspend and WAS global transaction in order to avoid confusing the DB2 type 2 JDBC driver .
37,420
private void postGetConnectionHandling ( Connection conn ) throws SQLException { helper . doConnectionSetup ( conn ) ; String [ ] sqlCommands = dsConfig . get ( ) . onConnect ; if ( sqlCommands != null && sqlCommands . length > 0 ) onConnect ( conn , sqlCommands ) ; if ( ! wasUsedToGetAConnection ) { helper . gatherAndDisplayMetaDataInfo ( conn , this ) ; wasUsedToGetAConnection = true ; } }
utility used to gather metadata info and issue doConnectionSetup .
37,421
final void reallySetLogWriter ( final PrintWriter out ) throws ResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "setting the logWriter to:" , out ) ; if ( dataSourceOrDriver != null ) { try { AccessController . doPrivileged ( new PrivilegedExceptionAction < Void > ( ) { public Void run ( ) throws SQLException { if ( ! Driver . class . equals ( type ) ) { ( ( CommonDataSource ) dataSourceOrDriver ) . setLogWriter ( out ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Unable to set logwriter on Driver type" ) ; } return null ; } } ) ; } catch ( PrivilegedActionException pae ) { SQLException se = ( SQLException ) pae . getCause ( ) ; FFDCFilter . processException ( se , getClass ( ) . getName ( ) , "593" , this ) ; throw AdapterUtil . translateSQLException ( se , this , false , getClass ( ) ) ; } } logWriter = out ; }
This method is to be used by RRA code to set logwriter when needed
37,422
public final int getLoginTimeout ( ) throws SQLException { try { if ( ! Driver . class . equals ( type ) ) { return ( ( CommonDataSource ) dataSourceOrDriver ) . getLoginTimeout ( ) ; } return 0 ; } catch ( SQLException sqlX ) { FFDCFilter . processException ( sqlX , getClass ( ) . getName ( ) , "1670" , this ) ; throw AdapterUtil . mapSQLException ( sqlX , this ) ; } }
Retrieves the login timeout for the DataSource .
37,423
public String formatRecord ( RepositoryLogRecord record , Locale locale ) { if ( null == record ) { throw new IllegalArgumentException ( "Record cannot be null" ) ; } StringBuilder sb = new StringBuilder ( 300 ) ; String lineSeparatorPlusPadding = "" ; createEventHeader ( record , sb ) ; lineSeparatorPlusPadding = svLineSeparatorPlusBasicPadding ; sb . append ( formatMessage ( record , locale ) ) ; if ( record . getStackTrace ( ) != null ) { sb . append ( lineSeparatorPlusPadding ) ; sb . append ( record . getStackTrace ( ) ) ; } return sb . toString ( ) ; }
Formats a RepositoryLogRecord into a localized basic format output String .
37,424
private void loadTldFromClassloader ( GlobalTagLibConfig globalTagLibConfig , TldParser tldParser ) { for ( Iterator itr = globalTagLibConfig . getTldPathList ( ) . iterator ( ) ; itr . hasNext ( ) ; ) { TldPathConfig tldPathConfig = ( TldPathConfig ) itr . next ( ) ; InputStream is = globalTagLibConfig . getClassloader ( ) . getResourceAsStream ( tldPathConfig . getTldPath ( ) ) ; JspInputSource tldInputSource = new JspInputSourceFromInputStreamImpl ( is ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "loadTldFromClassloader" , "tldInputSource.getRelativeURL(): [" + tldInputSource . getRelativeURL ( ) + "]" ) ; logger . logp ( Level . FINE , CLASS_NAME , "loadTldFromClassloader" , "tldInputSource.getAbsoluteURL(): [" + tldInputSource . getAbsoluteURL ( ) + "]" ) ; logger . logp ( Level . FINE , CLASS_NAME , "loadTldFromClassloader" , "tldInputSource.getContextURL(): [" + tldInputSource . getContextURL ( ) + "]" ) ; logger . logp ( Level . FINE , CLASS_NAME , "loadTldFromClassloader" , "globalTagLibConfig.getJarURL(): [" + globalTagLibConfig . getJarURL ( ) + "]" ) ; logger . logp ( Level . FINE , CLASS_NAME , "loadTldFromClassloader" , "tldPathConfig.getTldPath(): [" + tldPathConfig . getTldPath ( ) + "]" ) ; } try { TagLibraryInfoImpl tli = tldParser . parseTLD ( tldInputSource , is , globalTagLibConfig . getJarURL ( ) . toExternalForm ( ) ) ; if ( tli . getReliableURN ( ) != null ) { if ( containsKey ( tli . getReliableURN ( ) ) == false ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "loadTldFromClassloader" , "Global jar tld loaded for {0}" , tli . getReliableURN ( ) ) ; } tli . setURI ( tli . getReliableURN ( ) ) ; put ( tli . getReliableURN ( ) , tli ) ; tldPathConfig . setUri ( tli . getReliableURN ( ) ) ; eventListenerList . addAll ( tldParser . getEventListenerList ( ) ) ; } } else { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . WARNING ) ) { logger . logp ( Level . WARNING , CLASS_NAME , "loadTldFromClassloader" , "jsp warning failed to find a uri tag in [" + tldInputSource . getAbsoluteURL ( ) + "]" ) ; } } } catch ( JspCoreException e ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . WARNING ) ) { logger . logp ( Level . WARNING , CLASS_NAME , "loadTldFromClassloader" , "jsp warning failed to load tld in jar. uri = [" + tldInputSource . getAbsoluteURL ( ) + "]" , e ) ; } } } }
Added by DJV for Liberty - we don t want to depend on the taglib coming from a jar on our class path if we can avoid it so this version uses the classloader specified by the povided taglib config to find and read the TLDs from that taglib config .
37,425
public void addGlobalTagLibConfig ( GlobalTagLibConfig globalTagLibConfig ) { try { TldParser tldParser = new TldParser ( this , configManager , false , globalTagLibConfig . getClassloader ( ) ) ; if ( globalTagLibConfig . getClassloader ( ) == null ) loadTldFromJarInputStream ( globalTagLibConfig , tldParser ) ; else loadTldFromClassloader ( globalTagLibConfig , tldParser ) ; globalTagLibConfigList . add ( globalTagLibConfig ) ; } catch ( JspCoreException e ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . SEVERE ) ) { logger . logp ( Level . SEVERE , CLASS_NAME , "addGlobalTagLibConfig" , "failed to create TldParser " , e ) ; } } }
add some GlobalTabLibConfig to the global tag libs we know about . If the provided config provides a classloader we will load the TLDs via that class loaders otherwise the JAR URL will be used to find the TLDs .
37,426
public static synchronized ClientConnectionManager getRef ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getRef" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRef" , instance ) ; return instance ; }
Returns a reference to the single instance of this class in existence . The class must have been previously initilised by a call to the initialise method - otherwise invoking this method will generate a runtime exception . This class implements the singleton design pattern .
37,427
public WSStatistic getStatistic ( int dataId ) { ArrayList members = copyStatistics ( ) ; if ( members == null || members . size ( ) <= 0 ) return null ; int sz = members . size ( ) ; for ( int i = 0 ; i < sz ; i ++ ) { StatisticImpl data = ( StatisticImpl ) members . get ( i ) ; if ( data != null && data . getId ( ) == dataId ) { return data ; } } return null ; }
get Statistic by data id
37,428
private synchronized void myupdate ( WSStats newStats , boolean keepOld , boolean recursiveUpdate ) { if ( newStats == null ) return ; StatsImpl newStats1 = ( StatsImpl ) newStats ; this . instrumentationLevel = newStats1 . getLevel ( ) ; updateMembers ( newStats , keepOld ) ; if ( recursiveUpdate ) updateSubcollection ( newStats , keepOld , recursiveUpdate ) ; }
Assume we have verified newStats is the same PMI module as this Stats
37,429
public void insert ( SimpleTest test , Object target ) { if ( size == ranges . length ) { RangeEntry [ ] tmp = new RangeEntry [ 2 * size ] ; System . arraycopy ( ranges , 0 , tmp , 0 , size ) ; ranges = tmp ; } ranges [ size ] = new RangeEntry ( test , target ) ; size ++ ; }
Insert a range and an associated target into the table .
37,430
public Object getExact ( SimpleTest test ) { for ( int i = 0 ; i < size ; i ++ ) { if ( ranges [ i ] . correspondsTo ( test ) ) return ranges [ i ] . target ; } return null ; }
Retrieve the Object associated with an exactly defined range
37,431
public void replace ( SimpleTest test , Object target ) { for ( int i = 0 ; i < size ; i ++ ) if ( ranges [ i ] . correspondsTo ( test ) ) { ranges [ i ] . target = target ; return ; } throw new IllegalStateException ( ) ; }
Replace the Object in a range that is known to exist
37,432
public List find ( Number value ) { List targets = new ArrayList ( 1 ) ; for ( int i = 0 ; i < size ; i ++ ) { if ( ranges [ i ] . contains ( value ) ) targets . add ( ranges [ i ] . target ) ; } return targets ; }
Find targets associated with all ranges including this value .
37,433
@ FFDCIgnore ( XMLStreamException . class ) public boolean parseServerConfiguration ( InputStream in , String docLocation , BaseConfiguration config , MergeBehavior mergeBehavior ) throws ConfigParserException , ConfigValidationException { XMLStreamReader parser = null ; try { parser = getXMLInputFactory ( ) . createXMLStreamReader ( docLocation , in ) ; return parseServerConfiguration ( new DepthAwareXMLStreamReader ( parser ) , docLocation , config , mergeBehavior ) ; } catch ( XMLStreamException e ) { throw new ConfigParserException ( e ) ; } finally { if ( parser != null ) { try { parser . close ( ) ; } catch ( XMLStreamException e ) { throw new ConfigParserException ( e ) ; } } } }
private if not for tests
37,434
public void start ( QueuedFuture < ? > queuedFuture ) { Runnable timeoutTask = ( ) -> { queuedFuture . abort ( new TimeoutException ( ) ) ; } ; start ( timeoutTask ) ; }
start timer and cancel given future
37,435
private void timeout ( ) { lock . writeLock ( ) . lock ( ) ; try { if ( ! this . stopped ) { long now = System . nanoTime ( ) ; long remaining = this . targetEnd - now ; this . timedout = remaining <= FTConstants . MIN_TIMEOUT_NANO ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debugTime ( "!Start {0}" , this . start ) ; debugTime ( "!Target {0}" , this . targetEnd ) ; debugTime ( "!Now {0}" , now ) ; debugTime ( "!Remain {0}" , remaining ) ; } if ( this . timedout ) { debugRelativeTime ( "Timeout!" ) ; this . timeoutTask . run ( ) ; } else { debugTime ( "Premature Timeout!" , remaining ) ; start ( this . timeoutTask , remaining ) ; } } } finally { lock . writeLock ( ) . unlock ( ) ; } }
This method is run when the timer pops
37,436
private void start ( Runnable timeoutTask ) { long timeout = timeoutPolicy . getTimeout ( ) . toNanos ( ) ; start ( timeoutTask , timeout ) ; }
Get the timeout from the policy and start the timer
37,437
private void start ( Runnable timeoutTask , long remainingNanos ) { lock . writeLock ( ) . lock ( ) ; try { this . timeoutTask = timeoutTask ; this . start = System . nanoTime ( ) ; this . targetEnd = start + remainingNanos ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debugTime ( ">Start {0}" , this . start ) ; debugTime ( ">Target {0}" , this . targetEnd ) ; debugTime ( ">Now {0}" , this . start ) ; debugTime ( ">Remain {0}" , remainingNanos ) ; } Runnable task = ( ) -> { timeout ( ) ; } ; if ( remainingNanos > FTConstants . MIN_TIMEOUT_NANO ) { this . future = scheduledExecutorService . schedule ( task , remainingNanos , TimeUnit . NANOSECONDS ) ; } else { task . run ( ) ; } } finally { lock . writeLock ( ) . unlock ( ) ; } }
This is the method which actually starts the timer
37,438
public void stop ( ) { lock . writeLock ( ) . lock ( ) ; try { debugRelativeTime ( "Stop!" ) ; this . stopped = true ; if ( this . future != null && ! this . future . isDone ( ) ) { debugRelativeTime ( "Cancelling" ) ; this . future . cancel ( true ) ; } this . future = null ; } finally { lock . writeLock ( ) . unlock ( ) ; } }
Stop the timeout ... mark it as stopped and cancel the scheduled future task if required
37,439
public void restart ( ) { lock . writeLock ( ) . lock ( ) ; try { if ( this . timeoutTask == null ) { throw new IllegalStateException ( Tr . formatMessage ( tc , "internal.error.CWMFT4999E" ) ) ; } stop ( ) ; this . stopped = false ; start ( this . timeoutTask ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } }
Restart the timer ... stop the timer reset the stopped flag and then start again with the same timeout policy
37,440
public long check ( ) { long remaining = 0 ; lock . readLock ( ) . lock ( ) ; try { if ( this . timedout ) { boolean wasInterrupted = Thread . interrupted ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { if ( wasInterrupted ) { Tr . debug ( tc , "{0}: Throwing timeout exception and clearing interrupted flag" , getDescriptor ( ) ) ; } else { Tr . debug ( tc , "{0}: Throwing timeout exception" , getDescriptor ( ) ) ; } } throw new TimeoutException ( Tr . formatMessage ( tc , "timeout.occurred.CWMFT0000E" ) ) ; } long now = System . nanoTime ( ) ; remaining = this . targetEnd - now ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debugTime ( "?Start " , this . start ) ; debugTime ( "?Target" , this . targetEnd ) ; debugTime ( "?Now " , now ) ; debugTime ( "?Remain" , remaining ) ; } } finally { lock . readLock ( ) . unlock ( ) ; } return remaining ; }
Check if the timedout flag was previously set and throw an exception if it was . Otherwise return the remaining timeout time in nanoseconds .
37,441
private void debugTime ( String message , long nanos ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { FTDebug . debugTime ( tc , getDescriptor ( ) , message , nanos ) ; } }
Output a debug message showing a given relative time converted from nanos to seconds
37,442
public static String createPropertyFilter ( String name , String value ) { assert name . matches ( "[^=><~()]+" ) ; StringBuilder builder = new StringBuilder ( name . length ( ) + 3 + ( value == null ? 0 : value . length ( ) * 2 ) ) ; builder . append ( '(' ) . append ( name ) . append ( '=' ) ; int begin = 0 ; if ( value != null ) { for ( int i = 0 ; i < value . length ( ) ; i ++ ) { if ( "\\*()" . indexOf ( value . charAt ( i ) ) != - 1 ) { builder . append ( value , begin , i ) . append ( '\\' ) ; begin = i ; } } return builder . append ( value , begin , value . length ( ) ) . append ( ')' ) . toString ( ) ; } else { return builder . append ( ')' ) . toString ( ) ; } }
Creates a filter string that matches an attribute value exactly . Characters in the value with special meaning will be escaped .
37,443
public static void delete ( final File f ) { if ( f != null && f . exists ( ) ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { if ( ! f . delete ( ) ) { logger . log ( Level . INFO , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "LOG_CANNOT_DELETE_FILE" , f . getAbsolutePath ( ) ) ) ; f . deleteOnExit ( ) ; } return null ; } } ) ; } }
Java 2 security APIs for deleteOnExit
37,444
public static FileInputStream getFileIputStream ( final File file ) throws FileNotFoundException { try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < FileInputStream > ( ) { public FileInputStream run ( ) throws FileNotFoundException { return new FileInputStream ( file ) ; } } ) ; } catch ( PrivilegedActionException e ) { throw ( FileNotFoundException ) e . getCause ( ) ; } }
Java 2 security APIs for FileInputStream
37,445
public static long getFileLength ( final File file ) throws FileNotFoundException { try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < Long > ( ) { public Long run ( ) throws FileNotFoundException { return file . length ( ) ; } } ) ; } catch ( PrivilegedActionException e ) { throw ( FileNotFoundException ) e . getCause ( ) ; } }
Java 2 security APIs for file length
37,446
JavaURLContext createJavaURLContext ( Hashtable < ? , ? > envmt , Name name ) { return new JavaURLContext ( envmt , helperServices , name ) ; }
This method should only be called by the JavaURLContextReplacer class for de - serializing an instance of JavaURLContext . The name parameter can be null .
37,447
public String encodeURL ( HttpSession session , String url ) { return encodeURL ( session , null , url , null ) ; }
called from ConvergedHttpSession . encodeURL path
37,448
public void complete ( VirtualConnection vc , TCPReadRequestContext rsc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "complete() called: vc=" + vc ) ; } HttpOutboundServiceContextImpl mySC = ( HttpOutboundServiceContextImpl ) vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPOSC ) ; mySC . continueRead ( ) ; }
Called by the channel below us when a read has finished .
37,449
public void error ( VirtualConnection vc , TCPReadRequestContext rsc , IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "error() called: vc=" + vc + " ioe=" + ioe ) ; } HttpOutboundServiceContextImpl mySC = ( HttpOutboundServiceContextImpl ) vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPOSC ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Socket closure, signaling close." ) ; } if ( ! mySC . isChunkedEncoding ( ) && ! mySC . isContentLength ( ) ) { mySC . prepareClosure ( ) ; mySC . getAppReadCallback ( ) . complete ( vc ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "IOException during body read" ) ; } mySC . setPersistent ( false ) ; mySC . getAppReadCallback ( ) . error ( vc , ioe ) ; } }
Called by the channel below us when an error occurs during a read .
37,450
public static void logLoudAndClear ( String textToLog , String callingClass , String callingMethod ) { final String methodName = "logLoudAndClear" ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; final String cClass = ( callingClass != null && ! callingClass . isEmpty ( ) ) ? callingClass : "callingClass" ; final String cMethod = ( callingMethod != null && ! callingMethod . isEmpty ( ) ) ? callingMethod : "callingMethod" ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n " + "\n " + cClass + ": " + cMethod + " is using " + className + ": " + methodName + " \n " + textToLog + "\n " + "\n " + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" + "\n #################################################################################################" + "#################################################################################################" ) ; }
logLoudAndClear Log the provided text in a very distinct way making it easy to find it in the trace . log This method should be used for testing and debugging proposes only . This method should not be used in shipped code .
37,451
private MessagingEngine createMessageEngine ( JsMEConfig me ) throws Exception { String thisMethodName = CLASS_NAME + ".createMessageEngine(JsMEConfig)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , "replace ME name here" ) ; } JsMessagingEngine engineImpl = null ; bus = new JsBusImpl ( me , this , ( me . getSIBus ( ) . getName ( ) ) ) ; engineImpl = new JsMessagingEngineImpl ( this , bus , me ) ; MessagingEngine engine = new MessagingEngine ( me , engineImpl ) ; _messagingEngines . put ( defaultMEUUID , engine ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , engine . toString ( ) ) ; } return engine ; }
Create a single Message Engine admin object using suppled config object .
37,452
private JsBusImpl getBusProxy ( JsMEConfig me ) { String thisMethodName = CLASS_NAME + ".getBusProxy(ConfigObject)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , "ME Name" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } return this . bus ; }
Returns the runtime configuration of the bus to which the supplied messaging engine belongs . If the bus runtime configuration does not yet exist it is created . In liberty this is default bus configuration
37,453
private JsBusImpl getBusProxy ( String name ) throws SIBExceptionBusNotFound { String thisMethodName = CLASS_NAME + ".getBusProxy(String)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , name ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } return this . bus ; }
Returns the runtime configuration of the bus to which the named messaging engine belongs . If the bus runtime configuration does not yet exist it is created .
37,454
public JsBus getBus ( String busName ) throws SIBExceptionBusNotFound { String thisMethodName = CLASS_NAME + ".getBus(String)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , busName ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } return this . bus ; }
Returns the runtime configuration of the named bus . For liberty is always default bus
37,455
public Set getMessagingEngineSet ( String busName ) { String thisMethodName = CLASS_NAME + ".getMessagingEngineSet(String)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , busName ) ; } Set retSet = new HashSet ( ) ; if ( meConfig != null ) { String meName = meConfig . getMessagingEngine ( ) . getName ( ) ; BaseMessagingEngineImpl engineImpl = getMessagingEngine ( meName ) ; retSet . add ( engineImpl . getUuid ( ) . toString ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Integer i = new Integer ( retSet . size ( ) ) ; SibTr . exit ( tc , thisMethodName , i . toString ( ) ) ; } return retSet ; }
Returns the set of messaging engines on the named bus .
37,456
public String [ ] showMessagingEngines ( ) { String thisMethodName = CLASS_NAME + ".showMessagingEngines()" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; } final String [ ] list = new String [ _messagingEngines . size ( ) ] ; Enumeration e = listMessagingEngines ( ) ; int i = 0 ; while ( e . hasMoreElements ( ) ) { Object c = e . nextElement ( ) ; list [ i ++ ] = ( ( BaseMessagingEngineImpl ) c ) . getBusName ( ) + ":" + ( ( BaseMessagingEngineImpl ) c ) . getName ( ) + ":" + ( ( BaseMessagingEngineImpl ) c ) . getState ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } return list ; }
Return a readable string of messaging engines in the process
37,457
public void startMessagingEngine ( String busName , String name ) throws Exception { String thisMethodName = CLASS_NAME + ".startMessagingEngine(String, String)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , new Object [ ] { busName , name } ) ; } BaseMessagingEngineImpl me = ( BaseMessagingEngineImpl ) getMessagingEngine ( busName , name ) ; if ( me != null ) { me . startConditional ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unable to locate engine <bus=" + busName + " name=" + name + ">" ) ; throw new Exception ( "The messaging engine <bus=" + busName + " name=" + name + "> does not exist" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } }
Start a messaging engine
37,458
public boolean isServerStarted ( ) { String thisMethodName = CLASS_NAME + ".isServerStarted()" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , new Boolean ( _serverStarted ) ) ; } return _serverStarted ; }
Has the WAS server in which we are contained now started?
37,459
public boolean isServerStopping ( ) { String thisMethodName = CLASS_NAME + ".isServerStopping()" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , new Boolean ( _serverStopping ) ) ; } return _serverStopping ; }
Is the WAS server in which we are contained stopping?
37,460
public boolean isServerInRecoveryMode ( ) { String thisMethodName = CLASS_NAME + ".isServerInRecoveryMode()" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; } boolean ret = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , new Boolean ( ret ) ) ; } return ret ; }
250606 . 3 recovery mode support
37,461
public List < String > listDefinedBuses ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "listDefinedBuses" , this ) ; } List buses = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "listDefinedBuses" , buses ) ; } return buses ; }
Returns a list of configured buses in this cell . For liberty this method will return the null value because no directory structure is maintained in liberty for a bus .
37,462
public static final String base64Decode ( String str , String enc ) throws UnsupportedEncodingException { if ( str == null ) { return null ; } else { byte data [ ] = getBytes ( str ) ; return base64Decode ( new String ( data , enc ) ) ; } }
Converts a String with the given encoding to a base64 encoded String .
37,463
public static final String base64Decode ( String str ) { if ( str == null ) { return null ; } else { byte data [ ] = getBytes ( str ) ; return toString ( base64Decode ( data ) ) ; } }
Converts a base64 encoded String to a decoded String .
37,464
public SIBusMessage receiveNoWait ( final SITransaction tran ) throws SISessionDroppedException , SIConnectionDroppedException , SISessionUnavailableException , SIConnectionUnavailableException , SIConnectionLostException , SILimitExceededException , SINotAuthorizedException , SIResourceException , SIErrorException , SIIncorrectCallException { final String methodName = "receiveNoWait" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , tran ) ; } checkValid ( ) ; final SIBusMessage message = _delegate . receiveNoWait ( _parentConnection . mapTransaction ( tran ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , message ) ; } return message ; }
Receives a message . Checks that the session is valid . Maps the transaction parameter before delegating .
37,465
public void start ( boolean deliverImmediately ) throws SIConnectionDroppedException , SISessionUnavailableException , SIConnectionUnavailableException , SIConnectionLostException , SIResourceException , SIErrorException , SIErrorException { final String methodName = "start" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , Boolean . valueOf ( deliverImmediately ) ) ; } checkValid ( ) ; _delegate . start ( deliverImmediately ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Starts message delivery . Checks that the session is valid then delegates .
37,466
public void stop ( ) throws SISessionDroppedException , SIConnectionDroppedException , SISessionUnavailableException , SIConnectionUnavailableException , SIConnectionLostException , SIResourceException , SIErrorException { final String methodName = "stop" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } checkValid ( ) ; _delegate . stop ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Stops message delivery . Checks that the session is valid then delegates .
37,467
public void unlockAll ( boolean incrementUnlockCount ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SIIncorrectCallException { throw new SibRaNotSupportedException ( NLS . getString ( "ASYNCHRONOUS_METHOD_CWSIV0250" ) ) ; }
Unlocking of messages is not supported .
37,468
public void setConnectionObjectID ( int i ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setConnectionObjectID" , "" + i ) ; connectionObjectID = i ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setConnectionObjectID" ) ; }
Sets the Connection ID referring to the SIMPConnection Object on the server .
37,469
public ProxyQueueConversationGroup getProxyQueueConversationGroup ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getProxyQueueConversationGroup" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getProxyQueueConversationGroup" , proxyGroup ) ; return proxyGroup ; }
Gets the proxy queue group associated with this conversation .
37,470
public CatConnectionListenerGroup getCatConnectionListeners ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getCatConnectionListeners" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getCatConnectionListeners" , catConnectionGroup ) ; return catConnectionGroup ; }
Gets the connection listener group associated with thisconversation
37,471
public SICoreConnection getSICoreConnection ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getSICoreConnection" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getSICoreConnection" , siCoreConnection ) ; return siCoreConnection ; }
Returns the SICoreConnection in use with this conversation
37,472
public final boolean unlink ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "unlink" , _positionString ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "cursor count = " + _cursorCount ) ; boolean unlinked = false ; LinkedList parent = _parent ; if ( null != parent ) { synchronized ( parent ) { if ( LinkState . LINKED == _state ) { _state = LinkState . LOGICALLY_UNLINKED ; _tryUnlink ( ) ; unlinked = true ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "unlink while " + _state ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "unlink" , new Object [ ] { Boolean . valueOf ( unlinked ) , _positionString ( ) } ) ; return unlinked ; }
Request that the receiver be unlinked from the list . If the receiver is linked it will be marked as logically unlinked . Note that this will perform a logical unlink which may result in a physical unlink
37,473
private boolean isRequestForbidden ( StringBuffer path ) { boolean requestIsForbidden = false ; String matchString = path . toString ( ) ; if ( WCCustomProperties . ALLOW_DOTS_IN_NAME ) { if ( matchString . indexOf ( ".." ) > - 1 ) { if ( ( matchString . indexOf ( "/../" ) > - 1 ) || ( matchString . indexOf ( "\\..\\" ) > - 1 ) || matchString . startsWith ( "../" ) || matchString . endsWith ( "/.." ) || matchString . startsWith ( "..\\" ) || matchString . endsWith ( "\\.." ) ) { requestIsForbidden = true ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "isRequestForbidden" , "bad path :" + matchString ) ; } } if ( ( ! requestIsForbidden && ( matchString . endsWith ( "\\" ) || matchString . endsWith ( "." ) || matchString . endsWith ( "/" ) ) ) ) { requestIsForbidden = true ; } } else { if ( ( matchString . lastIndexOf ( ".." ) != - 1 && ( ! matchString . startsWith ( "/..." ) ) ) || matchString . endsWith ( "\\" ) || matchString . endsWith ( "." ) || matchString . endsWith ( "/" ) ) { requestIsForbidden = true ; } } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "isRequestForbidden" , "returning :" + requestIsForbidden + ", matchstring :" + matchString ) ; return requestIsForbidden ; }
returns true if request is forbidden because it contains .. etc .
37,474
private boolean isDirectoryTraverse ( StringBuffer path ) { boolean directoryTraverse = false ; String matchString = path . toString ( ) ; if ( WCCustomProperties . ALLOW_DOTS_IN_NAME ) { if ( matchString . indexOf ( ".." ) > - 1 ) { if ( ( matchString . indexOf ( "/../" ) > - 1 ) || ( matchString . indexOf ( "\\..\\" ) > - 1 ) || matchString . startsWith ( "../" ) || matchString . endsWith ( "/.." ) || matchString . startsWith ( "..\\" ) || matchString . endsWith ( "\\.." ) ) { directoryTraverse = true ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "isDirectoryTraverse" , "bad path :" + matchString ) ; } } } else { if ( ( matchString . lastIndexOf ( ".." ) != - 1 ) && ( ! matchString . startsWith ( "/..." ) ) ) { directoryTraverse = true ; } } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "isDirectoryTraverse" , "returning" + directoryTraverse + " , matchstring :" + matchString ) ; return directoryTraverse ; }
542155 Add isDirectoryTraverse method - reduced version of isRequestForbidden
37,475
public ServiceRegistration < FileMonitor > monitorFiles ( Collection < String > paths , long monitorInterval ) { BundleContext bundleContext = actionable . getBundleContext ( ) ; final Hashtable < String , Object > fileMonitorProps = new Hashtable < String , Object > ( ) ; fileMonitorProps . put ( FileMonitor . MONITOR_FILES , paths ) ; fileMonitorProps . put ( FileMonitor . MONITOR_INTERVAL , monitorInterval ) ; return bundleContext . registerService ( FileMonitor . class , this , fileMonitorProps ) ; }
Registers this file monitor to start monitoring the specified files at the specified interval .
37,476
public ServiceRegistration < FileMonitor > monitorFiles ( String ID , Collection < String > paths , long pollingRate , String trigger ) { BundleContext bundleContext = actionable . getBundleContext ( ) ; final Hashtable < String , Object > fileMonitorProps = new Hashtable < String , Object > ( ) ; fileMonitorProps . put ( FileMonitor . MONITOR_FILES , paths ) ; fileMonitorProps . put ( com . ibm . ws . kernel . filemonitor . FileMonitor . MONITOR_IDENTIFICATION_NAME , com . ibm . ws . kernel . filemonitor . FileMonitor . SECURITY_MONITOR_IDENTIFICATION_VALUE ) ; fileMonitorProps . put ( com . ibm . ws . kernel . filemonitor . FileMonitor . MONITOR_KEYSTORE_CONFIG_ID , ID ) ; if ( ! ( trigger . equalsIgnoreCase ( "disabled" ) ) ) { if ( trigger . equals ( "mbean" ) ) { fileMonitorProps . put ( FileMonitor . MONITOR_TYPE , FileMonitor . MONITOR_TYPE_EXTERNAL ) ; } else { fileMonitorProps . put ( FileMonitor . MONITOR_TYPE , FileMonitor . MONITOR_TYPE_TIMED ) ; fileMonitorProps . put ( FileMonitor . MONITOR_INTERVAL , pollingRate ) ; } } if ( FrameworkState . isStopping ( ) ) return null ; return bundleContext . registerService ( FileMonitor . class , this , fileMonitorProps ) ; }
Registers this file monitor to start monitoring the specified files either by mbean notification or polling rate .
37,477
private Boolean isActionNeeded ( Collection < File > createdFiles , Collection < File > modifiedFiles ) { boolean actionNeeded = false ; for ( File createdFile : createdFiles ) { if ( currentlyDeletedFiles . contains ( createdFile ) ) { currentlyDeletedFiles . remove ( createdFile ) ; actionNeeded = true ; } } if ( modifiedFiles . isEmpty ( ) == false ) { actionNeeded = true ; } return actionNeeded ; }
Action is needed if a file is modified or if it is recreated after it was deleted .
37,478
public QueuedMessage [ ] getQueuedMessages ( java . lang . Integer fromIndexInteger , java . lang . Integer toIndexInteger , java . lang . Integer totalMessagesPerpageInteger ) throws Exception { int fromIndex = fromIndexInteger . intValue ( ) ; int toIndex = toIndexInteger . intValue ( ) ; int totalMessagesPerpage = totalMessagesPerpageInteger . intValue ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getQueuedMessages fromIndex=" + fromIndex + " toIndex= " + toIndex + " totalMsgs= " + totalMessagesPerpage ) ; List list = new ArrayList ( ) ; Iterator iter = _c . getQueuedMessageIterator ( fromIndex , toIndex , totalMessagesPerpage ) ; while ( iter != null && iter . hasNext ( ) ) { SIMPQueuedMessageControllable o = ( SIMPQueuedMessageControllable ) iter . next ( ) ; list . add ( o ) ; } List resultList = new ArrayList ( ) ; iter = list . iterator ( ) ; int i = 0 ; while ( iter . hasNext ( ) ) { Object o = iter . next ( ) ; QueuedMessage qm = SIBMBeanResultFactory . createSIBQueuedMessage ( ( SIMPQueuedMessageControllable ) o ) ; resultList . add ( qm ) ; } QueuedMessage [ ] retValue = ( QueuedMessage [ ] ) resultList . toArray ( new QueuedMessage [ 0 ] ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getQueuedMessagesfromIndex=" + fromIndex + " toIndex= " + toIndex + " totalMsgs= " + totalMessagesPerpage , retValue ) ; return retValue ; }
673411 - start
37,479
private void initializeCacheData ( int cacheSize ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && ( tc . isEntryEnabled ( ) || tcOOM . isEntryEnabled ( ) ) ) Tr . entry ( tc . isEntryEnabled ( ) ? tc : tcOOM , "initializeCacheData : " + ivCache . getName ( ) + " preferred size = " + ivPreferredMaxSize ) ; ivPreferredMaxSize = cacheSize ; ivUpperLimit = ( long ) ( ivPreferredMaxSize * 1.1 ) ; ivSoftLimitBuffer = ivPreferredMaxSize / 100 ; if ( ivSoftLimitBuffer > 50 ) ivSoftLimitBuffer = 50 ; if ( isTraceOn && ( tc . isEntryEnabled ( ) || tcOOM . isEntryEnabled ( ) ) ) Tr . exit ( tc . isEntryEnabled ( ) ? tc : tcOOM , "initializeCacheData : " + ivCache . getName ( ) + " preferred size = " + ivPreferredMaxSize + " limit = " + ivUpperLimit + ", buffer = " + ivSoftLimitBuffer ) ; }
Initialize various optimization values used by the eviction strategy that depend on the cache size .
37,480
private void initializeSweepInterval ( long sweepInterval ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && ( tc . isEntryEnabled ( ) || tcOOM . isEntryEnabled ( ) ) ) Tr . entry ( tc . isEntryEnabled ( ) ? tc : tcOOM , "initializeSweepInterval : " + ivCache . getName ( ) + " preferred size = " + ivPreferredMaxSize + ", sweep = " + sweepInterval ) ; ivSweepInterval = sweepInterval ; if ( ( ivSweepInterval * ivDiscardThreshold ) > MAX_THRESHOLD_MULTIPLIER ) { ivDiscardThreshold = ( MAX_THRESHOLD_MULTIPLIER / ivSweepInterval ) ; if ( ivDiscardThreshold < 2 ) ivDiscardThreshold = 2 ; } ivMaxDiscardThreshold = ivDiscardThreshold ; ivMinDiscardThreshold = ( MIN_THRESHOLD_MULTIPLIER / ivSweepInterval ) ; if ( ivMinDiscardThreshold < 2 ) ivMinDiscardThreshold = 2 ; if ( isTraceOn && ( tc . isEntryEnabled ( ) || tcOOM . isEntryEnabled ( ) ) ) Tr . exit ( tc . isEntryEnabled ( ) ? tc : tcOOM , "initializeSweepInterval : " + ivCache . getName ( ) + " preferred size = " + ivPreferredMaxSize + ", sweep = " + ivSweepInterval + ", threshold = " + ivDiscardThreshold + ", buffer = " + ivSoftLimitBuffer ) ; }
Initialize all of the intervals that are derived from the configurable sweep interval . Can be called at any time during runtime .
37,481
private boolean isTraceEnabled ( boolean debug ) { if ( debug ? tc . isDebugEnabled ( ) : tc . isEntryEnabled ( ) ) { return true ; } if ( ivCache . numSweeps % NUM_SWEEPS_PER_OOMTRACE == 1 && ( debug ? tcOOM . isDebugEnabled ( ) : tcOOM . isEntryEnabled ( ) ) ) { return true ; } return false ; }
Returns true if trace should be printed .
37,482
protected NetworkConnection getNetworkConnectionInstance ( VirtualConnection vc ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getNetworkConnectionInstance" , vc ) ; NetworkConnection retConn = null ; if ( vc != null ) { retConn = conn ; if ( vc != ( ( CFWNetworkConnection ) conn ) . getVirtualConnection ( ) ) { retConn = new CFWNetworkConnection ( vc ) ; } } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getNetworkConnectionInstance" , retConn ) ; return retConn ; }
This method tries to avoid creating a new instance of a CFWNetworkConnection object by seeing if the specified virtual connection is the one that we are wrapping in the CFWNetworkConnection instance that created this context . If it is we simply return that . Otherwise we must create a new instance .
37,483
private void setChoices ( BigInteger multiChoice , JSchema schema ) { JSType topType = ( JSType ) schema . getJMFType ( ) ; if ( topType instanceof JSVariant ) setChoices ( multiChoice , schema , ( JSVariant ) topType ) ; else if ( topType instanceof JSTuple ) setChoices ( multiChoice , topType . getMultiChoiceCount ( ) , schema , ( ( JSTuple ) topType ) . getDominatedVariants ( ) ) ; else return ; }
multichoice code .
37,484
private void setChoices ( BigInteger multiChoice , JSchema schema , JSVariant var ) { for ( int i = 0 ; i < var . getCaseCount ( ) ; i ++ ) { BigInteger count = ( ( JSType ) var . getCase ( i ) ) . getMultiChoiceCount ( ) ; if ( multiChoice . compareTo ( count ) >= 0 ) multiChoice = multiChoice . subtract ( count ) ; else { choiceCodes [ var . getIndex ( ) ] = i ; JSVariant [ ] subVars = var . getDominatedVariants ( i ) ; setChoices ( multiChoice , count , schema , subVars ) ; return ; } } throw new RuntimeException ( "Bad multiChoice code" ) ; }
Set the choices implied by the multiChoice code or contribution to a single JSVariant
37,485
private void setChoices ( BigInteger multiChoice , BigInteger radix , JSchema schema , JSVariant [ ] vars ) { for ( int j = 0 ; j < vars . length ; j ++ ) { radix = radix . divide ( vars [ j ] . getMultiChoiceCount ( ) ) ; BigInteger contrib = multiChoice . divide ( radix ) ; multiChoice = multiChoice . remainder ( radix ) ; setChoices ( contrib , schema , vars [ j ] ) ; } }
JSVariant whose choices are being set .
37,486
private static BigInteger getMultiChoice ( int [ ] choices , JSchema schema , JSVariant var ) throws JMFUninitializedAccessException { int choice = choices [ var . getIndex ( ) ] ; if ( choice == - 1 ) throw new JMFUninitializedAccessException ( schema . getPathName ( var ) ) ; BigInteger ans = BigInteger . ZERO ; for ( int i = 0 ; i < choice ; i ++ ) ans = ans . add ( ( ( JSType ) var . getCase ( i ) ) . getMultiChoiceCount ( ) ) ; JSVariant [ ] subVars = var . getDominatedVariants ( choice ) ; if ( subVars == null ) return ans ; return ans . add ( getMultiChoice ( choices , schema , subVars ) ) ; }
Compute the multiChoice code or contribution for an individual variant
37,487
private static BigInteger getMultiChoice ( int [ ] choices , JSchema schema , JSVariant [ ] vars ) throws JMFUninitializedAccessException { BigInteger base = BigInteger . ZERO ; for ( int i = 0 ; i < vars . length ; i ++ ) base = base . multiply ( vars [ i ] . getMultiChoiceCount ( ) ) . add ( getMultiChoice ( choices , schema , vars [ i ] ) ) ; return base ; }
being calculate .
37,488
protected String getStyle ( FacesContext facesContext , UIComponent link ) { if ( link instanceof HtmlCommandLink ) { return ( ( HtmlCommandLink ) link ) . getStyle ( ) ; } return ( String ) link . getAttributes ( ) . get ( HTML . STYLE_ATTR ) ; }
Can be overwritten by derived classes to overrule the style to be used .
37,489
protected String getStyleClass ( FacesContext facesContext , UIComponent link ) { if ( link instanceof HtmlCommandLink ) { return ( ( HtmlCommandLink ) link ) . getStyleClass ( ) ; } return ( String ) link . getAttributes ( ) . get ( HTML . STYLE_CLASS_ATTR ) ; }
Can be overwritten by derived classes to overrule the style class to be used .
37,490
protected void completeConnectionPreface ( ) throws Http2Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "completeConnectionPreface entry: about to send preface SETTINGS frame" ) ; } FrameSettings settings ; if ( Constants . SPEC_INITIAL_WINDOW_SIZE != this . streamReadWindowSize ) { settings = new FrameSettings ( 0 , - 1 , - 1 , this . muxLink . config . getH2MaxConcurrentStreams ( ) , ( int ) this . streamReadWindowSize , this . muxLink . config . getH2MaxFrameSize ( ) , - 1 , false ) ; } else { settings = new FrameSettings ( 0 , - 1 , - 1 , this . muxLink . config . getH2MaxConcurrentStreams ( ) , - 1 , this . muxLink . config . getH2MaxFrameSize ( ) , - 1 , false ) ; } this . frameType = FrameTypes . SETTINGS ; this . processNextFrame ( settings , Direction . WRITING_OUT ) ; if ( Constants . SPEC_INITIAL_WINDOW_SIZE != muxLink . maxReadWindowSize ) { FrameWindowUpdate wup = new FrameWindowUpdate ( 0 , ( int ) muxLink . maxReadWindowSize , false ) ; this . processNextFrame ( wup , Direction . WRITING_OUT ) ; } }
Complete the connection preface . At this point we should have received the client connection preface string . Now we need to make sure that the client sent a settings frame along with the preface update our settings and send an empty settings frame in response to the client preface .
37,491
private void readWriteTransitionState ( Constants . Direction direction ) throws Http2Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "readWriteTransitionState: entry: frame type: " + currentFrame . getFrameType ( ) + " state: " + state ) ; } if ( currentFrame . getFrameType ( ) == FrameTypes . GOAWAY || currentFrame . getFrameType ( ) == FrameTypes . RST_STREAM ) { writeFrameSync ( ) ; rstStreamSent = true ; this . updateStreamState ( StreamState . CLOSED ) ; if ( currentFrame . getFrameType ( ) == FrameTypes . GOAWAY ) { muxLink . closeConnectionLink ( null ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "readWriteTransitionState: return: state: " + state ) ; } return ; } switch ( state ) { case IDLE : processIdle ( direction ) ; break ; case RESERVED_LOCAL : processReservedLocal ( direction ) ; break ; case RESERVED_REMOTE : processReservedRemote ( direction ) ; break ; case OPEN : processOpen ( direction ) ; break ; case HALF_CLOSED_REMOTE : processHalfClosedRemote ( direction ) ; break ; case HALF_CLOSED_LOCAL : processHalfClosedLocal ( direction ) ; break ; case CLOSED : processClosed ( direction ) ; break ; default : break ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "readWriteTransitionState: exit: state: " + state ) ; } }
Transitions the stream state give the previous state and current frame . Handles writes and error processing as needed .
37,492
private void updateStreamState ( StreamState state ) { this . state = state ; if ( StreamState . CLOSED . equals ( state ) ) { setCloseTime ( System . currentTimeMillis ( ) ) ; muxLink . closeStream ( this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "current stream state for stream " + this . myID + " : " + this . state ) ; } }
Update the stream state and provide logging if enabled
37,493
private void processSETTINGSFrame ( ) throws FlowControlException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "processSETTINGSFrame entry:\n" + currentFrame . toString ( ) ) ; } if ( ! connection_preface_settings_rcvd && ! ( ( FrameSettings ) currentFrame ) . flagAckSet ( ) ) { connection_preface_settings_rcvd = true ; } if ( ( ( FrameSettings ) currentFrame ) . flagAckSet ( ) ) { if ( ! connection_preface_settings_ack_rcvd ) { connection_preface_settings_ack_rcvd = true ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "received a new settings frame: updating connection settings and sending out SETTINGS ACK" ) ; } if ( ( ( FrameSettings ) currentFrame ) . getInitialWindowSize ( ) != - 1 ) { int newSize = ( ( FrameSettings ) currentFrame ) . getInitialWindowSize ( ) ; muxLink . changeInitialWindowSizeAllStreams ( newSize ) ; } muxLink . getRemoteConnectionSettings ( ) . updateSettings ( ( FrameSettings ) currentFrame ) ; muxLink . getVirtualConnection ( ) . getStateMap ( ) . put ( "h2_frame_size" , muxLink . getRemoteConnectionSettings ( ) . getMaxFrameSize ( ) ) ; currentFrame = new FrameSettings ( 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , false ) ; currentFrame . setAckFlag ( ) ; try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "processSETTINGSFrame: stream: " + myID + " frame type: " + currentFrame . getFrameType ( ) . toString ( ) + " direction: " + Direction . WRITING_OUT + " H2InboundLink hc: " + muxLink . hashCode ( ) ) ; } writeFrameSync ( ) ; } catch ( FlowControlException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "writeSync caught (logically unexpected) FlowControlException: " + e ) ; } } } if ( connection_preface_settings_rcvd && connection_preface_settings_ack_rcvd ) { if ( muxLink . checkInitAndOpen ( ) ) { muxLink . initLock . countDown ( ) ; } } }
Helper method to process a SETTINGS frame received from the client . Since the protocol utilizes SETTINGS frames for initialization some special logic is needed .
37,494
private void updateStreamReadWindow ( ) throws Http2Exception { if ( currentFrame instanceof FrameData ) { long frameSize = currentFrame . getPayloadLength ( ) ; streamReadWindowSize -= frameSize ; muxLink . connectionReadWindowSize -= frameSize ; if ( streamReadWindowSize < ( muxLink . maxReadWindowSize / 2 ) || muxLink . connectionReadWindowSize < ( muxLink . maxReadWindowSize / 2 ) ) { int windowChange = ( int ) ( muxLink . maxReadWindowSize - this . streamReadWindowSize ) ; Frame savedFrame = currentFrame ; if ( ! this . isStreamClosed ( ) ) { currentFrame = new FrameWindowUpdate ( myID , windowChange , false ) ; writeFrameSync ( ) ; currentFrame = savedFrame ; } long windowSizeIncrement = muxLink . getRemoteConnectionSettings ( ) . getMaxFrameSize ( ) ; FrameWindowUpdate wuf = new FrameWindowUpdate ( 0 , ( int ) windowSizeIncrement , false ) ; this . muxLink . getStream ( 0 ) . processNextFrame ( wuf , Direction . WRITING_OUT ) ; } } }
If this stream is receiving a DATA frame the local read window needs to be updated . If the read window drops below a threshold a WINDOW_UPDATE frame will be sent for both the connection and stream to update the windows .
37,495
protected void updateInitialWindowsUpdateSize ( int newSize ) throws FlowControlException { if ( myID == 0 ) { return ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "updateInitialWindowsUpdateSize entry: stream {0} newSize: {1}" , myID , newSize ) ; } long diff = newSize - streamWindowUpdateWriteInitialSize ; streamWindowUpdateWriteInitialSize = newSize ; streamWindowUpdateWriteLimit += diff ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "streamWindowUpdateWriteInitialSize updated to: " + streamWindowUpdateWriteInitialSize ) ; Tr . debug ( tc , "streamWindowUpdateWriteLimit updated to: " + streamWindowUpdateWriteLimit ) ; } flushDataWaitingForWindowUpdate ( ) ; }
Updates the initial window size for this stream . If any data frames are waiting for an increased window size write them out if the new window size allows it .
37,496
private void processIdle ( Constants . Direction direction ) throws Http2Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "processIdle entry: stream " + myID ) ; } if ( direction == Constants . Direction . READ_IN ) { if ( frameType == FrameTypes . HEADERS ) { muxLink . incrementActiveClientStreams ( ) ; if ( muxLink . getActiveClientStreams ( ) > muxLink . getLocalConnectionSettings ( ) . getMaxConcurrentStreams ( ) ) { RefusedStreamException rse = new RefusedStreamException ( "too many client-initiated streams are currently active; rejecting this stream" ) ; rse . setConnectionError ( false ) ; throw rse ; } processHeadersPriority ( ) ; getHeadersFromFrame ( ) ; if ( currentFrame . flagEndHeadersSet ( ) ) { processCompleteHeaders ( false ) ; setHeadersComplete ( ) ; } else { muxLink . setContinuationExpected ( true ) ; } if ( currentFrame . flagEndStreamSet ( ) ) { endStream = true ; updateStreamState ( StreamState . HALF_CLOSED_REMOTE ) ; if ( currentFrame . flagEndHeadersSet ( ) ) { setReadyForRead ( ) ; } } else { updateStreamState ( StreamState . OPEN ) ; } } } else { if ( frameType == FrameTypes . HEADERS ) { updateStreamState ( StreamState . OPEN ) ; } writeFrameSync ( ) ; } }
Perform operations to transition into IDLE state
37,497
private boolean isWindowLimitExceeded ( FrameData dataFrame ) { if ( streamWindowUpdateWriteLimit - dataFrame . getPayloadLength ( ) < 0 || muxLink . getWorkQ ( ) . getConnectionWriteLimit ( ) - dataFrame . getPayloadLength ( ) < 0 ) { String s = "Cannot write Data Frame because it would exceed the stream window update limit." + "streamWindowUpdateWriteLimit: " + streamWindowUpdateWriteLimit + "\nstreamWindowUpdateWriteInitialSize: " + streamWindowUpdateWriteInitialSize + "\nconnection window size: " + muxLink . getWorkQ ( ) . getConnectionWriteLimit ( ) + "\nframe size: " + dataFrame . getPayloadLength ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , s ) ; } return true ; } return false ; }
Check to see if a writing out a frame will cause the stream or connection window to go exceeded
37,498
public void sendRequestToWc ( FramePPHeaders frame ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "H2StreamProcessor.sendRequestToWc()" ) ; } if ( null == frame ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "H2StreamProcessor.sendRequestToWc(): Frame is null" ) ; } } else { WsByteBuffer buf = frame . buildFrameForWrite ( ) ; TCPReadRequestContext readi = h2HttpInboundLinkWrap . getConnectionContext ( ) . getReadInterface ( ) ; readi . setBuffer ( buf ) ; try { processNextFrame ( frame , Constants . Direction . READ_IN ) ; } catch ( Http2Exception he ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "H2StreamProcessor.sendRequestToWc(): ProcessNextFrame() error, Exception: " + he ) ; } buf . release ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "H2StreamProcessor.sendRequestToWc()" ) ; } }
Send an artificially created H2 request from a push_promise up to the WebContainer
37,499
private void setHeadersComplete ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "completed headers have been received stream " + myID ) ; } headersCompleted = true ; muxLink . setContinuationExpected ( false ) ; }
Call when all header block fragments for a header block have been received