idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,900
private boolean equivFields ( JSField one , JSField two ) { if ( one instanceof JSDynamic ) { return two instanceof JSDynamic ; } else if ( one instanceof JSEnum ) { return two instanceof JSEnum ; } else if ( one instanceof JSPrimitive ) { return ( two instanceof JSPrimitive ) && ( ( JSPrimitive ) one ) . getTypeCode ( ) == ( ( JSPrimitive ) two ) . getTypeCode ( ) ; } else if ( one instanceof JSVariant ) { // we assume without checking that JSVariants in this context must be boxed return ( two instanceof JSVariant ) && ( ( JSVariant ) one ) . getBoxed ( ) . getID ( ) == ( ( JSVariant ) two ) . getBoxed ( ) . getID ( ) ; } else return false ; }
here is too specialized .
193
5
161,901
int reallocate ( int fieldOffset ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "reallocate" , new Object [ ] { Integer . valueOf ( offset ) } ) ; byte [ ] oldContents = contents ; int oldOffset = offset ; contents = new byte [ length ] ; System . arraycopy ( oldContents , offset , contents , 0 , length ) ; offset = 0 ; int result = fieldOffset - oldOffset ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "reallocate" , Integer . valueOf ( result ) ) ; return result ; }
Reallocate the entire contents buffer
166
7
161,902
void reallocated ( byte [ ] newContents , int newOffset ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "reallocated" , new Object [ ] { newContents , Integer . valueOf ( newOffset ) } ) ; if ( contents != null ) { contents = newContents ; offset = newOffset + 8 ; sharedContents = false ; // Now we must run through the cache any pass the changes down to any depenedent // JSMessageData parts we find. // d282049: respect implicit state invariant implied by JSMessageData#unassemble // that an unassembled List can have no assembled contents if ( cache != null ) { for ( int i = 0 ; i < cache . length ; i ++ ) { try { Object entry = cache [ i ] ; if ( entry != null && entry instanceof JSMessageData ) { ( ( JSMessageData ) entry ) . reallocated ( newContents , getAbsoluteOffset ( i ) ) ; } } catch ( JMFUninitializedAccessException e ) { // No FFDC code needed - this cannot occur as we know the JSMessageData part is present } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "reallocated" ) ; }
JSMessageData items currently in the cache .
309
10
161,903
static int getSize ( Object agg ) throws JMFSchemaViolationException { if ( agg == null ) { return 0 ; } else if ( agg instanceof Collection ) { return ( ( Collection ) agg ) . size ( ) ; } else if ( agg . getClass ( ) . isArray ( ) ) { return Array . getLength ( agg ) ; } else { throw new JMFSchemaViolationException ( agg . getClass ( ) . getName ( ) ) ; } }
Get the size of an aggregate that may be either an array or a Collection
103
15
161,904
static Iterator getIterator ( Object agg ) throws JMFSchemaViolationException { if ( agg instanceof Collection ) { return ( ( Collection ) agg ) . iterator ( ) ; } else if ( agg . getClass ( ) . isArray ( ) ) { return new LiteIterator ( agg ) ; } else { throw new JMFSchemaViolationException ( agg . getClass ( ) . getName ( ) ) ; } }
Get an Iterator over an aggregate that may be either an array or a Collection
91
16
161,905
public AppValidator failsWith ( String expectedFailure ) { stringsToFind . add ( expectedFailure ) ; stringsToFind . add ( APP_FAIL_CODE ) ; server . addIgnoredErrors ( Collections . singletonList ( expectedFailure ) ) ; return this ; }
Specify that the app should fail to start and that the given failure message should be seen during app startup
60
21
161,906
private int acquireExpedite ( ) { int a ; while ( ( a = expeditesAvailable . get ( ) ) > 0 && ! expeditesAvailable . compareAndSet ( a , a - 1 ) ) ; return a ; // returning the value rather than true/false will enable better debug }
Attempt to acquire a permit to expedite which involves decrementing the available expedites . Only allow decrement of a positive value and otherwise indicate there are no available expedites .
62
36
161,907
@ Trivial private void decrementWithheldConcurrency ( ) { int w ; while ( ( w = withheldConcurrency . get ( ) ) > 0 && ! withheldConcurrency . compareAndSet ( w , w - 1 ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "withheld concurrency " + w + " --> " + ( w == 0 ? 0 : ( w - 1 ) ) ) ; }
Decrement the counter of withheld concurrency only if positive . This method should only ever be invoked if the caller is about to enqueue a task to the global executor . Otherwise there is a risk of a race condition where withheldConcurrency decrements to 0 with a task still on the queue .
109
60
161,908
@ Override @ FFDCIgnore ( value = { RejectedExecutionException . class } ) public < T > T invokeAny ( Collection < ? extends Callable < T > > tasks , PolicyTaskCallback [ ] callbacks ) throws InterruptedException , ExecutionException { int taskCount = tasks . size ( ) ; // Special case to run a single task on the current thread if we can acquire a permit, if a permit is required if ( taskCount == 1 ) { boolean havePermit = false ; if ( maxPolicy == MaxPolicy . loose || ( havePermit = maxConcurrencyConstraint . tryAcquire ( ) ) ) // use current thread try { if ( state . get ( ) != State . ACTIVE ) throw new RejectedExecutionException ( Tr . formatMessage ( tc , "CWWKE1202.submit.after.shutdown" , identifier ) ) ; // startTimeout does not apply because the task starts immediately PolicyTaskFutureImpl < T > taskFuture = new PolicyTaskFutureImpl < T > ( this , tasks . iterator ( ) . next ( ) , callbacks == null ? null : callbacks [ 0 ] , - 1 ) ; taskFuture . accept ( true ) ; runTask ( taskFuture ) ; // raise InterruptedException if current thread is interrupted taskFuture . throwIfInterrupted ( ) ; return taskFuture . get ( ) ; } finally { if ( havePermit ) transferOrReleasePermit ( ) ; } } else if ( taskCount == 0 ) throw new IllegalArgumentException ( ) ; InvokeAnyLatch latch = new InvokeAnyLatch ( taskCount ) ; ArrayList < PolicyTaskFutureImpl < T > > futures = new ArrayList < PolicyTaskFutureImpl < T > > ( taskCount ) ; try { // create futures in advance, which gives the callback an opportunity to reject int t = 0 ; for ( Callable < T > task : tasks ) { PolicyTaskCallback callback = callbacks == null ? null : callbacks [ t ++ ] ; PolicyExecutorImpl executor = callback == null ? this : ( PolicyExecutorImpl ) callback . getExecutor ( this ) ; long startTimeoutNS = callback == null ? startTimeout : callback . getStartTimeout ( executor . startTimeout ) ; futures . add ( new PolicyTaskFutureImpl < T > ( executor , task , callback , startTimeoutNS , latch ) ) ; } // enqueue all tasks for ( PolicyTaskFutureImpl < T > taskFuture : futures ) { // check if done before enqueuing more tasks if ( latch . getCount ( ) == 0 ) break ; taskFuture . executor . enqueue ( taskFuture , taskFuture . executor . maxWaitForEnqueueNS . get ( ) , false ) ; // never run on the current thread because it would prevent timeout } // wait for completion return latch . await ( - 1 , futures ) ; } catch ( RejectedExecutionException x ) { if ( x . getCause ( ) instanceof InterruptedException ) { throw ( InterruptedException ) x . getCause ( ) ; } else throw x ; } catch ( TimeoutException x ) { throw new RuntimeException ( x ) ; // should be unreachable with infinite timeout } finally { for ( Future < ? > f : futures ) f . cancel ( true ) ; } }
Because this method is not timed we allow an optimization where if only a single task is submitted it can run on the current thread .
702
26
161,909
void runTask ( PolicyTaskFutureImpl < ? > future ) { running . add ( future ) ; // intentionally done before checking state to avoid missing cancels on shutdownNow int runCount = runningCount . incrementAndGet ( ) ; try { Callback callback = cbLateStart . get ( ) ; if ( callback != null ) { long delay = future . nsQueueEnd - future . nsAcceptBegin ; if ( delay > callback . threshold && cbLateStart . compareAndSet ( callback , null ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "callback: late start " + delay + "ns > " + callback . threshold + "ns" , callback . runnable ) ; globalExecutor . submit ( callback . runnable ) ; } } callback = cbConcurrency . get ( ) ; if ( callback != null && runCount > callback . threshold && cbConcurrency . compareAndSet ( callback , null ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "callback: concurrency > " + callback . threshold , callback . runnable ) ; globalExecutor . submit ( callback . runnable ) ; } if ( state . get ( ) . canStartTask ) { future . run ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Cancel task due to policy executor state " + state ) ; future . nsRunEnd = System . nanoTime ( ) ; future . cancel ( false ) ; if ( future . callback != null ) future . callback . onEnd ( future . task , future , null , true , 0 , null ) ; // aborted, queued task will never run } } catch ( Error x ) { // auto FFDC } catch ( RuntimeException x ) { // auto FFDC } finally { runningCount . decrementAndGet ( ) ; running . remove ( future ) ; } }
Invoked by the policy executor thread to run a task .
453
13
161,910
@ Trivial private void transferOrReleasePermit ( ) { maxConcurrencyConstraint . release ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "expedites/maxConcurrency available" , expeditesAvailable , maxConcurrencyConstraint . availablePermits ( ) ) ; // The permit might be needed to run tasks on the global executor, if ( ! queue . isEmpty ( ) && withheldConcurrency . get ( ) > 0 && maxConcurrencyConstraint . tryAcquire ( ) ) { decrementWithheldConcurrency ( ) ; if ( acquireExpedite ( ) > 0 ) expediteGlobal ( new GlobalPoolTask ( ) ) ; else enqueueGlobal ( new GlobalPoolTask ( ) ) ; } }
Releases a permit against maxConcurrency or transfers it to a worker task that runs on the global thread pool .
179
23
161,911
public void closeConnection ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "closeConnection" ) ; try { if ( _XAResourceFactory != null && _XARes != null ) { ( ( XAResourceFactory ) _XAResourceFactory ) . destroyXAResource ( _XARes ) ; } } catch ( Throwable t ) { FFDCFilter . processException ( t , "com.ibm.ws.Transaction.JTA.XARminst.closeConnection" , "250" , this ) ; Tr . audit ( tc , "WTRN0038_ERR_DESTROYING_XARESOURCE" , t ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "closeConnection" ) ; }
Close the XAConnection with the XAResource .
179
14
161,912
protected VirtualConnection readInternal ( long numBytes , TCPReadCompletedCallback readCallback , boolean forceQueue , int timeout ) { if ( timeout == IMMED_TIMEOUT ) { immediateTimeout ( ) ; return null ; } if ( timeout == ABORT_TIMEOUT ) { abort ( ) ; immediateTimeout ( ) ; return null ; } setIOAmount ( numBytes ) ; setLastIOAmt ( 0 ) ; setIODoneAmount ( 0 ) ; setReadCompletedCallback ( readCallback ) ; setForceQueue ( forceQueue ) ; setTimeoutTime ( timeout ) ; // IMPROVEMENT: buffers should be preprocessed before calling read, // postprocessed after return processAsyncReadRequest ( ) ; }
internal async read entry point
149
5
161,913
public boolean isFileServingEnabled ( ) { // PK54499 START disallowAllFileServingProp = WCCustomProperties . DISALLOW_ALL_FILE_SERVING ; if ( disallowAllFileServingProp != null && ! this . getApplicationName ( ) . equalsIgnoreCase ( "isclite" ) ) { try { if ( Boolean . valueOf ( disallowAllFileServingProp ) . booleanValue ( ) ) { this . fileServingEnabled = Boolean . FALSE ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "isFileServing" , "PK54499: disallowAllFileServingProp set to " + disallowAllFileServingProp + " for application: " + this . getApplicationName ( ) ) ; } } catch ( Exception x ) { logger . logp ( Level . SEVERE , CLASS_NAME , "isFileServing" , "Illegal value set for property com.ibm.ws.webcontainer.disallowallfileserving" ) ; } } // PK54499 END if ( this . fileServingEnabled != null ) return this . fileServingEnabled . booleanValue ( ) ; return WCCustomProperties . FILE_SERVING_ENABLED ; }
Returns the fileServingEnabled .
313
7
161,914
public Map < String , String > getJspAttributes ( ) { if ( null == this . jspAttributes ) { this . jspAttributes = new HashMap < String , String > ( ) ; } return this . jspAttributes ; }
Returns the jspAttributes .
51
6
161,915
public IServletConfig getServletInfo ( String string ) { if ( string == null || string . isEmpty ( ) ) { Tr . debug ( tc , "getServletInfo" , "servlet name is null/empty. Use internal servlet name " + NULLSERVLETNAME ) ; string = NULLSERVLETNAME ; } return ( IServletConfig ) this . servletInfo . get ( string ) ; }
Method getServletInfo .
92
6
161,916
public boolean isServeServletsByClassnameEnabled ( ) { // PK52059 START disallowServeServletsByClassnameProp = WCCustomProperties . DISALLOW_SERVE_SERVLETS_BY_CLASSNAME_PROP ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "disallowServeServletsByClassnameProp = " + disallowServeServletsByClassnameProp ) ; } if ( disallowServeServletsByClassnameProp != null ) { try { if ( Boolean . valueOf ( disallowServeServletsByClassnameProp ) . booleanValue ( ) ) { this . serveServletsByClassnameEnabled = Boolean . FALSE ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "PK52059: disallowServeServletsByClassnameProp set to " + disallowServeServletsByClassnameProp + " for application: " + this . getApplicationName ( ) ) ; } } catch ( Exception x ) { logger . logp ( Level . SEVERE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "Illegal value set for property com.ibm.ws.webcontainer.disallowserveservletsbyclassname" ) ; } } // PK52059 END if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "value = " + ( this . serveServletsByClassnameEnabled != null ? this . serveServletsByClassnameEnabled . booleanValue ( ) : WCCustomProperties . SERVE_SERVLETS_BY_CLASSNAME_ENABLED ) ) ; } if ( this . serveServletsByClassnameEnabled != null ) return this . serveServletsByClassnameEnabled . booleanValue ( ) ; return WCCustomProperties . SERVE_SERVLETS_BY_CLASSNAME_ENABLED ; }
Returns the serveServletsByClassname .
562
9
161,917
public void setMimeFilters ( HashMap mimeFilters ) { if ( mimeFilters != null && mimeFilters . size ( ) > 0 ) { this . isMimeFilteringEnabled = true ; } this . mimeFilters = mimeFilters ; }
Sets the mimeFilters .
62
8
161,918
public String getApplicationName ( ) { if ( this . applicationName != null ) return this . applicationName ; else if ( webApp != null ) return this . webApp . getApplicationName ( ) ; else return null ; }
Return the applicationName .
48
5
161,919
public void setDisableStaticMappingCache ( ) { if ( this . contextParams != null ) { String value = ( String ) this . contextParams . get ( "com.ibm.ws.webcontainer.DISABLE_STATIC_MAPPING_CACHE" ) ; if ( value != null ) { if ( value . equalsIgnoreCase ( "true" ) ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "setDisableStaticMappingCache" , "cxtParam disable static mapping cache for application -> " + applicationName ) ; this . setDisableStaticMappingCache ( true ) ; } return ; } } if ( WCCustomProperties . DISABLE_STATIC_MAPPING_CACHE != null ) { String disableStaticMappingCacheApp = WCCustomProperties . DISABLE_STATIC_MAPPING_CACHE ; if ( disableStaticMappingCacheApp . equals ( "*" ) ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "setDisableStaticMappingCache" , "disable static mapping cache for all apps." ) ; this . setDisableStaticMappingCache ( true ) ; return ; } else { String [ ] parsedStr = disableStaticMappingCacheApp . split ( "," ) ; for ( String toCheckStr : parsedStr ) { toCheckStr = toCheckStr . trim ( ) ; if ( applicationName != null && applicationName . equalsIgnoreCase ( toCheckStr ) ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "setDisableStaticMappingCache" , "disable static mapping cache for application -> " + applicationName ) ; this . setDisableStaticMappingCache ( true ) ; return ; } } } } }
PM84305 - start
493
5
161,920
public final void insertNullElementsAt ( int index , int count ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "insertNullElementsAt" , new Object [ ] { new Integer ( index ) , new Integer ( count ) } ) ; for ( int i = index ; i < index + count ; i ++ ) add ( i , null ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "insertNullElementsAt" ) ; }
Inserts count null values at index moving up all the components at index and greater .
112
17
161,921
protected void validatePattern ( ) { if ( pattern . length ( ) == 0 ) { throw new IllegalArgumentException ( Tr . formatMessage ( tc , "OPENTRACING_FILTER_PATTERN_BLANK" ) ) ; } if ( ! regex ) { try { URI . create ( pattern ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( Tr . formatMessage ( tc , "OPENTRACING_FILTER_PATTERN_INVALID" , pattern ) , e ) ; } } }
Throw exceptions if the pattern is invalid .
120
8
161,922
protected final String prepareUri ( final URI uri ) { if ( compareRelative ) { final String path = uri . getRawPath ( ) ; final String query = uri . getRawQuery ( ) ; final String fragment = uri . getRawFragment ( ) ; if ( query != null && fragment != null ) { return path + "?" + query + "#" + fragment ; } else if ( query != null ) { return path + "?" + query ; } else if ( fragment != null ) { return path + "#" + fragment ; } else { return path ; } } else { return uri . toString ( ) ; } }
Prepare the URI for matching .
139
7
161,923
public String readText ( String prompt ) { if ( ! isInputStreamAvailable ( ) ) { return null ; } try { return console . readLine ( prompt ) ; } catch ( IOError e ) { stderr . println ( "Exception while reading stdin: " + e . getMessage ( ) ) ; e . printStackTrace ( stderr ) ; } return null ; }
Reads text from the input String prompting with the given String .
83
13
161,924
public synchronized int add ( E object ) { if ( object == null ) throw new NullPointerException ( "FastList add called with null" ) ; if ( ( count + 1 ) >= maxCount ) resize ( capacity * 2 ) ; int initialAddIndex = addIndex ; // find right spot to add to - start with addIndex and look // for first open spot. give up if we get back to initialAddIndex while ( listElements [ addIndex ] != null ) { addIndex ++ ; if ( addIndex == capacity ) addIndex = 0 ; if ( addIndex == initialAddIndex ) { // should not happen - we should have resized if we needed more // capacity throw new RuntimeException ( "FastList out of space" ) ; } } count ++ ; listElements [ addIndex ] = object ; return addIndex ; }
Adds specified object to the list and increments size
177
9
161,925
public synchronized List < E > getAll ( ) { ArrayList < E > list = new ArrayList < E > ( ) ; for ( E element : listElements ) { if ( element != null ) { list . add ( element ) ; } } return list ; }
Provides a shallow copy of the list
57
8
161,926
public Object [ ] addAll ( CacheMap c ) { LinkedList < Object > discards = new LinkedList < Object > ( ) ; Object discard ; for ( int bucketIndex = c . next [ c . BEFORE_LRU ] ; bucketIndex != c . AFTER_MRU ; bucketIndex = c . next [ bucketIndex ] ) for ( int i = 0 ; i < c . bucketSizes [ bucketIndex ] ; i ++ ) if ( ( discard = add ( c . keys [ bucketIndex ] [ i ] , c . values [ bucketIndex ] [ i ] ) ) != null ) discards . add ( discard ) ; return discards . toArray ( ) ; }
Inserts into this CacheMap all entries from the specified CacheMap returning a list of any values that do not fit .
146
24
161,927
private Object discardFromBucket ( int bucketIndex , int entryIndex ) { numDiscards ++ ; bucketSizes [ bucketIndex ] -- ; numEntries -- ; return values [ bucketIndex ] [ entryIndex ] ; }
Discard an entry from the specified bucket . The actual entry is not nulled out because it will later be overwritten .
47
25
161,928
int addRef ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addRef" ) ; int ret = NOP ; // If this is a new subscription, then the operation is to subscribe. if ( _refCount ++ == 0 ) ret = SUBSCRIBE ; checkRefCount ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addRef" , String . valueOf ( ret ) + ":" + String . valueOf ( _refCount ) ) ; return ret ; }
Adds a reference to the subscription .
145
7
161,929
int removeRef ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeRef" ) ; int ret = NOP ; // If this is the last reference, then the operation is unsubscribe. if ( -- _refCount == 0 ) ret = UNSUBSCRIBE ; checkRefCount ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeRef" , String . valueOf ( ret ) + ":" + String . valueOf ( _refCount ) ) ; return ret ; }
Removes a reference to the subscription .
146
8
161,930
final String getTopic ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopic" ) ; SibTr . exit ( tc , "getTopic" , _topic ) ; } return _topic ; }
Returns the value of the topic .
66
7
161,931
final SIBUuid12 getTopicSpaceUuid ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopicSpaceUuid" ) ; SibTr . exit ( tc , "getTopicSpaceUuid" , _topicSpaceUuid ) ; } return _topicSpaceUuid ; }
Returns the value of the topic space uuid .
85
10
161,932
final String getTopicSpaceName ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopicSpaceName" ) ; SibTr . exit ( tc , "getTopicSpaceName" , _topicSpaceName ) ; } return _topicSpaceName ; }
Returns the value of the topic space name .
76
9
161,933
final String getMESubUserId ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getMESubUserId" ) ; SibTr . exit ( tc , "getMESubUserId" , _meSubUserId ) ; } return _meSubUserId ; }
Returns the value of the userid associated with the subscription .
84
12
161,934
final boolean isForeignSecuredProxy ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isForeignSecuredProxy" ) ; SibTr . exit ( tc , "isForeignSecuredProxy" , new Boolean ( _foreignSecuredProxy ) ) ; } return _foreignSecuredProxy ; }
Returns true if this proxy sub was from a foreign bus in a secured env .
85
16
161,935
void mark ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "mark" ) ; SibTr . exit ( tc , "mark" ) ; } _marked = true ; }
Marks this object .
60
5
161,936
void unmark ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "unmark" ) ; SibTr . exit ( tc , "unmark" ) ; } _marked = false ; }
Unmarks this object .
63
5
161,937
boolean isMarked ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isMarked" ) ; SibTr . exit ( tc , "isMarked" , new Boolean ( _marked ) ) ; } return _marked ; }
Is Marked indicates if this object is still marked . If it is then it can be removed .
73
20
161,938
protected void registerForPostCommit ( MultiMEProxyHandler proxyHandler , DestinationHandler destination , PubSubOutputHandler handler , Neighbour neighbour ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerForPostCommit" , new Object [ ] { proxyHandler , destination , handler , neighbour } ) ; _proxyHandler = proxyHandler ; _destination = destination ; _handler = handler ; _neighbour = neighbour ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerForPostCommit" ) ; }
Sets the information in the subscription so that when a commit is called it can resolve the correct objects to add items to the MatchSpace .
147
28
161,939
protected void registerForPostCommit ( Neighbour neighbour , Neighbours neighbours ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerForPostCommit" , new Object [ ] { neighbour , neighbours } ) ; _proxyHandler = null ; _destination = null ; _handler = null ; _neighbour = neighbour ; _neighbours = neighbours ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerForPostCommit" ) ; }
Used only for rollback - if the transaction is rolled back and there is a neighbour set then rmeove the proxy reference .
137
26
161,940
public void eventPostRollbackAdd ( Transaction transaction ) throws SevereMessageStoreException { super . eventPostRollbackAdd ( transaction ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "eventPostRollbackAdd" , transaction ) ; if ( _handler != null ) { _handler . removeTopic ( _topic ) ; // If this was the last topic reference, then delete the PubSub output // handler. if ( _handler . getTopics ( ) == null || _handler . getTopics ( ) . length == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Deleting PubSubOutputHandler " + _handler ) ; _destination . deletePubSubOutputHandler ( _neighbour . getUUID ( ) ) ; } } else if ( _neighbours != null ) _neighbours . removeTopicSpaceReference ( _neighbour . getUUID ( ) , this , _topicSpaceUuid , _topic ) ; // Remove the subscription from the list. _neighbour . removeSubscription ( _topicSpaceUuid , _topic ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventPostRollbackAdd" ) ; }
When the add rollback is made need to remove the topic . Or the topicSpace reference needs to be removed .
308
23
161,941
public void eventPostCommitUpdate ( Transaction transaction ) throws SevereMessageStoreException { super . eventPostCommitAdd ( transaction ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "eventPostCommitUpdate" , transaction ) ; // Remove the current CPS from the MatchSpace if ( _proxyHandler != null ) { _destination . getSubscriptionIndex ( ) . remove ( _controllableProxySubscription ) ; _proxyHandler . getMessageProcessor ( ) . getMessageProcessorMatching ( ) . removePubSubOutputHandlerMatchTarget ( _controllableProxySubscription ) ; } // Add the CPS to the MatchSpace. try { if ( _proxyHandler != null ) { _controllableProxySubscription = _proxyHandler . getMessageProcessor ( ) . getMessageProcessorMatching ( ) . addPubSubOutputHandlerMatchTarget ( _handler , _topicSpaceUuid , _topic , _foreignSecuredProxy , _meSubUserId ) ; } } catch ( SIException e ) { // FFDC FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.proxyhandler.MESubscription.eventPostCommitUpdate" , "1:738:1.55" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription" , "1:745:1.55" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventPostCommitUpdate" , "SIErrorException" ) ; // An error at this point is very bad ! throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription" , "1:755:1.55" , e } , null ) , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventPostCommitUpdate" ) ; }
Updates the ControllableProxySubscription .
543
10
161,942
public void setMatchspaceSub ( ControllableProxySubscription sub ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setMatchspaceSub" , sub ) ; _controllableProxySubscription = sub ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setMatchspaceSub" ) ; }
This sets the field in the MESubscription for the object that was stored in the Matchspace
103
20
161,943
public ControllableProxySubscription getMatchspaceSub ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getMatchspaceSub" ) ; SibTr . exit ( tc , "getMatchspaceSub" , _controllableProxySubscription ) ; } return _controllableProxySubscription ; }
Gets the object that was stored in the Matchspace
87
11
161,944
public final AbstractItem findById ( long itemId ) throws SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "findById" , Long . valueOf ( itemId ) ) ; AbstractItem item = null ; ReferenceCollection ic = ( ( ReferenceCollection ) _getMembership ( ) ) ; if ( null == ic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findById" ) ; throw new NotInMessageStore ( ) ; // Defect 489210 } item = ic . findById ( itemId ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findById" , item ) ; return item ; }
Reply the item in the receiver with a matching ID . The item returned stream is neither removed from the message store nor locked for exclusive use of the caller .
201
31
161,945
public final ItemReference findOldestReference ( ) throws MessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "findOldestReference" ) ; ReferenceCollection ic = ( ( ReferenceCollection ) _getMembership ( ) ) ; if ( null == ic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findOldestReference" ) ; throw new NotInMessageStore ( ) ; } ItemReference item = null ; if ( ic != null ) { item = ( ItemReference ) ic . findOldestItem ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findOldestReference" , item ) ; return item ; }
Find the reference that has been known to the stream for longest . The reference returned may be in any of the states defined in the state model . The caller should not assume that the reference can be used for any particular purpose .
201
45
161,946
private void publishEvent ( WSJobExecution jobEx , String topicToPublish , String correlationId ) { if ( eventsPublisher != null ) { eventsPublisher . publishJobExecutionEvent ( jobEx , topicToPublish , correlationId ) ; } }
Helper method to publish event
54
5
161,947
private void publishEvent ( WSJobInstance jobInst , String topicToPublish , String correlationId ) { if ( eventsPublisher != null ) { eventsPublisher . publishJobInstanceEvent ( jobInst , topicToPublish , correlationId ) ; } }
Helper method to publish event with correlationId
52
8
161,948
private long restartInternal ( long oldExecutionId , Properties restartParameters ) throws JobExecutionAlreadyCompleteException , NoSuchJobExecutionException , JobExecutionNotMostRecentException , JobRestartException , JobSecurityException { if ( authService != null ) { authService . authorizedJobRestartByExecution ( oldExecutionId ) ; } if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "JobOperator restart, with old executionId = " + oldExecutionId + "\n" + traceJobParameters ( restartParameters ) ) ; } //Check if there are no job executions and step executions running. BatchStatusValidator . validateStatusAtExecutionRestart ( oldExecutionId , restartParameters ) ; //Set instance state to submitted to be consistent with start long instanceId = getPersistenceManagerService ( ) . getJobInstanceIdFromExecutionId ( oldExecutionId ) ; getPersistenceManagerService ( ) . updateJobInstanceOnRestart ( instanceId , new Date ( ) ) ; WSJobExecution jobExecution = getPersistenceManagerService ( ) . createJobExecution ( instanceId , restartParameters , new Date ( ) ) ; long newExecutionId = getBatchKernelService ( ) . restartJob ( jobExecution . getExecutionId ( ) , restartParameters ) . getKey ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "Restarted job with new executionId: " + newExecutionId + ", and old executionID: " + oldExecutionId ) ; } return newExecutionId ; }
Restart the given execution using the given jobparams .
352
11
161,949
private void getMessageDigestMD5 ( ) throws AttributeNotFoundException { if ( MBeans . messageDigestMD5 == null ) { try { MBeans . messageDigestMD5 = MessageDigestUtility . createMessageDigest ( "MD5" ) ; } catch ( NoSuchAlgorithmException e ) { Tr . error ( tc , "DYNA1044E" , new Object [ ] { e . getMessage ( ) } ) ; throw new AttributeNotFoundException ( "Message digest for MD5 is not available. " + e . getMessage ( ) ) ; } } }
create messageDigest for MD5 algoritm if it is not created .
132
17
161,950
@ Override @ Trivial public Map < String , ExtendedAttributeDefinition > getAttributeMap ( ) { Map < String , ExtendedAttributeDefinition > map = null ; AttributeDefinition [ ] attrDefs = getAttributeDefinitions ( ObjectClassDefinition . ALL ) ; if ( attrDefs != null ) { map = new HashMap < String , ExtendedAttributeDefinition > ( ) ; for ( AttributeDefinition attrDef : attrDefs ) { map . put ( attrDef . getID ( ) , new ExtendedAttributeDefinitionImpl ( attrDef ) ) ; } } else { map = Collections . emptyMap ( ) ; } return map ; }
ONLY USED BY SCHEMA WRITER
139
10
161,951
private static String getAliasName ( String alias , String bundleLocation ) { String newAlias = alias ; if ( alias != null && ! alias . isEmpty ( ) ) { try { if ( bundleLocation != null && ! bundleLocation . isEmpty ( ) ) { if ( bundleLocation . startsWith ( XMLConfigConstants . BUNDLE_LOC_KERNEL_TAG ) ) { // nothing to do. The alias is returned. } else if ( bundleLocation . startsWith ( XMLConfigConstants . BUNDLE_LOC_FEATURE_TAG ) ) { // Check for the presence of a product extension location. int index = bundleLocation . indexOf ( XMLConfigConstants . BUNDLE_LOC_PROD_EXT_TAG ) ; if ( index != - 1 ) { index += XMLConfigConstants . BUNDLE_LOC_PROD_EXT_TAG . length ( ) ; int endIndex = bundleLocation . indexOf ( ":" , index ) ; String productName = bundleLocation . substring ( index , endIndex ) ; newAlias = productName + "_" + alias ; } } else if ( bundleLocation . startsWith ( XMLConfigConstants . BUNDLE_LOC_CONNECTOR_TAG ) ) { // nothing to do. The alias is returned. } else { // Unknown location. Ignore the alias. If bundles are installed through fileInstall, // bundle resolution should happen through the pid or factoryPid. newAlias = null ; } } } catch ( Throwable t ) { // An exception here would be bad. Need an ffdc. } } return newAlias ; }
Prefixes the alias with the product extension name if there is a product extension associated to this OCD .
347
21
161,952
@ Trivial private static byte [ ] getBytes ( InputStream stream , int knownSize ) throws IOException { try { if ( knownSize == - 1 ) { ByteArrayOutputStream byteOut = new ByteArrayOutputStream ( ) ; try { byte [ ] bytes = new byte [ 1024 ] ; int read ; while ( 0 <= ( read = stream . read ( bytes ) ) ) byteOut . write ( bytes , 0 , read ) ; return byteOut . toByteArray ( ) ; } finally { Util . tryToClose ( byteOut ) ; } } else { byte [ ] bytes = new byte [ knownSize ] ; int read ; int offset = 0 ; while ( knownSize > 0 && ( read = stream . read ( bytes , offset , knownSize ) ) > 0 ) { offset += read ; knownSize -= read ; } return bytes ; } } finally { Util . tryToClose ( stream ) ; } }
Util method to totally read an input stream into a byte array . Used for class definition .
196
19
161,953
static URL getSharedClassCacheURL ( URL resourceURL , String resourceName ) { URL sharedClassCacheURL ; if ( resourceURL == null ) { sharedClassCacheURL = null ; } else { String protocol = resourceURL . getProtocol ( ) ; if ( "jar" . equals ( protocol ) ) { sharedClassCacheURL = resourceURL ; } else if ( "wsjar" . equals ( protocol ) ) { try { sharedClassCacheURL = new URL ( resourceURL . toExternalForm ( ) . substring ( 2 ) ) ; } catch ( MalformedURLException e ) { sharedClassCacheURL = null ; } } else if ( ! "file" . equals ( protocol ) ) { sharedClassCacheURL = null ; } else { String externalForm = resourceURL . toExternalForm ( ) ; if ( externalForm . endsWith ( resourceName ) ) { try { sharedClassCacheURL = new URL ( externalForm . substring ( 0 , externalForm . length ( ) - resourceName . length ( ) ) ) ; } catch ( MalformedURLException e ) { sharedClassCacheURL = null ; } } else { sharedClassCacheURL = null ; } } } return sharedClassCacheURL ; }
Computes the shared class cache URL from the resource URL .
260
12
161,954
public Package definePackage ( String name , Manifest manifest , URL sealBase ) throws IllegalArgumentException { Attributes mA = manifest . getMainAttributes ( ) ; String specTitle = mA . getValue ( Name . SPECIFICATION_TITLE ) ; String specVersion = mA . getValue ( Name . SPECIFICATION_VERSION ) ; String specVendor = mA . getValue ( Name . SPECIFICATION_VENDOR ) ; String implTitle = mA . getValue ( Name . IMPLEMENTATION_TITLE ) ; String implVersion = mA . getValue ( Name . IMPLEMENTATION_VERSION ) ; String implVendor = mA . getValue ( Name . IMPLEMENTATION_VENDOR ) ; String sealedString = mA . getValue ( Name . SEALED ) ; Boolean sealed = ( sealedString == null ? Boolean . FALSE : sealedString . equalsIgnoreCase ( "true" ) ) ; //now overwrite global attributes with the specific attributes String unixName = name . replaceAll ( "\\." , "/" ) + "/" ; //replace all dots with slash and add trailing slash mA = manifest . getAttributes ( unixName ) ; if ( mA != null ) { String s = mA . getValue ( Name . SPECIFICATION_TITLE ) ; if ( s != null ) specTitle = s ; s = mA . getValue ( Name . SPECIFICATION_VERSION ) ; if ( s != null ) specVersion = s ; s = mA . getValue ( Name . SPECIFICATION_VENDOR ) ; if ( s != null ) specVendor = s ; s = mA . getValue ( Name . IMPLEMENTATION_TITLE ) ; if ( s != null ) implTitle = s ; s = mA . getValue ( Name . IMPLEMENTATION_VERSION ) ; if ( s != null ) implVersion = s ; s = mA . getValue ( Name . IMPLEMENTATION_VENDOR ) ; if ( s != null ) implVendor = s ; s = mA . getValue ( Name . SEALED ) ; if ( s != null ) sealed = s . equalsIgnoreCase ( "true" ) ; } if ( ! sealed ) sealBase = null ; return definePackage ( name , specTitle , specVersion , specVendor , implTitle , implVersion , implVendor , sealBase ) ; }
to set vars passed up to ClassLoader . definePackage .
518
13
161,955
protected void addToClassPath ( Iterable < ArtifactContainer > artifacts ) { for ( ArtifactContainer art : artifacts ) { smartClassPath . addArtifactContainer ( art ) ; } }
Add all the artifact containers to the class path
39
9
161,956
@ FFDCIgnore ( NullPointerException . class ) protected void addLibraryFile ( File f ) { if ( ! ! ! f . exists ( ) ) { if ( tc . isWarningEnabled ( ) ) { Tr . warning ( tc , "cls.library.archive" , f , new FileNotFoundException ( f . getName ( ) ) ) ; } return ; } // Skip files that are not archives of some sort. if ( ! f . isDirectory ( ) && ! isArchive ( f ) ) return ; //this area subject to refactor following shared lib rework.. //ideally the shared lib code will start passing us ArtifactContainers, and it //will own the management of the ACF via DS. //NASTY.. need to use DS to get the ACF, not OSGi backdoor ;p BundleContext bc = FrameworkUtil . getBundle ( ContainerClassLoader . class ) . getBundleContext ( ) ; ServiceReference < ArtifactContainerFactory > acfsr = bc . getServiceReference ( ArtifactContainerFactory . class ) ; if ( acfsr != null ) { ArtifactContainerFactory acf = bc . getService ( acfsr ) ; if ( acf != null ) { //NASTY.. using this bundle as the cache dir location for the data file.. try { ArtifactContainer ac = acf . getContainer ( bc . getBundle ( ) . getDataFile ( "" ) , f ) ; smartClassPath . addArtifactContainer ( ac ) ; } catch ( NullPointerException e ) { // TODO completed under task 74097 if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception while adding files to classpath" , e ) ; } if ( tc . isInfoEnabled ( ) ) { Tr . info ( tc , "cls.library.file.forbidden" , f ) ; } } } } }
Method to allow adding shared libraries to this classloader currently using File .
404
14
161,957
@ FFDCIgnore ( PrivilegedActionException . class ) private boolean isArchive ( File f ) { final File target = f ; try { AccessController . doPrivileged ( new PrivilegedExceptionAction < Void > ( ) { @ Override public Void run ( ) throws IOException { new ZipFile ( target ) . close ( ) ; return null ; } } ) ; } catch ( PrivilegedActionException e ) { Exception innerException = e . getException ( ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The following file can not be added to the classpath " + f + " due to error " , innerException ) ; } return false ; } return true ; }
Check that a file is an archive
152
7
161,958
public static ComponentMetaData getComponentMetaData ( JavaColonNamespace namespace , String name ) throws NamingException { ComponentMetaData cmd = ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . getComponentMetaData ( ) ; if ( cmd == null ) { String fullName = name . isEmpty ( ) ? namespace . toString ( ) : namespace + "/" + name ; String msg = Tr . formatMessage ( tc , "JNDI_NON_JEE_THREAD_CWWKN0100E" , fullName ) ; NamingException nex = new NamingException ( msg ) ; throw nex ; } return cmd ; }
Helper method to get the component metadata from the thread context .
143
12
161,959
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE ) protected Map < String , Object > setConfiguration ( ServiceReference < SecurityConfiguration > ref ) { String id = ( String ) ref . getProperty ( KEY_ID ) ; if ( id != null ) { configs . putReference ( id , ref ) ; } else { Tr . error ( tc , "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID" , "securityConfiguration" ) ; } return getServiceProperties ( ) ; }
Method will be called for each SecurityConfiguration that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
126
29
161,960
protected Map < String , Object > unsetConfiguration ( ServiceReference < SecurityConfiguration > ref ) { configs . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; return getServiceProperties ( ) ; }
Method will be called for each SecurityConfiguration that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
51
29
161,961
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE ) protected Map < String , Object > setAuthentication ( ServiceReference < AuthenticationService > ref ) { if ( hasPropertiesFromFile ( ref ) ) { String id = ( String ) ref . getProperty ( KEY_ID ) ; if ( id != null ) { authentication . putReference ( id , ref ) ; } else { Tr . error ( tc , "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID" , KEY_AUTHENTICATION ) ; } } else { authentication . putReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; } // determine a new authentication service authnService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthenticationService that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
187
29
161,962
protected Map < String , Object > unsetAuthentication ( ServiceReference < AuthenticationService > ref ) { authentication . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; authentication . removeReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; // determine a new authentication service authnService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthenticationService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
93
29
161,963
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE ) protected Map < String , Object > setAuthorization ( ServiceReference < AuthorizationService > ref ) { if ( hasPropertiesFromFile ( ref ) ) { String id = ( String ) ref . getProperty ( KEY_ID ) ; if ( id != null ) { authorization . putReference ( id , ref ) ; } else { Tr . error ( tc , "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID" , KEY_AUTHORIZATION ) ; } } else { authorization . putReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; } // determine a new authorization service authzService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthorizationService that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
187
29
161,964
protected Map < String , Object > unsetAuthorization ( ServiceReference < AuthorizationService > ref ) { authorization . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; authorization . removeReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; // determine a new authorization service authzService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthorizationService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
93
29
161,965
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE , target = "(config.displayId=*)" ) protected Map < String , Object > setUserRegistry ( ServiceReference < UserRegistryService > ref ) { adjustUserRegistryServiceRef ( ref ) ; // determine a new user registry service userRegistryService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each UserRegistryService that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
96
31
161,966
protected Map < String , Object > unsetUserRegistry ( ServiceReference < UserRegistryService > ref ) { userRegistry . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; userRegistry . removeReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; // determine a new user registry service userRegistryService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each UserRegistryService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
102
31
161,967
private SecurityConfiguration getEffectiveSecurityConfiguration ( ) { SecurityConfiguration effectiveConfig = configs . getService ( cfgSystemDomain ) ; if ( effectiveConfig == null ) { Tr . error ( tc , "SECURITY_SERVICE_ERROR_BAD_DOMAIN" , cfgSystemDomain , CFG_KEY_SYSTEM_DOMAIN ) ; throw new IllegalArgumentException ( Tr . formatMessage ( tc , "SECURITY_SERVICE_ERROR_BAD_DOMAIN" , cfgSystemDomain , CFG_KEY_SYSTEM_DOMAIN ) ) ; } return effectiveConfig ; }
Eventually this will be execution context aware and pick the right domain . Till then we re only accessing the system domain configuration .
130
24
161,968
private < V > V autoDetectService ( String serviceName , ConcurrentServiceReferenceMap < String , V > map ) { Iterator < V > services = map . getServices ( ) ; if ( services . hasNext ( ) == false ) { Tr . error ( tc , "SECURITY_SERVICE_NO_SERVICE_AVAILABLE" , serviceName ) ; throw new IllegalStateException ( Tr . formatMessage ( tc , "SECURITY_SERVICE_NO_SERVICE_AVAILABLE" , serviceName ) ) ; } V service = services . next ( ) ; if ( services . hasNext ( ) ) { Tr . error ( tc , "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE" , serviceName ) ; throw new IllegalStateException ( Tr . formatMessage ( tc , "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE" , serviceName ) ) ; } return service ; }
When the configuration element is not defined use some auto - detect logic to try and return the single Service of a specified field . If there is no service or multiple services that is considered an error case which auto - detect can not resolve .
215
47
161,969
private AuthenticationService getAuthenticationService ( String id ) { AuthenticationService service = authentication . getService ( id ) ; if ( service == null ) { throwIllegalArgumentExceptionInvalidAttributeValue ( SecurityConfiguration . CFG_KEY_AUTHENTICATION_REF , id ) ; } return service ; }
Retrieve the AuthenticationService for the specified id .
65
10
161,970
private AuthorizationService getAuthorizationService ( String id ) { AuthorizationService service = authorization . getService ( id ) ; if ( service == null ) { throwIllegalArgumentExceptionInvalidAttributeValue ( SecurityConfiguration . CFG_KEY_AUTHORIZATION_REF , id ) ; } return service ; }
Retrieve the AuthorizationService for the specified id .
65
10
161,971
private UserRegistryService getUserRegistryService ( String id ) { UserRegistryService service = userRegistry . getService ( id ) ; if ( service == null ) { throwIllegalArgumentExceptionInvalidAttributeValue ( SecurityConfiguration . CFG_KEY_USERREGISTRY_REF , id ) ; } return service ; }
Retrieve the UserRegistryService for the specified id .
71
12
161,972
protected final String getFacetName ( FaceletContext ctx , UIComponent parent ) { // TODO: REFACTOR - "facelets.FACET_NAME" should be a constant somewhere, used to be in FacetHandler // from real Facelets return ( String ) parent . getAttributes ( ) . get ( "facelets.FACET_NAME" ) ; }
Return the Facet name we are scoped in otherwise null
84
12
161,973
public void completeTxTimeout ( ) throws TransactionRolledbackException { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "completeTxTimeout" ) ; if ( tx != null && tx . isTimedOut ( ) ) { if ( traceOn && tc . isEventEnabled ( ) ) Tr . event ( tc , "Transaction has timed out. The transaction will be rolled back now" ) ; Tr . info ( tc , "WTRN0041_TXN_ROLLED_BACK" , tx . getTranName ( ) ) ; ( ( EmbeddableTransactionImpl ) tx ) . rollbackResources ( ) ; final TransactionRolledbackException rbe = new TransactionRolledbackException ( "Transaction is ended due to timeout" ) ; FFDCFilter . processException ( rbe , "com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerImpl.completeTxTimeout" , "100" , this ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "completeTxTimeout" , rbe ) ; throw rbe ; } if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "completeTxTimeout" ) ; }
Complete processing of passive transaction timeout .
291
7
161,974
public void addConsumer ( DispatchableConsumerPoint lcp ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addConsumer" , lcp ) ; // WARNING: We mustn't hold the LCP lock of the consumer at this point synchronized ( consumerList ) { consumerList . add ( lcp ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addConsumer" ) ; }
Add a new consumer to this set .
121
8
161,975
public void removeConsumer ( DispatchableConsumerPoint lcp ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeConsumer" , lcp ) ; // WARNING: We mustn't hold the LCP lock of the consumer at this point synchronized ( consumerList ) { consumerList . remove ( lcp ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeConsumer" ) ; }
Remove a consumer from the set .
121
7
161,976
public int getGetCursorIndex ( SIMPMessage msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getGetCursorIndex" ) ; // The zeroth index is reserved for non-classified messages int classPos = 0 ; synchronized ( classifications ) { if ( classifications . getNumberOfClasses ( ) > 0 ) { // Need to get the classification out of the message String keyClassification = msg . getMessageControlClassification ( true ) ; // In the special case where the weighting for the classification in the // message was zero, we use the Default cursor if ( keyClassification != null && classifications . getWeight ( keyClassification ) > 0 ) // Get the position of the classification classPos = classifications . getPosition ( keyClassification ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getGetCursorIndex" , classPos ) ; return classPos ; }
Determine the index of the getCursor to use based on the classification of a message .
233
20
161,977
public synchronized int chooseGetCursorIndex ( int previous ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "chooseGetCursorIndex" , new Object [ ] { Integer . valueOf ( previous ) } ) ; // The zeroth index represents the default cursor for non-classified messages. int classPos = 0 ; if ( classifications . getNumberOfClasses ( ) > 0 ) { // Need to determine the class of message to process if ( previous == - 1 ) { // First time through, get the initial weightings table weightMap = classifications . getWeightings ( ) ; } else { // Need to remove previous entries from the weightMap weightMap . remove ( Integer . valueOf ( previous ) ) ; } if ( ! weightMap . isEmpty ( ) ) { classPos = classifications . findClassIndex ( weightMap ) ; } // eof non-empty weightmap else if ( unitTestOperation ) { // In a production environment we'd return zero in this case so that the // default cursor would be used. In a Unit test environment, where we are // classifying messages and where we have configured the test so that a // cursor associated with a specific classification should be used then // we'll alert the test to an error by throwing this exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "chooseGetCursorIndex" , "SIErrorException" ) ; throw new SIErrorException ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "chooseGetCursorIndex" , classPos ) ; return classPos ; }
Determine the index of the getCursor to use based on the classifications defined for the ConsumerSet that this consumer belongs to .
388
28
161,978
public JSConsumerClassifications getClassifications ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getClassifications" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getClassifications" , classifications ) ; // TODO No synchronization? return classifications ; }
Returns a reference to the Classifications object that wraps the classifications specified by XD .
99
17
161,979
public void takeClassificationReadLock ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "takeClassificationReadLock" ) ; classificationReadLock . lock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "takeClassificationReadLock" ) ; }
Take a classification readlock
95
5
161,980
public void freeClassificationReadLock ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "freeClassificationReadLock" ) ; classificationReadLock . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "freeClassificationReadLock" ) ; }
Free a classification readlock
95
5
161,981
public void registerSynchronization ( Synchronization s ) throws CPIException { try { ivContainer . uowCtrl . enlistWithSession ( s ) ; // enlistSession(s) } catch ( CSIException e ) { throw new CPIException ( e . toString ( ) ) ; } }
Register the synchronization object with this activity session
61
8
161,982
private EJBKey [ ] getEJBKeys ( BeanO [ ] beans ) { EJBKey result [ ] = null ; if ( beans != null ) { result = new EJBKey [ beans . length ] ; for ( int i = 0 ; i < beans . length ; ++ i ) { result [ i ] = beans [ i ] . getId ( ) ; } } return result ; }
Get snapshot of all EJBKeys associated with the beans involved in current activity session
84
16
161,983
private BeanO [ ] getBeanOs ( ) { BeanO result [ ] ; result = new BeanO [ ivBeanOs . size ( ) ] ; Iterator < BeanO > iter = ivBeanOs . values ( ) . iterator ( ) ; int i = 0 ; while ( iter . hasNext ( ) ) { result [ i ++ ] = iter . next ( ) ; } return result ; }
Get snapshot of all beans involved in current activity session
87
10
161,984
@ Override public void scanClasses ( ClassSource_Streamer streamer , Set < String > i_seedClassNamesSet , ScanPolicy scanPolicy ) { throw new UnsupportedOperationException ( ) ; }
scan policy and external regions are never scanned iteratively .
43
11
161,985
public List < com . ibm . wsspi . security . wim . model . PartyRole > getPartyRoles ( ) { if ( partyRoles == null ) { partyRoles = new ArrayList < com . ibm . wsspi . security . wim . model . PartyRole > ( ) ; } return this . partyRoles ; }
Gets the value of the partyRoles property .
77
11
161,986
public JSchema getExpectedSchema ( Map context ) { if ( expectedSchema != null ) return expectedSchema ; if ( expectedType == null ) return null ; expectedSchema = ( JSchema ) context . get ( expectedType ) ; if ( expectedSchema != null ) return expectedSchema ; expectedSchema = new JSchema ( expectedType , context ) ; return expectedSchema ; }
Retrieve the subschema corresponding to the expected type ( will be null iff expected type is null . Constructs the subschema if it doesn t already exist . The context argument guards against duplicate construction of schemas in the event that the definition is recursive .
88
54
161,987
@ Override public void taskStarting ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; prevInvocationSubject = subjectManager . getInvocationSubject ( ) ; prevCallerSubject = subjectManager . getCallerSubject ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "taskStarting" , "previous caller/invocation subjects" , prevCallerSubject , prevInvocationSubject ) ; subjectManager . setInvocationSubject ( invocationSubject ) ; subjectManager . setCallerSubject ( callerSubject ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "taskStarting" , new Object [ ] { "new caller/invocation subjects" , callerSubject , invocationSubject } ) ; }
Push the subjects associated with this security context onto the thread .
173
12
161,988
@ Override public void taskStopping ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "taskStopping" , "restore caller/invocation subjects" , prevCallerSubject , prevInvocationSubject ) ; subjectManager . setCallerSubject ( prevCallerSubject ) ; subjectManager . setInvocationSubject ( prevInvocationSubject ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "taskStopping" ) ; }
Restore the subjects that were previously on the thread prior to applying this security context .
129
17
161,989
private void readState ( GetField fields ) throws IOException { //get caller principal callerPrincipal = ( WSPrincipal ) fields . get ( CALLER_PRINCIPAL , null ) ; //get boolean marking if subjects are equal subjectsAreEqual = fields . get ( SUBJECTS_ARE_EQUAL , false ) ; //only deserialize invocation principal if it's different from the caller if ( ! subjectsAreEqual ) { //get invocation principal invocationPrincipal = ( WSPrincipal ) fields . get ( INVOCATION_PRINCIPAL , null ) ; } else { invocationPrincipal = callerPrincipal ; } jaasLoginContextEntry = ( String ) fields . get ( JAAS_LOGIN_CONTEXT , null ) ; callerSubjectCacheKey = ( String ) fields . get ( CALLER_SUBJECT_CACHE_KEY , null ) ; invocationSubjectCacheKey = ( String ) fields . get ( INVOCATION_SUBJECT_CACHE_KEY , null ) ; }
Read the security context
223
4
161,990
@ FFDCIgnore ( AuthenticationException . class ) protected Subject recreateFullSubject ( WSPrincipal wsPrincipal , SecurityService securityService , AtomicServiceReference < UnauthenticatedSubjectService > unauthenticatedSubjectServiceRef , String customCacheKey ) { Subject subject = null ; if ( wsPrincipal != null ) { String userName = wsPrincipal . getName ( ) ; AuthenticateUserHelper authHelper = new AuthenticateUserHelper ( ) ; if ( jaasLoginContextEntry == null ) { jaasLoginContextEntry = DESERIALIZE_LOGINCONTEXT_DEFAULT ; } try { subject = authHelper . authenticateUser ( securityService . getAuthenticationService ( ) , userName , jaasLoginContextEntry , customCacheKey ) ; } catch ( AuthenticationException e ) { Tr . error ( tc , "SEC_CONTEXT_DESERIALIZE_AUTHN_ERROR" , new Object [ ] { e . getLocalizedMessage ( ) } ) ; } } if ( subject == null ) { subject = unauthenticatedSubjectServiceRef . getService ( ) . getUnauthenticatedSubject ( ) ; } return subject ; }
Perform a login to recreate the full subject given a WSPrincipal
249
16
161,991
protected WSPrincipal getWSPrincipal ( Subject subject ) throws IOException { WSPrincipal wsPrincipal = null ; Set < WSPrincipal > principals = ( subject != null ) ? subject . getPrincipals ( WSPrincipal . class ) : null ; if ( principals != null && ! principals . isEmpty ( ) ) { if ( principals . size ( ) > 1 ) { // Error - too many principals String principalNames = null ; for ( WSPrincipal principal : principals ) { if ( principalNames == null ) principalNames = principal . getName ( ) ; else principalNames = principalNames + ", " + principal . getName ( ) ; } throw new IOException ( Tr . formatMessage ( tc , "SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS" , principalNames ) ) ; } else { wsPrincipal = principals . iterator ( ) . next ( ) ; } } return wsPrincipal ; }
Get the WSPrincipal from the subject
218
10
161,992
public void clear ( ) throws IOException { if ( writer != null ) { throw new IOException ( ) ; } else { nextChar = 0 ; if ( limitBuffer && ( strBuffer . length ( ) > this . bodyContentBuffSize ) ) { //PK95332 - starts if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "BodyContentImpl" , "clear buffer, create new one with buffer size [" + this . bodyContentBuffSize + "]" ) ; } strBuffer = new StringBuffer ( this . bodyContentBuffSize ) ; } else if ( strBuffer != null ) { // PI24001 //PK95332 - ends strBuffer . setLength ( 0 ) ; // PK33136 } //PK95332 } }
Clear the contents of the buffer . If the buffer has been already been flushed then the clear operation shall throw an IOException to signal the fact that some data has already been irrevocably written to the client response stream .
196
44
161,993
public void writeOut ( Writer out ) throws IOException { if ( writer == null ) { out . write ( strBuffer . toString ( ) ) ; // PK33136 // Flush not called as the writer passed could be a BodyContent and // it doesn't allow to flush. } }
Write the contents of this BodyJspWriter into a Writer . Subclasses are likely to do interesting things with the implementation so some things are extra efficient .
61
31
161,994
void setWriter ( Writer writer ) { // PM12137 - starts if ( closed ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "setWriter" , "resetting closed to false for this=[" + this + "]" ) ; } closed = false ; strBuffer = new StringBuffer ( this . bodyContentBuffSize ) ; } // PM12137 - ends this . writer = writer ; if ( writer != null ) { // According to the spec, the JspWriter returned by // JspContext.pushBody(java.io.Writer writer) must behave as // though it were unbuffered. This means that its getBufferSize() // must always return 0. The implementation of // JspWriter.getBufferSize() returns the value of JspWriter's // 'bufferSize' field, which is inherited by this class. // Therefore, we simply save the current 'bufferSize' (so we can // later restore it should this BodyContentImpl ever be reused by // a call to PageContext.pushBody()) before setting it to 0. if ( bufferSize != 0 ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "setWriter" , "BodyContentImpl setWriter A. bufferSize=[" + bufferSize + "] this=[" + this + "]" ) ; } bufferSizeSave = bufferSize ; bufferSize = 0 ; } } else { bufferSize = bufferSizeSave ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "setWriter" , "BodyContentImpl setWriter B. bufferSize=[" + bufferSize + "] this=[" + this + "]" ) ; } clearBody ( ) ; } }
Sets the writer to which all output is written .
474
11
161,995
@ Trivial public final Map < String , String > getExecutionProperties ( ) { TreeMap < String , String > copy = null ; if ( internalPropNames != null ) { copy = new TreeMap < String , String > ( threadContextDescriptor . getExecutionProperties ( ) ) ; for ( String name : internalPropNames ) copy . remove ( name ) ; } return copy ; }
Returns a copy of execution properties .
87
7
161,996
public TimerWorkItem createTimeoutRequest ( long timeoutTime , TimerCallback _callback , IAbstractAsyncFuture _future ) { TimerWorkItem wi = new TimerWorkItem ( timeoutTime , _callback , _future , _future . getReuseCount ( ) ) ; _future . setTimeoutWorkItem ( wi ) ; // put this to the Timer's work queue. Use the queue that the Timer // thread is not using. if ( ( this . queueToUse == 1 ) || ( numQueues == 1 ) ) { synchronized ( this . requestQueue1 ) { // add the request to the Timer work queue this . requestQueue1 . add ( wi ) ; } } else { synchronized ( this . requestQueue2 ) { // add the request to the Timer work queue this . requestQueue2 . add ( wi ) ; } } return wi ; }
Creates a work item and puts it on the work queue for requesting a timeout to be started .
185
20
161,997
public void timeSlotPruning ( long curTime ) { // if a bucket has not been accessed in a while, and it only has // dead entries then get rid of it TimeSlot slotEntry = this . firstSlot ; TimeSlot nextSlot = null ; int endIndex = 0 ; int i ; while ( slotEntry != null ) { nextSlot = slotEntry . nextEntry ; if ( curTime - slotEntry . mostRecentlyAccessedTime > TIMESLOT_PRUNING_THRESHOLD ) { endIndex = slotEntry . lastEntryIndex ; // entries added last are more likely to be active, so // go from last to first for ( i = endIndex ; i >= 0 ; i -- ) { if ( slotEntry . entries [ i ] . state == TimerWorkItem . ENTRY_ACTIVE ) { break ; } } if ( i < 0 ) { // no entries are active removeSlot ( slotEntry ) ; } } slotEntry = nextSlot ; } }
Remove slots which have no active requests and no new requests have been added in a set amount of time .
209
21
161,998
public void insertWorkItem ( TimerWorkItem work , long curTime ) { // find the time slot, or create a new one long insertTime = work . timeoutTime ; TimeSlot nextSlot = this . firstSlot ; while ( nextSlot != null ) { if ( ( insertTime == nextSlot . timeoutTime ) && ( nextSlot . lastEntryIndex != TimeSlot . TIMESLOT_LAST_ENTRY ) ) { nextSlot . addEntry ( work , curTime ) ; break ; } else if ( insertTime < nextSlot . timeoutTime ) { nextSlot = insertSlot ( insertTime , nextSlot ) ; nextSlot . addEntry ( work , curTime ) ; break ; } else { nextSlot = nextSlot . nextEntry ; } } if ( nextSlot == null ) { nextSlot = insertSlotAtEnd ( insertTime ) ; nextSlot . addEntry ( work , curTime ) ; } }
Put a work item into an existing time slot or create a new time slot and put the work item into that time slot .
195
25
161,999
public TimeSlot insertSlot ( long newSlotTimeout , TimeSlot slot ) { // this routine assumes the list is not empty TimeSlot retSlot = new TimeSlot ( newSlotTimeout ) ; retSlot . nextEntry = slot ; retSlot . prevEntry = slot . prevEntry ; if ( retSlot . prevEntry != null ) { retSlot . prevEntry . nextEntry = retSlot ; } else { // no prev, so this is now the first slot this . firstSlot = retSlot ; } slot . prevEntry = retSlot ; return retSlot ; }
Create a new time slot with a given timeout time and add this new time slot in front of an existing time slot in the list .
117
27