idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
25,100
public Object saveView ( FacesContext facesContext ) { UIViewRoot uiViewRoot = facesContext . getViewRoot ( ) ; if ( uiViewRoot . isTransient ( ) ) { return null ; } Object serializedView = null ; ResponseStateManager responseStateManager = facesContext . getRenderKit ( ) . getResponseStateManager ( ) ; String viewId = uiViewRoot . getViewId ( ) ; ViewDeclarationLanguage vdl = facesContext . getApplication ( ) . getViewHandler ( ) . getViewDeclarationLanguage ( facesContext , viewId ) ; try { facesContext . getAttributes ( ) . put ( StateManager . IS_SAVING_STATE , Boolean . TRUE ) ; if ( vdl != null ) { StateManagementStrategy sms = vdl . getStateManagementStrategy ( facesContext , viewId ) ; if ( sms != null ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Calling saveView of StateManagementStrategy: " + sms . getClass ( ) . getName ( ) ) ; } serializedView = sms . saveView ( facesContext ) ; if ( StateCacheUtils . isMyFacesResponseStateManager ( responseStateManager ) ) { StateCacheUtils . getMyFacesResponseStateManager ( responseStateManager ) . saveState ( facesContext , serializedView ) ; } return serializedView ; } } if ( uiViewRoot . isTransient ( ) ) { return null ; } if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Entering saveSerializedView" ) ; } checkForDuplicateIds ( facesContext , facesContext . getViewRoot ( ) , new HashSet < String > ( ) ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Processing saveSerializedView - Checked for duplicate Ids" ) ; } serializedView = facesContext . getAttributes ( ) . get ( SERIALIZED_VIEW_REQUEST_ATTR ) ; if ( serializedView == null ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Processing saveSerializedView - create new serialized view" ) ; } Object treeStruct = getTreeStructureToSave ( facesContext ) ; Object compStates = getComponentStateToSave ( facesContext ) ; Object rlcStates = ! facesContext . getResourceLibraryContracts ( ) . isEmpty ( ) ? UIComponentBase . saveAttachedState ( facesContext , new ArrayList < String > ( facesContext . getResourceLibraryContracts ( ) ) ) : null ; serializedView = new Object [ ] { new Object [ ] { treeStruct , rlcStates } , compStates } ; facesContext . getAttributes ( ) . put ( SERIALIZED_VIEW_REQUEST_ATTR , serializedView ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Processing saveSerializedView - new serialized view created" ) ; } } if ( StateCacheUtils . isMyFacesResponseStateManager ( responseStateManager ) ) { StateCacheUtils . getMyFacesResponseStateManager ( responseStateManager ) . saveState ( facesContext , serializedView ) ; } if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Exiting saveView" ) ; } } finally { facesContext . getAttributes ( ) . remove ( StateManager . IS_SAVING_STATE ) ; } return serializedView ; }
Wrap the original method and redirect to VDL StateManagementStrategy when necessary
25,101
public static Serializable serialize ( Serializable serializable ) throws IOException { if ( serializable == null ) { return null ; } if ( serializable instanceof KeyHelper ) { return serializable ; } ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; ObjectOutputStream objectOutputStream = new ObjectOutputStream ( byteArrayOutputStream ) ; objectOutputStream . writeObject ( serializable ) ; byteArrayOutputStream . flush ( ) ; KeyHelper vkh = new KeyHelper ( ) ; vkh . vBytes = byteArrayOutputStream . toByteArray ( ) ; return vkh ; }
serialize the primary key corresponding to a Handle to an entity bean for Rel . 3 . 5 4 . 0 . This method is called from the writeObject
25,102
public static Serializable deserialize ( Serializable kh ) throws IOException , ClassNotFoundException { if ( kh == null ) { return null ; } if ( ! ( kh instanceof KeyHelper ) ) { return kh ; } KeyHelper ivKh = ( KeyHelper ) kh ; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream ( ivKh . vBytes ) ; ObjectInputStream objectInputStream = new CCLObjectInputStream ( byteArrayInputStream ) ; Serializable result = ( Serializable ) objectInputStream . readObject ( ) ; objectInputStream . close ( ) ; return result ; }
deserialize the Object reference corresponding to a primary key for a Handle to Rel . 3 . 5 4 . 0 Entity Bean . This method is called from the readResolve
25,103
public Object readResolve ( ) throws ObjectStreamException { Object obj = null ; try { obj = deserialize ( this ) ; } catch ( Throwable t ) { throw new InvalidObjectException ( "com.ibm.ws.ejb.portable.KeyHelper can not be deserialized" ) ; } return obj ; }
readResolve is the standard overide if you want to substitute during a readObject call during serialization in our case we call the deserialize method to deserialize the contained byte array into the original Key object
25,104
private int skipWhiteSpace ( byte [ ] data , int start ) { int index = start ; while ( index < data . length && ( ' ' == data [ index ] || '\t' == data [ index ] ) ) { index ++ ; } return index ; }
Skip whitespace found in the input data starting at the given index . It will return an index value that points to the first non - space byte found or end of data if it ran out .
25,105
protected HttpRequestMessageImpl getRequestImpl ( ) { if ( null == getMyRequest ( ) ) { setMyRequest ( getObjectFactory ( ) . getRequest ( this ) ) ; getMyRequest ( ) . setHeaderChangeLimit ( getHttpConfig ( ) . getHeaderChangeLimit ( ) ) ; } setStartTime ( ) ; return getMyRequest ( ) ; }
Get access to the request message impl for internal use .
25,106
public void setResponse ( HttpResponseMessage msg ) throws IllegalResponseObjectException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "setResponse: " + msg ) ; } if ( null == msg ) { throw new IllegalResponseObjectException ( "Illegal null message" ) ; } HttpResponseMessageImpl temp = null ; try { temp = ( HttpResponseMessageImpl ) msg ; } catch ( ClassCastException cce ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Non msg impl passed to setResponse" ) ; } throw new IllegalResponseObjectException ( "Invalid message provided" ) ; } if ( null != getMyResponse ( ) && isResponseOwner ( ) ) { if ( ! getMyResponse ( ) . equals ( temp ) ) { getMyResponse ( ) . destroy ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Caller overlaying same message" ) ; } } } setMyResponse ( temp ) ; getMyResponse ( ) . init ( this ) ; getMyResponse ( ) . setHeaderChangeLimit ( getHttpConfig ( ) . getHeaderChangeLimit ( ) ) ; updatePersistence ( getMyResponse ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "setResponse" ) ; } }
Set the response object in the service context for usage .
25,107
public void sendResponseHeaders ( ) throws IOException , MessageSentException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "sendResponseHeaders(sync)" ) ; } if ( ! headersParsed ( ) ) { IOException ioe = new IOException ( "Request not read yet" ) ; FFDCFilter . processException ( ioe , CLASS_NAME + ".sendResponseHeaders" , "594" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Attempt to send response without a request msg" ) ; } throw ioe ; } if ( headersSent ( ) ) { throw new MessageSentException ( "Message already sent" ) ; } sendHeaders ( getResponseImpl ( ) ) ; if ( getResponseImpl ( ) . isTemporaryStatusCode ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Temp response sent, resetting send flags." ) ; } resetWrite ( ) ; } }
Send the headers for the outgoing response synchronously .
25,108
protected HttpInvalidMessageException checkResponseValidity ( ) { if ( ! MethodValues . HEAD . equals ( getRequest ( ) . getMethodValue ( ) ) ) { long len = getResponse ( ) . getContentLength ( ) ; long num = getNumBytesWritten ( ) ; if ( HeaderStorage . NOTSET != len && num != len ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Response had content-length of " + Long . toString ( len ) + " but sent " + Long . toString ( num ) ) ; } if ( getHttpConfig ( ) . getDebugLog ( ) . isEnabled ( DebugLog . Level . ERROR ) ) { getHttpConfig ( ) . getDebugLog ( ) . log ( DebugLog . Level . ERROR , HttpMessages . MSG_CONN_INVALID_LENGTHS + Long . toString ( len ) + " but sent " + Long . toString ( num ) , this ) ; } setPersistent ( false ) ; return new HttpInvalidMessageException ( "Response length: " + Long . toString ( len ) + " " + Long . toString ( num ) ) ; } } return null ; }
Once the response message has been fully written perform any last checks for correctness . This will return null if the response was valid otherwise it will return the HttpInvalidMessageException that should be handed off to the application channel above .
25,109
protected void logFinalResponse ( long numBytesWritten ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { HttpChannelConfig c = getHttpConfig ( ) ; Tr . debug ( tc , "logFinal" , c , c . getAccessLog ( ) , c . getAccessLog ( ) . isStarted ( ) , numBytesWritten ) ; } if ( ! getHttpConfig ( ) . getAccessLog ( ) . isStarted ( ) ) { return ; } if ( MethodValues . UNDEF . equals ( getRequest ( ) . getMethodValue ( ) ) ) { return ; } getHttpConfig ( ) . getAccessLog ( ) . log ( getRequest ( ) , getResponse ( ) , getRequestVersion ( ) . getName ( ) , null , getRemoteAddr ( ) . getHostAddress ( ) , numBytesWritten ) ; }
Method to consolidate the access logging message into one spot . This pulls all the pieces together for the appropriate line to save .
25,110
public void finishRawResponseMessage ( WsByteBuffer [ ] body ) throws IOException , MessageSentException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "finishRawResponseMessage(sync)" ) ; } setRawBody ( true ) ; finishResponseMessage ( body ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "finishRawResponseMessage(sync)" ) ; } }
Finish sending the response message with the optional input body buffers . These can be null if there is no more actual body data to send . This method will avoid any body modification such as compression or chunked encoding and simply send the buffers as - is . If the headers have not been sent yet then they will be prepended to the input data .
25,111
public void sendError ( HttpError error ) throws MessageSentException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Called sendError with: " + error ) ; } if ( ! headersParsed ( ) ) { IOException ioe = new IOException ( "Request not read yet" ) ; FFDCFilter . processException ( ioe , CLASS_NAME + ".sendError" , "1116" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Attempt to send response without a request msg" ) ; } finishSendError ( ioe ) ; return ; } if ( headersSent ( ) ) { throw new MessageSentException ( "Message already sent" ) ; } if ( null == error ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Reset null error to Internal Server Error" ) ; } error = StatusCodes . INTERNAL_ERROR . getHttpError ( ) ; } getResponse ( ) . setStatusCode ( error . getErrorCode ( ) ) ; if ( getResponse ( ) . getStatusCode ( ) . isErrorCode ( ) ) { setPersistent ( false ) ; } getVC ( ) . getStateMap ( ) . put ( HTTP_ERROR_IDENTIFIER , error ) ; if ( getHttpConfig ( ) . getDebugLog ( ) . isEnabled ( DebugLog . Level . ERROR ) ) { getHttpConfig ( ) . getDebugLog ( ) . log ( DebugLog . Level . ERROR , HttpMessages . MSG_CONN_SENDERROR + error . getErrorCode ( ) , this ) ; } WsByteBuffer [ ] body = loadErrorBody ( error , getMyRequest ( ) , getResponse ( ) ) ; VirtualConnection rc = finishResponseMessage ( body , HttpISCWriteErrorCallback . getRef ( ) , false ) ; if ( null != rc ) { finishSendError ( error . getClosingException ( ) ) ; } }
Sends an error code and page back to the client asynchronously and closes the connection .
25,112
protected void finishSendError ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "finishSendError: " + getVC ( ) ) ; } HttpError error = ( HttpError ) getVC ( ) . getStateMap ( ) . get ( HTTP_ERROR_IDENTIFIER ) ; WsByteBuffer [ ] body = ( WsByteBuffer [ ] ) getVC ( ) . getStateMap ( ) . remove ( EPS_KEY ) ; if ( null != body ) { for ( int i = 0 ; i < body . length && null != body [ i ] ; i ++ ) { body [ i ] . release ( ) ; } } if ( null != error ) { this . myLink . close ( getVC ( ) , error . getClosingException ( ) ) ; } else { this . myLink . close ( getVC ( ) , null ) ; } }
Finish the send error path by closing the connection with the exception from the HttpError . This is used by the callbacks .
25,113
protected void finishSendError ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "finishSendError(exception): " + getVC ( ) ) ; } WsByteBuffer [ ] body = ( WsByteBuffer [ ] ) getVC ( ) . getStateMap ( ) . remove ( EPS_KEY ) ; if ( null != body ) { for ( int i = 0 ; i < body . length && null != body [ i ] ; i ++ ) { body [ i ] . release ( ) ; } } this . myLink . close ( getVC ( ) , e ) ; }
Finish the send error path by closing the connection with the exception from the HttpError .
25,114
public void purgeBodyBuffers ( boolean callClose ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Discarding body buffers..." ) ; } super . clearStorage ( ) ; super . clearTempStorage ( ) ; if ( callClose ) { this . myLink . close ( getVC ( ) , null ) ; } }
If we are purging the incoming request body during a close sequence then this method should be called once the entire body is successfully read . This will discard those body buffers and then restart the close process now that we re ready to read the next inbound request .
25,115
public void initialise ( String name , int minSize , int maxSize ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "initialise" , new Object [ ] { name , minSize , maxSize } ) ; wasThreadPool = new com . ibm . ws . util . ThreadPool ( name , minSize , maxSize ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "initialise" ) ; }
Creates the underlying WAS thread pool .
25,116
public ArrayList < Frame > prepareHeaders ( byte [ ] marshalledHeaders , boolean complete ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareHeaders entry: stream: marked as complete: " + complete ) ; } int maxFrameSize = muxLink . getRemoteConnectionSettings ( ) . getMaxFrameSize ( ) ; ArrayList < Frame > frameList = new ArrayList < Frame > ( ) ; boolean endHeaders = true ; if ( marshalledHeaders . length > maxFrameSize ) { int remaining = marshalledHeaders . length ; int frameSize = maxFrameSize ; int position = 0 ; endHeaders = false ; byte [ ] firstFragment = Arrays . copyOfRange ( marshalledHeaders , position , frameSize ) ; FrameHeaders fh = new FrameHeaders ( streamID , firstFragment , complete , endHeaders ) ; frameList . add ( fh ) ; remaining = remaining - frameSize ; while ( remaining > 0 ) { position = position + frameSize ; if ( remaining >= maxFrameSize ) { frameSize = maxFrameSize ; } else { frameSize = remaining ; } remaining = remaining - frameSize ; byte [ ] fragment = Arrays . copyOfRange ( marshalledHeaders , position , position + frameSize ) ; endHeaders = remaining == 0 ? true : false ; FrameContinuation continued = new FrameContinuation ( streamID , fragment , endHeaders , false , false ) ; frameList . add ( continued ) ; if ( endHeaders ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareHeaders exit : " + frameList ) ; } return frameList ; } } } FrameHeaders fh = new FrameHeaders ( streamID , marshalledHeaders , complete , endHeaders ) ; frameList . add ( fh ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareHeaders exit : " + frameList ) ; } return frameList ; }
Create Header frames corresponding to a byte array of http headers
25,117
public ArrayList < Frame > prepareBody ( WsByteBuffer [ ] wsbb , int length , boolean isFinalWrite ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareBody entry : final write: " + isFinalWrite ) ; } ArrayList < Frame > dataFrames = new ArrayList < Frame > ( ) ; FrameData dataFrame ; if ( wsbb == null || length == 0 ) { dataFrame = new FrameData ( streamID , null , 0 , isFinalWrite ) ; dataFrames . add ( dataFrame ) ; return dataFrames ; } boolean endStream = isFinalWrite ; boolean lastData = false ; int lengthWritten = 0 ; if ( wsbb . length > 1 ) { endStream = false ; } for ( int i = 0 ; i < wsbb . length ; i ++ ) { WsByteBuffer b = wsbb [ i ] ; if ( b == null ) { continue ; } lengthWritten += b . remaining ( ) ; if ( b . remaining ( ) != 0 ) { if ( lengthWritten >= length ) { lastData = true ; endStream = lastData && isFinalWrite ? true : false ; } dataFrame = new FrameData ( streamID , b , b . remaining ( ) , endStream ) ; dataFrames . add ( dataFrame ) ; if ( lastData ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareBody exit : " + dataFrames ) ; } return dataFrames ; } } } return dataFrames ; }
Create Data frames to contain the http body payload The buffers passed in must not exceed the http2 max frame size
25,118
protected boolean isSwappableData ( Object obj ) { if ( obj != null && ( obj instanceof Serializable || obj instanceof Externalizable ) ) { return true ; } return false ; }
Check if attribute is swappable as defined by J2EE
25,119
public void initialize ( MessageStoreImpl ms , XidManager xidManager , Configuration configuration ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "initialize" , new Object [ ] { "MS=" + ms , "XidManager=" + xidManager , "Config=" + configuration } ) ; _ms = ms ; _configuration = configuration ; _timeouts = new MEStartupTimeouts ( _ms ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "initialize" ) ; }
Initialises the PersistentMessageStore
25,120
public void stop ( int mode ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "stop" , "Mode=" + mode ) ; _available = false ; _shutdownRequested = true ; if ( _starting ) { synchronized ( this ) { _starting = false ; notify ( ) ; } } if ( _spillDispatcher != null ) { _spillDispatcher . stop ( mode ) ; _spillDispatcher = null ; } _batchingContextFactory = null ; if ( _objectManager != null ) { try { _objectManager . shutdown ( ) ; } catch ( ObjectManagerException ome ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ome , "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.stop" , "1:764:1.81.1.6" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "Unexpected exception caught stopping persistent message store!" , ome ) ; } _objectManager = null ; _permanentStore = null ; _temporaryStore = null ; } if ( _uniqueKeyManager != null ) { _uniqueKeyManager . stop ( ) ; _uniqueKeyManager = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "stop" ) ; }
Stops the Persistent Message Store .
25,121
public void notification ( int event , Object [ ] args ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "notification" , new Object [ ] { event , args } ) ; switch ( event ) { case ObjectManagerEventCallback . objectManagerStopped : if ( _omgrStarted ) { objectManagerStopped ( ) ; } break ; case ObjectManagerEventCallback . objectStoreOpened : ensureStoreCanBeFound ( ( ObjectStore ) args [ 0 ] ) ; break ; default : } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "notification" ) ; }
by the ObjectManager when anything interesting occurs .
25,122
private void objectManagerStopped ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "objectManagerStopped" ) ; _available = false ; if ( ! _shutdownRequested ) { _ms . reportLocalError ( ) ; SibTr . error ( tc , "FILE_STORE_STOP_UNEXPECTED_SIMS1590" ) ; } else { SibTr . info ( tc , "FILE_STORE_STOP_EXPECTED_SIMS1589" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "objectManagerStopped" ) ; }
as we can not function once we have lost the ObjectManager .
25,123
private String createDirectoryPath ( String path ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createDirectoryPath" , "Path=" + path ) ; StringBuilder directoryPath = new StringBuilder ( "" ) ; if ( ( path != null ) && ( path . length ( ) > 0 ) ) { if ( path . charAt ( 0 ) == '/' ) { directoryPath . append ( "/" ) ; } if ( path . charAt ( 0 ) == '\\' && path . charAt ( 1 ) == '\\' ) { directoryPath . append ( "\\\\" ) ; } final StringTokenizer tokenizer = new StringTokenizer ( path , "\\/" ) ; while ( tokenizer . hasMoreTokens ( ) ) { final String pathChunk = tokenizer . nextToken ( ) ; directoryPath . append ( pathChunk ) ; File test = new File ( directoryPath . toString ( ) ) ; if ( ! test . exists ( ) ) { test . mkdir ( ) ; } if ( tokenizer . hasMoreTokens ( ) ) { directoryPath . append ( File . separator ) ; } } } String retval = directoryPath . toString ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createDirectoryPath" , retval ) ; return retval ; }
Checks to see if the supplied path exists and if not creates the directory structure required to store the file store files .
25,124
public boolean mayBeNumeric ( ) { if ( type == UNKNOWN ) type = NUMERIC ; return type == NUMERIC || ( type >= INT && type <= DOUBLE ) ; }
Returns true if the type is consistent with a numeric context false otherwise . Sets the type to NUMERIC if it is UNKNOWN .
25,125
public void unintern ( InternTable table ) { refCount -- ; if ( refCount < 0 ) throw new IllegalStateException ( ) ; if ( refCount == 0 ) { Object res = table . remove ( this ) ; if ( res == null ) throw new IllegalStateException ( ) ; } }
Removes this Selector from an InternTable
25,126
public static Selector decode ( ObjectInput buf ) throws IOException { if ( buf . readByte ( ) != VERSION ) throw new IOException ( ) ; try { return decodeSubtree ( buf ) ; } catch ( Exception e ) { FFDC . processException ( cclass , "com.ibm.ws.sib.matchspace.selector.impl.Selector.decode" , e , "1:191:1.19" ) ; throw new IllegalArgumentException ( ) ; } }
The decode method turns an ObjectInput into a Selector tree .
25,127
public static String createDirectoryPath ( String source ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "createDirectoryPath" , source ) ; String directoryPath = null ; if ( source != null ) { directoryPath = "" ; final StringTokenizer tokenizer = new StringTokenizer ( source , "\\/" ) ; while ( tokenizer . hasMoreTokens ( ) ) { final String pathChunk = tokenizer . nextToken ( ) ; directoryPath += pathChunk ; if ( tokenizer . hasMoreTokens ( ) ) { directoryPath += File . separator ; } } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createDirectoryPath" , directoryPath ) ; return directoryPath ; }
Replaces forward and backward slashes in the source string with File . separator characters .
25,128
protected void performColdStart ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "performColdStart" ) ; coldStartLogFileName = logFileName ; coldStartTime = System . currentTimeMillis ( ) ; switch ( logFileType ) { case ( ObjectManager . LOG_FILE_TYPE_FILE ) : case ( ObjectManager . LOG_FILE_TYPE_CLEAR ) : logOutput = new FileLogOutput ( logFile , this ) ; break ; case ( ObjectManager . LOG_FILE_TYPE_NONE ) : logOutput = new DummyLogOutput ( ) ; break ; default : if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "performColdStart" , new Integer ( logFileType ) ) ; throw new InvalidLogFileTypeException ( this , logFileType ) ; } trace . debug ( cclass , "performColdStart" , "ObjectManager using logFile " + logFileName + " was cold started" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "performColdStart" , new Object [ ] { coldStartLogFileName , new java . util . Date ( coldStartTime ) } ) ; }
Cold start the ObjectManager .
25,129
private final void performRecovery ( LogInput logInput ) throws ObjectManagerException { final String methodName = "performRecovery" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { logInput } ) ; checkpointEndSeen = false ; try { for ( ; ; ) { LogRecord logRecordRead = logInput . readNext ( ) ; logRecordRead . performRecovery ( this ) ; } } catch ( LogFileExhaustedException exception ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEventEnabled ( ) ) trace . event ( this , cclass , methodName , exception ) ; } catch ( ObjectManagerException exception ) { ObjectManager . ffdc . processException ( this , cclass , methodName , exception , "1:751:1.62" ) ; shutdown ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , "ObjectManagerException:758" ) ; throw exception ; } if ( checkpointEndSeen == false ) { shutdown ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { "CheckpointEndNotFoundException:774" , logFileName } ) ; throw new CheckpointEndNotFoundException ( this , logFileName ) ; } synchronized ( this ) { setState ( nextStateForLogReplayed ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Recover the state of the objectManager from the Log . Re apply changes to object stores that were lost .
25,130
protected void saveClonedState ( Transaction transaction ) throws ObjectManagerException { final String methodName = "saveClonedState" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , transaction ) ; java . util . Iterator objectStoreIterator = objectStores . values ( ) . iterator ( ) ; while ( objectStoreIterator . hasNext ( ) ) { ObjectStore objectStore = ( ObjectStore ) objectStoreIterator . next ( ) ; if ( objectStore . getContainsRestartData ( ) ) { Token objectManagerStateCloneToken = new Token ( objectStore , ObjectStore . objectManagerStateIdentifier . longValue ( ) ) ; objectManagerStateCloneToken = objectStore . like ( objectManagerStateCloneToken ) ; ObjectManagerState objectManagerStateClone = ( ObjectManagerState ) objectManagerStateCloneToken . getManagedObject ( ) ; if ( objectManagerStateClone == null ) { objectManagerStateClone = new ObjectManagerState ( ) ; objectManagerStateClone . objectStores = objectStores ; objectManagerStateClone . becomeCloneOf ( this ) ; objectManagerStateCloneToken . setManagedObject ( objectManagerStateClone ) ; transaction . add ( objectManagerStateClone ) ; } else { transaction . lock ( objectManagerStateClone ) ; objectManagerStateClone . objectStores = objectStores ; objectManagerStateClone . becomeCloneOf ( this ) ; transaction . replace ( objectManagerStateClone ) ; } } } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Create or update a copy of the ObjectManagerState in each ObjectStore . The caller must be synchronised on objectStores .
25,131
protected final void waitForCheckpoint ( boolean persistent ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "waitForCheckpoint" ) ; checkpointHelper . waitForCheckpoint ( persistent ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "waitForCheckpoint" , "persistent=" + persistent + "(boolean)" ) ; }
Blocking request for a checkpoint returns once a checkpoint has been completed .
25,132
protected final void requestCheckpoint ( boolean persistent ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "requestCheckpoint" , new Object [ ] { new Boolean ( persistent ) } ) ; if ( checkpointHelper != null ) checkpointHelper . requestCheckpoint ( persistent ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "requestCheckpoint" ) ; }
Non blocking request for a checkpoint returns immediately . If multiple requests are made this may result in fewer checkpoints than requests .
25,133
public void notifyBeforeEvaluation ( String expression ) { for ( EvaluationListener listener : listeners ) { try { listener . beforeEvaluation ( this , expression ) ; } catch ( Throwable t ) { Util . handleThrowable ( t ) ; } } }
Notify interested listeners that an expression will be evaluated .
25,134
public void notifyAfterEvaluation ( String expression ) { for ( EvaluationListener listener : listeners ) { try { listener . afterEvaluation ( this , expression ) ; } catch ( Throwable t ) { Util . handleThrowable ( t ) ; } } }
Notify interested listeners that an expression has been evaluated .
25,135
public void notifyPropertyResolved ( Object base , Object property ) { for ( EvaluationListener listener : listeners ) { try { listener . propertyResolved ( this , base , property ) ; } catch ( Throwable t ) { Util . handleThrowable ( t ) ; } } }
Notify interested listeners that a property has been resolved .
25,136
public boolean isLambdaArgument ( String name ) { for ( Map < String , Object > arguments : lambdaArguments ) { if ( arguments . containsKey ( name ) ) { return true ; } } return false ; }
Determine if the specified name is recognised as the name of a lambda argument .
25,137
public Object getLambdaArgument ( String name ) { for ( Map < String , Object > arguments : lambdaArguments ) { Object result = arguments . get ( name ) ; if ( result != null ) { return result ; } } return null ; }
Obtain the value of the lambda argument with the given name .
25,138
public Object convertToType ( Object obj , Class < ? > type ) { boolean originalResolved = isPropertyResolved ( ) ; setPropertyResolved ( false ) ; try { ELResolver resolver = getELResolver ( ) ; if ( resolver != null ) { Object result = resolver . convertToType ( this , obj , type ) ; if ( isPropertyResolved ( ) ) { return result ; } } } finally { setPropertyResolved ( originalResolved ) ; } return ELManager . getExpressionFactory ( ) . coerceToType ( obj , type ) ; }
Coerce the supplied object to the requested type .
25,139
public static Class < ? > tryLoad ( String className ) { try { return Class . forName ( className , false , JSFContainer . class . getClassLoader ( ) ) ; } catch ( ClassNotFoundException notFound ) { return null ; } }
Try to load the given class . If the class is not found null is returned .
25,140
private boolean processUninstalledInstallerBundle ( String installerBundleLocation ) { Set < String > bundleLocationsToUninstall = bundleOrigins . remove ( installerBundleLocation ) ; if ( bundleLocationsToUninstall != null ) { debug ( "Installer bundle at location {0} had installees that need to be uninstalled" , installerBundleLocation ) ; Set < String > unsuccessfulUninstallLocations = uninstallInstalleeBundles ( bundleLocationsToUninstall ) ; if ( ! unsuccessfulUninstallLocations . isEmpty ( ) ) { bundleOrigins . put ( installerBundleLocation , unsuccessfulUninstallLocations ) ; debug ( "Not all installees were removed" , unsuccessfulUninstallLocations ) ; } return true ; } return false ; }
Determines if the uninstalled bundle location was an installer bundle and calls for the removal of any installees associated with it if it was .
25,141
private Set < String > uninstallInstalleeBundles ( Set < String > installeeBundleLocationsToUninstall ) { Set < String > unsuccessfulUninstallLocations = new HashSet < String > ( ) ; for ( String installeeBundleLocation : installeeBundleLocationsToUninstall ) { Bundle installeeBundleToUninstall = ctx . getBundle ( installeeBundleLocation ) ; if ( installeeBundleToUninstall != null ) { try { installeeBundleToUninstall . uninstall ( ) ; } catch ( BundleException e ) { unsuccessfulUninstallLocations . add ( installeeBundleLocation ) ; BundleStartLevel bsl = installeeBundleToUninstall . adapt ( BundleStartLevel . class ) ; bsl . setStartLevel ( Integer . MAX_VALUE ) ; } } } return unsuccessfulUninstallLocations ; }
Iterates a set of installee bundles attempting to uninstall them .
25,142
final private void updateWaterMark ( ) { if ( initWaterMark ) { if ( current < lowWaterMark ) lowWaterMark = current ; if ( current > highWaterMark ) highWaterMark = current ; } else { lowWaterMark = highWaterMark = current ; initWaterMark = true ; } }
Internal final method for perfOptimization
25,143
final public void incrementWithoutSync ( long curTime , long val ) { if ( enabled ) { lastSampleTime = updateIntegral ( curTime ) ; current += val ; updateWaterMark ( ) ; } else { current += val ; } }
the caller of this method should be in synchronization block
25,144
final public void decrementWithSyncFlag ( long curTime , long val ) { if ( enabled ) { lastSampleTime = updateIntegral ( curTime ) ; if ( sync ) { synchronized ( this ) { current -= val ; } } else { current -= val ; if ( current < 0 ) current = 0 ; } updateWaterMark ( ) ; } else { current -= val ; } }
synchronize ONLY if synchronized update flag is enabled
25,145
public int getType ( int pathLength ) { if ( type == TYPE_INVALID || dataPath == null || pathLength >= dataPath . length ) return TYPE_INVALID ; if ( pathLength == 1 ) return TYPE_MODULE ; else return TYPE_COLLECTION ; }
This method should be rewritten if we allow arbitrary module structure
25,146
public boolean isSamePath ( DataDescriptor other ) { if ( other == null ) return false ; if ( type == TYPE_INVALID || other . getType ( ) == TYPE_INVALID ) return false ; if ( type != other . getType ( ) ) return false ; if ( dataPath == null || other . getPath ( ) == null ) return false ; String [ ] otherPath = other . getPath ( ) ; if ( dataPath . length != otherPath . length ) return false ; for ( int i = 0 ; i < dataPath . length ; i ++ ) { if ( ! dataPath [ i ] . equals ( otherPath [ i ] ) ) return false ; } return true ; }
Returns true if this descriptor has same path same type same moduleName instanceName and dataId as the other DataDescriptor .
25,147
public boolean isDescendant ( DataDescriptor other ) { if ( other == null ) return false ; if ( type == TYPE_INVALID || other . getType ( ) == TYPE_INVALID ) return false ; String [ ] otherPath = other . getPath ( ) ; if ( otherPath . length >= dataPath . length ) return false ; for ( int i = 0 ; i < otherPath . length ; i ++ ) { if ( ! dataPath [ i ] . equals ( otherPath [ i ] ) ) return false ; } return true ; }
Returns true if this descriptor is descendant of other descriptor
25,148
public DataDescriptor parentDescriptor ( ) { if ( type == TYPE_INVALID ) { return null ; } else if ( dataIds != null ) { return new DataDescriptor ( dataPath ) ; } else { if ( dataPath . length == 1 ) return null ; String [ ] myPath = new String [ dataPath . length - 1 ] ; System . arraycopy ( dataPath , 0 , myPath , 0 , myPath . length ) ; return new DataDescriptor ( myPath ) ; } }
Returns the parentDescriptor
25,149
public Object createConnectionFactory ( final ConnectionManager connectionManager ) { if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "createConnectionFactory" , connectionManager ) ; } final Object connectionFactory = new SibRaConnectionFactory ( this , connectionManager ) ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "createConnectionFactory" , connectionFactory ) ; } return connectionFactory ; }
Creates a core SPI connection factory that will use the given connection manager to create connections .
25,150
protected void put ( byte [ ] bytes ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "put" , new Object [ ] { RLSUtils . toHexString ( bytes , RLSUtils . MAX_DISPLAY_BYTES ) , this } ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing at position " + _buffer . position ( ) ) ; _buffer . put ( bytes ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "put" ) ; }
Setter method used to write bytes . length bytes from the buffer into the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by bytes . length .
25,151
protected void putInt ( int data ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "putInt" , new Object [ ] { this , new Integer ( data ) } ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing at position " + _buffer . position ( ) ) ; _buffer . putInt ( data ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "putInt" ) ; }
Setter method used to write an integer to the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of an integer .
25,152
protected void putLong ( long data ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "putLong" , new Object [ ] { this , new Long ( data ) } ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing at position " + _buffer . position ( ) ) ; _buffer . putLong ( data ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "putLong" ) ; }
Setter method used to write a long to the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a long .
25,153
protected void putShort ( short data ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "putShort" , new Object [ ] { this , new Short ( data ) } ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing at position " + _buffer . position ( ) ) ; _buffer . putShort ( data ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "putShort" ) ; }
Setter method used to write a short to the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a short .
25,154
protected void putBoolean ( boolean data ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "putBoolean" , new Object [ ] { this , new Boolean ( data ) } ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing at position " + _buffer . position ( ) ) ; _buffer . put ( data ? TRUE : FALSE ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "putBoolean" ) ; }
Setter method used to write a boolean to the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a boolean .
25,155
protected void close ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "close" , this ) ; _buffer . putLong ( _sequenceNumber ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "close" ) ; }
Close the WritableLogRecord . Creates the record tail sructure . On exit from this method the buffers byte cursor will be positioned on the very next byte after the log record . No further access to this instance is permitted after this call has been issued .
25,156
public void setTime ( Date minTime , Date maxTime ) throws IllegalArgumentException { if ( minTime != null && maxTime != null && minTime . after ( maxTime ) ) { throw new IllegalArgumentException ( "Value of the minTime parameter should specify time before the time specified by the value of the maxTime parameter" ) ; } this . minTime = minTime ; this . maxTime = maxTime ; }
sets the current value for the minimum and maximum time
25,157
public void setLevels ( Level minLevel , Level maxLevel ) throws IllegalArgumentException { if ( minLevel != null && maxLevel != null && minLevel . intValue ( ) > maxLevel . intValue ( ) ) { throw new IllegalArgumentException ( "Value of the minLevel parameter should specify level not larger than the value of the maxLevel parametere." ) ; } this . minLevel = minLevel ; this . maxLevel = maxLevel ; }
sets the current value for the minimum and maximum levels
25,158
public static Pattern compile ( String pattern ) throws IllegalArgumentException { if ( pattern == null ) { throw new IllegalArgumentException ( "Pattern can not be null" ) ; } if ( pattern . startsWith ( "/" ) && pattern . endsWith ( "/" ) && pattern . length ( ) > 1 ) { try { return Pattern . compile ( pattern . substring ( 1 , pattern . length ( ) - 1 ) ) ; } catch ( PatternSyntaxException e ) { throw new IllegalArgumentException ( "Pattern contains an invalid expression" , e ) ; } } StringBuilder rEPattern = new StringBuilder ( "^" ) ; for ( int i = 0 ; i < pattern . length ( ) ; i ++ ) { if ( pattern . charAt ( i ) == '*' ) rEPattern . append ( '.' ) ; if ( pattern . charAt ( i ) == '?' ) { rEPattern . append ( '.' ) ; } else { rEPattern . append ( pattern . charAt ( i ) ) ; } } rEPattern . append ( "$" ) ; try { return Pattern . compile ( rEPattern . toString ( ) ) ; } catch ( PatternSyntaxException e ) { throw new IllegalArgumentException ( "Pattern contains an invalid expression" , e ) ; } }
compiles pattern string into regular expression Pattern object .
25,159
public void setThreadIDs ( String [ ] threadIDs ) throws IllegalArgumentException { int [ ] threads = null ; if ( threadIDs != null ) { threads = new int [ threadIDs . length ] ; try { for ( int i = 0 ; i < threads . length ; i ++ ) { threads [ i ] = Integer . parseInt ( threadIDs [ i ] , 16 ) ; } } catch ( NumberFormatException ex ) { throw new IllegalArgumentException ( "Strings in the threadIDs array should be all in hexadecimal format" ) ; } } this . threadIDs = threads ; }
sets string array each string representing the hex value of a thread to search on
25,160
final public void decRequests ( long execTime , String url ) { long lst = 0 ; if ( responseTime != null && execTime >= 0 ) { lst = System . currentTimeMillis ( ) ; responseTime . add ( lst , execTime ) ; } if ( currentRequests != null ) { if ( lst <= 0 ) lst = System . currentTimeMillis ( ) ; currentRequests . decrement ( lst , 1 ) ; } }
use tmp var to avoid possible problem due to multithreads
25,161
public static Bundle getBundle ( BundleContext bundleContext , String resourceAdapter ) throws ConfigEvaluatorException { Bundle bundle = null ; if ( JMSResourceDefinitionConstants . RESOURCE_ADAPTER_WASJMS . equals ( resourceAdapter ) || JMSResourceDefinitionConstants . RESOURCE_ADAPTER_WMQJMS . equals ( resourceAdapter ) ) { Collection < ServiceReference < ResourceAdapterBundleService > > resourceAdapterServices ; try { resourceAdapterServices = bundleContext . getServiceReferences ( ResourceAdapterBundleService . class , "(type=" . concat ( resourceAdapter ) . concat ( ")" ) ) ; bundle = resourceAdapterServices . iterator ( ) . next ( ) . getBundle ( ) ; } catch ( InvalidSyntaxException e ) { } } else { bundle = bundleContext . getBundle ( BUNDLE_LOCATION + resourceAdapter ) ; } return bundle ; }
Get the bundle where the resource adapter s Metatype Information exists .
25,162
public void commsFailure ( SICoreConnection conn , SIConnectionLostException exception ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "commsFailure" , new Object [ ] { conn , exception } ) ; JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "COMMS_FAILURE_CWSIA0343" , new Object [ ] { exception } , exception , "ConnectionListenerImpl.commsFailure#1" , this , tc ) ; connection . reportException ( jmse ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "commsFailure" ) ; }
This method is called when a connection is closed due to a communications failure . Examine the SICommsException to determine the nature of the failure .
25,163
public void meTerminated ( SICoreConnection conn ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "meTerminated" , conn ) ; JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "ME_TERMINATED_CWSIA0344" , null , tc ) ; connection . reportException ( jmse ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "meTerminated" ) ; }
This method is called when a connection is closed because the Messaging Engine has terminated .
25,164
public static void shutDownSSLEngine ( SSLConnectionLink connLink , boolean isServer , boolean isConnected ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "shutDownSSLEngine: isServer: " + isServer + " isConnected: " + isConnected + " " + connLink ) ; } SSLEngine engine = connLink . getSSLEngine ( ) ; if ( engine != null ) { if ( isServer ) { if ( ! engine . isInboundDone ( ) ) { if ( isConnected ) { engine . closeOutbound ( ) ; WsByteBuffer buffer = allocateByteBuffer ( engine . getSession ( ) . getPacketBufferSize ( ) , false ) ; flushCloseDown ( engine , buffer , connLink ) ; buffer . release ( ) ; } try { engine . closeInbound ( ) ; } catch ( SSLException se ) { } } } else { if ( ! engine . isOutboundDone ( ) ) { engine . closeOutbound ( ) ; } if ( isConnected ) { WsByteBuffer buffer = allocateByteBuffer ( engine . getSession ( ) . getPacketBufferSize ( ) , false ) ; flushCloseDown ( engine , buffer , connLink ) ; buffer . release ( ) ; } } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "SSLEngine is null, must be shutdown already." ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "shutDownSSLEngine" ) ; } }
Shut down the engine for the given SSL connection link .
25,165
public static ByteBuffer [ ] getWrappedByteBuffers ( WsByteBuffer wsbuffers [ ] ) { ByteBuffer buffers [ ] = new ByteBuffer [ wsbuffers . length ] ; boolean foundNullBuffer = false ; int i = 0 ; for ( i = 0 ; i < wsbuffers . length ; i ++ ) { if ( wsbuffers [ i ] != null ) { buffers [ i ] = wsbuffers [ i ] . getWrappedByteBuffer ( ) ; } else { foundNullBuffer = true ; break ; } } if ( foundNullBuffer ) { ByteBuffer tempBuffers [ ] = buffers ; buffers = new ByteBuffer [ i ] ; for ( int j = 0 ; j < i ; j ++ ) { buffers [ j ] = tempBuffers [ j ] ; } } return buffers ; }
Return the underlying ByteBuffer array associated with the input WsByteBuffer array .
25,166
public static void flipBuffers ( WsByteBuffer [ ] buffers , int totalSize ) { int size = 0 ; boolean overLimit = false ; for ( int i = 0 ; i < buffers . length && null != buffers [ i ] ; i ++ ) { if ( overLimit ) { buffers [ i ] . limit ( buffers [ i ] . position ( ) ) ; } else { buffers [ i ] . flip ( ) ; size += buffers [ i ] . remaining ( ) ; overLimit = ( size >= totalSize ) ; } } }
Flip the input list of buffers walking through the list until the flipped amount equals the input total size mark the rest of the buffers as empty .
25,167
public static void copyBuffer ( WsByteBuffer src , WsByteBuffer dst ) { copyBuffer ( src , dst , src . remaining ( ) ) ; }
Simlified method call for copyBuffer which sets length to copy at src . remaining .
25,168
public static void copyBuffer ( WsByteBuffer src , WsByteBuffer dst , int length ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "copyBuffer: length=" + length + "\r\n\tsrc: " + getBufferTraceInfo ( src ) + "\r\n\tdst: " + getBufferTraceInfo ( dst ) ) ; } if ( ( dst . remaining ( ) < length ) || ( src . remaining ( ) < length ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "copyBuffer: Not enough space" ) ; } RuntimeException e = new RuntimeException ( "Attempt to copy source buffer to inadequate destination buffer" ) ; FFDCFilter . processException ( e , CLASS_NAME , "762" , src ) ; throw e ; } if ( src . hasArray ( ) ) { int newSrcPosition = src . position ( ) + length ; dst . put ( src . array ( ) , src . arrayOffset ( ) + src . position ( ) , length ) ; src . position ( newSrcPosition ) ; } else { byte srcByteArray [ ] = new byte [ length ] ; src . get ( srcByteArray , 0 , length ) ; dst . put ( srcByteArray ) ; } }
Copy all the contents of the source buffer into the destination buffer . The contents copied from the source buffer will be from its position . The data will be copied into the destination buffer starting at its current position .
25,169
public static WsByteBuffer allocateByteBuffer ( int size , boolean allocateDirect ) { WsByteBuffer newBuffer = null ; if ( allocateDirect ) { newBuffer = ChannelFrameworkFactory . getBufferManager ( ) . allocateDirect ( size ) ; } else { newBuffer = ChannelFrameworkFactory . getBufferManager ( ) . allocate ( size ) ; } newBuffer . limit ( newBuffer . capacity ( ) ) ; return newBuffer ; }
Allocate a ByteBuffer per the SSL config at least as big as the input size .
25,170
public static String getBufferTraceInfo ( WsByteBuffer buffers [ ] ) { if ( null == buffers ) { return "Null buffer array" ; } StringBuilder sb = new StringBuilder ( 32 + ( 64 * buffers . length ) ) ; for ( int i = 0 ; i < buffers . length ; i ++ ) { sb . append ( "\r\n\t Buffer [" ) ; sb . append ( i ) ; sb . append ( "]: " ) ; getBufferTraceInfo ( sb , buffers [ i ] ) ; } return sb . toString ( ) ; }
This method is called for tracing in various places . It returns a string that represents all the buffers in the array including hashcode position limit and capacity .
25,171
public static String showBufferContents ( WsByteBuffer buffers [ ] ) { if ( null == buffers || 0 == buffers . length ) { return "null" ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < buffers . length ; i ++ ) { sb . append ( "Buffer [" ) ; sb . append ( i ) ; if ( null == buffers [ i ] ) { sb . append ( "]: null\r\n" ) ; } else { sb . append ( "]: " ) ; sb . append ( WsByteBufferUtils . asString ( buffers [ i ] ) ) ; sb . append ( "\r\n" ) ; } } return sb . toString ( ) ; }
Return a String containing all the data in the buffers provided between their respective positions and limits .
25,172
public static WsByteBuffer [ ] allocateByteBuffers ( int requestedBufferSize , long totalDataSize , boolean allocateDirect , boolean enforceRequestedSize ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . entry ( tc , "allocateByteBuffers" ) ; } WsByteBuffer firstBuffer = allocateByteBuffer ( requestedBufferSize , allocateDirect ) ; if ( enforceRequestedSize ) { firstBuffer . limit ( requestedBufferSize ) ; } int actualBufferSize = firstBuffer . limit ( ) ; boolean enforce = enforceRequestedSize ; if ( enforce && actualBufferSize == requestedBufferSize ) { enforce = false ; } int numBuffersToAllocate = ( int ) ( totalDataSize / actualBufferSize ) ; if ( ( totalDataSize % actualBufferSize ) > 0 ) { numBuffersToAllocate ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "allocate: requestSize=" + requestedBufferSize + ", actualSize=" + actualBufferSize + ", totSize=" + totalDataSize + ", numBufs=" + numBuffersToAllocate ) ; } WsByteBuffer newBuffers [ ] = new WsByteBuffer [ numBuffersToAllocate ] ; newBuffers [ 0 ] = firstBuffer ; for ( int i = 1 ; i < newBuffers . length ; i ++ ) { newBuffers [ i ] = allocateByteBuffer ( requestedBufferSize , allocateDirect ) ; if ( enforce ) { newBuffers [ i ] . limit ( requestedBufferSize ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . exit ( tc , "allocateByteBuffers" ) ; } return newBuffers ; }
Allocate a buffer array large enough to contain totalDataSize bytes but with the limit of perBufferSize bytes per buffer .
25,173
public static boolean anyPositionsNonZero ( WsByteBuffer buffers [ ] ) { if ( buffers != null ) { for ( int i = 0 ; i < buffers . length ; i ++ ) { if ( ( buffers [ i ] != null ) && ( buffers [ i ] . position ( ) != 0 ) ) { return true ; } } } return false ; }
Search for any buffer in the array that has a position that isn t zero . If found return true otherwise false .
25,174
public static SSLEngine getOutboundSSLEngine ( SSLContext context , SSLLinkConfig config , String host , int port , SSLConnectionLink connLink ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getOutboundSSLEngine, host=" + host + ", port=" + port ) ; } SSLEngine engine = context . createSSLEngine ( host , port ) ; configureEngine ( engine , FlowType . OUTBOUND , config , connLink ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getOutboundSSLEngine, hc=" + engine . hashCode ( ) ) ; } return engine ; }
Create an SSL engine with the input parameters . The host and port values allow the re - use of possible cached SSL session ids .
25,175
public static SSLEngine getSSLEngine ( SSLContext context , FlowType type , SSLLinkConfig config , SSLConnectionLink connLink ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getSSLEngine" ) ; } SSLEngine engine = context . createSSLEngine ( ) ; configureEngine ( engine , type , config , connLink ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getSSLEngine, hc=" + engine . hashCode ( ) ) ; } return engine ; }
Setup the SSL engine for the given context .
25,176
private static void configureEngine ( SSLEngine engine , FlowType type , SSLLinkConfig config , SSLConnectionLink connLink ) { engine . setEnabledCipherSuites ( config . getEnabledCipherSuites ( engine ) ) ; String protocol = config . getSSLProtocol ( ) ; if ( protocol != null ) { engine . setEnabledProtocols ( new String [ ] { protocol } ) ; } if ( type == FlowType . INBOUND ) { engine . setUseClientMode ( false ) ; boolean flag = config . getBooleanProperty ( Constants . SSLPROP_CLIENT_AUTHENTICATION ) ; engine . setNeedClientAuth ( flag ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Client auth needed is " + engine . getNeedClientAuth ( ) ) ; } if ( ! flag ) { flag = config . getBooleanProperty ( Constants . SSLPROP_CLIENT_AUTHENTICATION_SUPPORTED ) ; engine . setWantClientAuth ( flag ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Client auth supported is " + engine . getWantClientAuth ( ) ) ; } } AlpnSupportUtils . registerAlpnSupport ( connLink , engine ) ; } else { engine . setUseClientMode ( true ) ; } try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Calling beginHandshake on engine" ) ; } engine . beginHandshake ( ) ; } catch ( SSLException se ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Error while starting handshake; " + se ) ; } } }
Configure the new engine based on the input flow type and configuration .
25,177
public static int [ ] adjustBuffersForJSSE ( WsByteBuffer [ ] buffers , int maxBufferSize ) { int [ ] limitInfo = null ; int dataAmount = 0 ; for ( int i = 0 ; i < buffers . length && null != buffers [ i ] ; i ++ ) { dataAmount += buffers [ i ] . remaining ( ) ; if ( dataAmount > maxBufferSize ) { int savedLimit = buffers [ i ] . limit ( ) ; limitInfo = new int [ ] { i , savedLimit } ; int overFlow = dataAmount - maxBufferSize ; buffers [ i ] . limit ( savedLimit - overFlow ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "adjustBuffersForJSSE: buffer [" + i + "] from " + savedLimit + " to " + buffers [ i ] . limit ( ) ) ; } break ; } else if ( dataAmount == maxBufferSize ) { break ; } } return limitInfo ; }
The purpose of this method is to prepare the input buffers to be sent into a call to wrap or unwrap in the JSSE considering the limitations about how much data can be present in each buffer . This amount is determined by the amount of data between position and limit .
25,178
public static int adjustBufferForJSSE ( WsByteBuffer buffer , int maxBufferSize ) { int limit = - 1 ; if ( null != buffer ) { int size = buffer . remaining ( ) ; if ( maxBufferSize < size ) { limit = buffer . limit ( ) ; int overFlow = size - maxBufferSize ; buffer . limit ( limit - overFlow ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "adjustBufferForJSSE: from " + limit + " to " + buffer . limit ( ) ) ; } } } return limit ; }
The purpose of this method is to prepare the input buffer to be sent into a call to wrap or unwrap in the JSSE considering the limitations about how much data can be present in each buffer . This amount is determined by the amount of data between position and limit .
25,179
public static void resetBuffersAfterJSSE ( WsByteBuffer [ ] buffers , int [ ] limitInfo ) { if ( limitInfo == null ) { return ; } int bufferIndex = limitInfo [ 0 ] ; int bufferLimit = limitInfo [ 1 ] ; if ( buffers . length > bufferIndex ) { WsByteBuffer buffer = buffers [ bufferIndex ] ; if ( ( buffer != null ) && ( buffer . capacity ( ) >= bufferLimit ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "resetBuffersAfterJSSE: buffer [" + bufferIndex + "] from " + buffer . limit ( ) + " to " + bufferLimit ) ; } buffer . limit ( bufferLimit ) ; } } }
This method is called after a call is made to adjustBuffersForJSSE followed by a call to wrap or unwrap in the JSSE . It restores the saved limit in the buffer that was modified . A few extra checks are done here to prevent any problems during odd code paths in the future .
25,180
public static void getBufferLimits ( WsByteBuffer [ ] buffers , int [ ] limits ) { if ( ( buffers != null ) && ( limits != null ) ) { for ( int i = 0 ; i < buffers . length && i < limits . length ; i ++ ) { if ( buffers [ i ] != null ) { limits [ i ] = buffers [ i ] . limit ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getBufferLimits: buffer[" + i + "] limit of " + limits [ i ] ) ; } } else { limits [ i ] = 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getBufferLimits: null buffer[" + i + "] limit of " + limits [ i ] ) ; } } } } }
Assign an array of limits associated with the passed in buffer array .
25,181
public static void setBufferLimits ( WsByteBuffer [ ] buffers , int [ ] limits ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "setBufferLimits" ) ; } if ( ( buffers != null ) && ( limits != null ) ) { int bufferCapacity = 0 ; int limit = 0 ; for ( int i = 0 ; i < buffers . length && i < limits . length ; i ++ ) { if ( buffers [ i ] != null ) { bufferCapacity = buffers [ i ] . capacity ( ) ; limit = limits [ i ] ; if ( buffers [ i ] . limit ( ) != limit ) { if ( bufferCapacity >= limit ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Buffer [" + i + "] being updated from " + buffers [ i ] . limit ( ) + " to " + limit ) ; } buffers [ i ] . limit ( limit ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Buffer [" + i + "] has capacity " + bufferCapacity + " less than passed in limit " + limit ) ; } } } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "setBufferLimits" ) ; } }
Assign the limits of the passed in buffers to the specified values in the int array . The lengths of both arrays are expected to be similar . The limits are expected to be settable . IE the respective buffers should have capacity > = to the limit .
25,182
public static int lengthOf ( WsByteBuffer [ ] src , int startIndex ) { int length = 0 ; if ( null != src ) { for ( int i = startIndex ; i < src . length && null != src [ i ] ; i ++ ) { length += src [ i ] . remaining ( ) ; } } return length ; }
Find the amount of data in the source buffers starting at the input index .
25,183
public static WsByteBuffer [ ] compressBuffers ( WsByteBuffer [ ] src , boolean releaseEmpty ) { List < WsByteBuffer > output = new LinkedList < WsByteBuffer > ( ) ; boolean first = true ; int size = 0 ; for ( int i = 0 ; i < src . length ; i ++ ) { if ( null == src [ i ] ) { continue ; } if ( 0 < src [ i ] . remaining ( ) ) { if ( first ) { output . add ( src [ i ] . slice ( ) ) ; src [ i ] . release ( ) ; first = false ; } else { output . add ( src [ i ] ) ; } size ++ ; } else if ( releaseEmpty ) { src [ i ] . release ( ) ; } } if ( 0 == size ) { return null ; } WsByteBuffer [ ] data = new WsByteBuffer [ size ] ; output . toArray ( data ) ; return data ; }
Take the source buffers and extract all non - null non - empty buffers into a new list . If the releaseEmpty flag is true then it will release the empty buffers .
25,184
public void visitCode ( ) { if ( injectedTraceAnnotationVisitor == null && classAdapter . isInjectedTraceAnnotationRequired ( ) ) { AnnotationVisitor av = visitAnnotation ( INJECTED_TRACE_TYPE . getDescriptor ( ) , true ) ; av . visitEnd ( ) ; } super . visitCode ( ) ; methodEntryLabel = new Label ( ) ; visitLabel ( methodEntryLabel ) ; if ( ! waitingForSuper ) { processMethodEntry ( ) ; } }
Begin processing a method . This is called when the instruction stream for a method is first encountered . Since this is the first callback we use this to add the byte codes required for entry tracing .
25,185
private void visitFrameAfterOnMethodEntry ( ) { if ( ! visitFramesAfterCallbacks ) return ; if ( isConstructor ( ) ) { List < Object > stackLocals = new ArrayList < Object > ( argTypes . length + 1 ) ; stackLocals . add ( classAdapter . getClassType ( ) . getInternalName ( ) ) ; for ( Type type : argTypes ) { switch ( type . getSort ( ) ) { case Type . ARRAY : case Type . OBJECT : stackLocals . add ( type . getInternalName ( ) ) ; break ; case Type . BOOLEAN : case Type . CHAR : case Type . BYTE : case Type . SHORT : case Type . INT : stackLocals . add ( INTEGER ) ; break ; case Type . LONG : stackLocals . add ( LONG ) ; break ; case Type . FLOAT : stackLocals . add ( FLOAT ) ; break ; case Type . DOUBLE : stackLocals . add ( DOUBLE ) ; break ; } } visitFrame ( F_FULL , stackLocals . size ( ) , stackLocals . toArray ( ) , 0 , new Object [ ] { } ) ; visitInsn ( NOP ) ; } else { visitFrame ( F_SAME , 0 , null , 0 , null ) ; visitInsn ( NOP ) ; } }
Inject a simple stack map frame and a PUSH NULL POP . This method assumes that the onMethodEntry modified code and returned immediately after visiting the target label of a trace guard .
25,186
private void visitFrameAfterMethodReturnCallback ( ) { if ( ! visitFramesAfterCallbacks ) return ; Type returnType = getReturnTypeForTrace ( ) ; if ( ! Type . VOID_TYPE . equals ( getReturnTypeForTrace ( ) ) && ! isConstructor ( ) ) { Object typeDescriptor = null ; switch ( returnType . getSort ( ) ) { case Type . BOOLEAN : case Type . BYTE : case Type . CHAR : case Type . INT : case Type . SHORT : typeDescriptor = INTEGER ; break ; case Type . DOUBLE : typeDescriptor = DOUBLE ; break ; case Type . FLOAT : typeDescriptor = FLOAT ; break ; case Type . LONG : typeDescriptor = LONG ; break ; default : typeDescriptor = returnType . getInternalName ( ) ; break ; } visitFrame ( F_SAME1 , 0 , null , 1 , new Object [ ] { typeDescriptor } ) ; } else { visitFrame ( F_SAME , 0 , null , 0 , null ) ; } }
Generate the stack frame that s needed after visiting the method exit trace guard target injected by tracing adapters .
25,187
public void visitTryCatchBlock ( Label start , Label end , Label handler , String type ) { if ( type != null ) { handlers . put ( handler , type ) ; } super . visitTryCatchBlock ( start , end , handler , type ) ; }
Visit a try catch block . We will use this to determine the exception handler labels for the try block .
25,188
public void visitLabel ( Label label ) { super . visitLabel ( label ) ; if ( waitingForSuper ) { if ( branchTargets . containsKey ( label ) ) { currentStack = branchTargets . get ( label ) ; } } else { pendingExceptionHandlerTypeName = handlers . get ( label ) ; } }
Visit a label . We will use this to determine when we ve reached an exception handler block .
25,189
public void visitFrame ( int type , int numLocals , Object [ ] locals , int stackSize , Object [ ] stack ) { if ( ! isVisitFrameRequired ( ) ) return ; super . visitFrame ( type , numLocals , locals , stackSize , stack ) ; }
Visit a stack map frame .
25,190
public void visitLocalVariable ( String name , String desc , String signature , Label start , Label end , int index ) { if ( index < firstNonParameterSlot ) { start = methodEntryLabel ; } super . visitLocalVariable ( name , desc , signature , start , end , index ) ; }
Visit a local variable . We will use this to change the start label for method parameters references .
25,191
protected void createTraceArrayForParameters ( ) { int localVarOffset = isStatic ? 0 : 1 ; int syntheticArgs = 0 ; if ( isConstructor ( ) && getClassAdapter ( ) . isInnerClass ( ) && argTypes . length > 1 ) { String className = getClassAdapter ( ) . getClassInternalName ( ) ; String ownerName = className . substring ( 0 , className . lastIndexOf ( "$" ) ) ; if ( Type . getObjectType ( ownerName ) . equals ( argTypes [ 0 ] ) ) { syntheticArgs = 1 ; } } visitLdcInsn ( new Integer ( argTypes . length - syntheticArgs ) ) ; visitTypeInsn ( ANEWARRAY , "java/lang/Object" ) ; for ( int i = syntheticArgs ; i < argTypes . length ; i ++ ) { int j = i + localVarOffset ; visitInsn ( DUP ) ; visitLdcInsn ( new Integer ( i - syntheticArgs ) ) ; boxLocalVar ( argTypes [ i ] , j , isArgumentSensitive ( i ) ) ; visitInsn ( AASTORE ) ; localVarOffset += argTypes [ i ] . getSize ( ) - 1 ; } }
Create an object array that contains references to the method parameters . Primitives will be boxed and parameters that have been annotated as sensitive will only have their class type traced . On exit the Object array will be on the top of the stack .
25,192
protected void boxLocalVar ( final Type type , final int slot , final boolean isSensitive ) { visitVarInsn ( type . getOpcode ( ILOAD ) , slot ) ; box ( type , isSensitive ) ; }
Generate the instruction sequence needed to box the local variable if required .
25,193
protected void visitGetTraceObjectField ( ) { visitFieldInsn ( GETSTATIC , classAdapter . getClassInternalName ( ) , classAdapter . getTraceObjectFieldName ( ) , classAdapter . getTraceObjectFieldType ( ) . getDescriptor ( ) ) ; }
Load the trace object field onto the top of the stack .
25,194
protected void visitSetTraceObjectField ( ) { visitFieldInsn ( PUTSTATIC , classAdapter . getClassInternalName ( ) , classAdapter . getTraceObjectFieldName ( ) , classAdapter . getTraceObjectFieldType ( ) . getDescriptor ( ) ) ; }
Set the trace object field from the reference on the top of the stack .
25,195
protected boolean isArgumentSensitive ( int index ) { if ( methodInfo != null ) { return methodInfo . isArgSensitive ( index ) ; } Set < Type > parameterAnnotations = observedParameterAnnotations . get ( index ) ; if ( parameterAnnotations != null ) { return parameterAnnotations . contains ( SENSITIVE_TYPE ) ; } return false ; }
Determine if the introspection or trace configuration for this method indicates that the specified method parameter is sensitive .
25,196
protected boolean isMethodInstrumentedByThisAdapter ( ) { if ( injectedTraceAnnotationVisitor == null ) { return false ; } List < String > visitedMethodAdapters = injectedTraceAnnotationVisitor . getMethodAdapters ( ) ; return visitedMethodAdapters . contains ( getClass ( ) . getName ( ) ) ; }
Determine if the method being processed has already had trace points automatically injected by this method adapter .
25,197
@ Reference ( name = THREAD_CONTEXT_PROVIDER , service = ThreadContextProvider . class , cardinality = ReferenceCardinality . MULTIPLE , policy = ReferencePolicy . DYNAMIC , policyOption = ReferencePolicyOption . GREEDY ) protected void setThreadContextProvider ( ServiceReference < ThreadContextProvider > ref ) { String threadContextProviderName = ( String ) ref . getProperty ( COMPONENT_NAME ) ; threadContextProviders . putReference ( threadContextProviderName , ref ) ; if ( Boolean . TRUE . equals ( ref . getProperty ( ThreadContextProvider . ALWAYS_CAPTURE_THREAD_CONTEXT ) ) ) alwaysEnabled . add ( threadContextProviderName ) ; }
Declarative Services method for adding a thread context provider .
25,198
protected void unsetThreadContextProvider ( ServiceReference < ThreadContextProvider > ref ) { String threadContextProviderName = ( String ) ref . getProperty ( COMPONENT_NAME ) ; if ( threadContextProviders . removeReference ( threadContextProviderName , ref ) && Boolean . TRUE . equals ( ref . getProperty ( ThreadContextProvider . ALWAYS_CAPTURE_THREAD_CONTEXT ) ) ) alwaysEnabled . remove ( threadContextProviderName ) ; }
Declarative Services method for removing a thread context provider .
25,199
public static boolean containsContentType ( String contentType , String [ ] allowedContentTypes ) { if ( allowedContentTypes == null ) { return false ; } for ( int i = 0 ; i < allowedContentTypes . length ; i ++ ) { if ( allowedContentTypes [ i ] . indexOf ( contentType ) != - 1 ) { return true ; } } return false ; }
Indicate if the passes content type match one of the options passed .