idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,100
public static synchronized void notifyStopped ( HttpEndpointImpl endpoint , String resolvedHostName , int port , boolean isHttps ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Notify endpoint stopped: " + endpoint , resolvedHostName , port , isHttps , defaultHost . get ( ) , alternateHostSelector ) ; } if ( alternateHostSelector . get ( ) == null ) { if ( defaultHost . get ( ) != null ) { defaultHost . get ( ) . listenerStopped ( endpoint , resolvedHostName , port , isHttps ) ; } } else { alternateHostSelector . get ( ) . alternateNotifyStopped ( endpoint , resolvedHostName , port , isHttps ) ; } }
Remove a port associated with an endpoint that has stopped listening and notify associated virtual hosts .
179
17
161,101
public void addWsByteBuffer ( WsByteBuffer buffer ) { if ( this . allWsByteBuffers == null ) { this . allWsByteBuffers = new Hashtable < WsByteBuffer , WsByteBuffer > ( ) ; } this . allWsByteBuffers . put ( buffer , buffer ) ; }
Add a related buffer to the stored list for this instance .
69
12
161,102
public void addOwner ( String owner ) { if ( this . owners == null ) { this . owners = new Hashtable < String , String > ( ) ; } this . owners . put ( owner , owner ) ; }
Add the following owner to the list for this buffer .
46
11
161,103
public String getInputUniqueUserId ( String inputVirtualRealm ) { // initialize the return value String returnValue = getInputMapping ( inputVirtualRealm , Service . CONFIG_DO_UNIQUE_USER_ID_MAPPING , UNIQUE_USER_ID_DEFAULT ) ; return returnValue ; }
Get the input unique user ID mapping for the UserRegistry .
69
13
161,104
public String getOutputUniqueUserId ( String inputVirtualRealm ) { // initialize the return value String returnValue = getOutputMapping ( inputVirtualRealm , Service . CONFIG_DO_UNIQUE_USER_ID_MAPPING , UNIQUE_USER_ID_DEFAULT ) ; return returnValue ; }
Get the output unique user ID mapping for the UserRegistry .
69
13
161,105
public String getInputUserSecurityName ( String inputVirtualRealm ) { // initialize the return value String returnValue = getInputMapping ( inputVirtualRealm , Service . CONFIG_DO_USER_SECURITY_NAME_MAPPING , INPUT_USER_SECURITY_NAME_DEFAULT ) ; return returnValue ; }
Get the input user security name mapping for the UserRegistry .
72
13
161,106
public String getInputUserDisplayName ( String inputVirtualRealm ) { // initialize the return value String returnValue = getInputMapping ( inputVirtualRealm , Service . CONFIG_DO_USER_DISPLAY_NAME_MAPPING , USER_DISPLAY_NAME_DEFAULT ) ; return returnValue ; }
Get the input user display name mapping for the UserRegistry .
68
13
161,107
public String getOutputUserDisplayName ( String inputVirtualRealm ) { // initialize the return value String returnValue = getOutputMapping ( inputVirtualRealm , Service . CONFIG_DO_USER_DISPLAY_NAME_MAPPING , USER_DISPLAY_NAME_DEFAULT ) ; return returnValue ; }
Get the output user display name mapping for the UserRegistry .
68
13
161,108
public String getInputUniqueGroupId ( String inputVirtualRealm ) { // initialize the return value String returnValue = getInputMapping ( inputVirtualRealm , Service . CONFIG_DO_UNIQUE_GROUP_ID_MAPPING , INPUT_UNIQUE_GROUP_ID_DEFAULT ) ; return returnValue ; }
Get the input unique group ID mapping for the UserRegistry .
72
13
161,109
public String getOutputUniqueGroupId ( String inputVirtualRealm ) { // initialize the return value String returnValue = getOutputMapping ( inputVirtualRealm , Service . CONFIG_DO_UNIQUE_GROUP_ID_MAPPING , OUTPUT_UNIQUE_GROUP_ID_DEFAULT ) ; return returnValue ; }
Get the output unique group ID mapping for the UserRegistry .
72
13
161,110
public String getInputGroupSecurityName ( String inputVirtualRealm ) { // initialize the return value String returnValue = getInputMapping ( inputVirtualRealm , Service . CONFIG_DO_GROUP_SECURITY_NAME_MAPPING , INPUT_GROUP_SECURITY_NAME_DEFAULT ) ; return returnValue ; }
Get the input group security name mapping for the UserRegistry .
72
13
161,111
public String getOutputGroupSecurityName ( String inputVirtualRealm ) { // initialize the return value String returnValue = getOutputMapping ( inputVirtualRealm , Service . CONFIG_DO_GROUP_SECURITY_NAME_MAPPING , OUTPUT_GROUP_SECURITY_NAME_DEFAULT ) ; return returnValue ; }
Get the output group security name mapping for the UserRegistry .
72
13
161,112
public String getInputGroupDisplayName ( String inputVirtualRealm ) { // initialize the return value String returnValue = getInputMapping ( inputVirtualRealm , Service . CONFIG_DO_GROUP_DISPLAY_NAME_MAPPING , GROUP_DISPLAY_NAME_DEFAULT ) ; return returnValue ; }
Get the input group display name mapping for the UserRegistry .
67
13
161,113
public String getOutputGroupDisplayName ( String inputVirtualRealm ) { // initialize the return value String returnValue = getOutputMapping ( inputVirtualRealm , Service . CONFIG_DO_GROUP_DISPLAY_NAME_MAPPING , GROUP_DISPLAY_NAME_DEFAULT ) ; return returnValue ; }
Get the output group display name mapping for the UserRegistry .
67
13
161,114
@ FFDCIgnore ( Exception . class ) private String getInputMapping ( String inputVirtualRealm , String inputProperty , String inputDefaultProperty ) { String methodName = "getInputMapping" ; // initialize the return value String returnValue = null ; RealmConfig realmConfig = mappingUtils . getCoreConfiguration ( ) . getRealmConfig ( inputVirtualRealm ) ; if ( realmConfig != null ) { try { returnValue = realmConfig . getURMapInputPropertyInRealm ( inputProperty ) ; if ( ( returnValue == null ) || ( returnValue . equals ( "" ) ) ) { returnValue = inputDefaultProperty ; } } catch ( Exception toCatch ) { returnValue = inputDefaultProperty ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " " + toCatch . getMessage ( ) , toCatch ) ; } } } else { returnValue = inputDefaultProperty ; } return returnValue ; }
Get the WIM input property that maps to the UserRegistry input property .
209
16
161,115
private static Object _convertOrCoerceValue ( FacesContext facesContext , UIComponent uiComponent , Object value , SelectItem selectItem , Converter converter ) { Object itemValue = selectItem . getValue ( ) ; if ( converter != null && itemValue instanceof String ) { itemValue = converter . getAsObject ( facesContext , uiComponent , ( String ) itemValue ) ; } else { // The javadoc of UISelectOne/UISelectMany says : // "... Before comparing each option, coerce the option value type // to the type of this component's value following the // Expression Language coercion rules ..." // If the coercion fails, just return the value without coerce, // because it could be still valid the comparison for that value. // and swallow the exception, because its information is no relevant // on this context. try { if ( value instanceof java . lang . Enum ) { // Values from an enum are a special case. There is one syntax were the // particular enumeration is extended using something like // SOMEVALUE { ... }, usually to override toString() method. In this case, // value.getClass is not the target enum class, so we need to get the // right one from super class. Class targetClass = value . getClass ( ) ; if ( targetClass != null && ! targetClass . isEnum ( ) ) { targetClass = targetClass . getSuperclass ( ) ; } itemValue = _ClassUtils . convertToTypeNoLogging ( facesContext , itemValue , targetClass ) ; } else { itemValue = _ClassUtils . convertToTypeNoLogging ( facesContext , itemValue , value . getClass ( ) ) ; } } catch ( IllegalArgumentException e ) { //itemValue = selectItem.getValue(); } catch ( Exception e ) { //itemValue = selectItem.getValue(); } } return itemValue ; }
If converter is available and selectItem . value is String uses getAsObject otherwise uses EL type coertion and return result .
408
26
161,116
public final static MessageType getMessageType ( Byte aValue ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Value = " + aValue ) ; return set [ aValue . intValue ( ) ] ; }
Returns the corresponding MessageType for a given Byte . This method should NOT be called by any code outside the MFP component . It is only public so that it can be accessed by sub - packages .
65
40
161,117
void balance ( int kFactor , NodeStack stack , GBSNode fpoint , int fpidx , int maxBal ) { /* Get parent of balance point */ GBSNode bparent = stack . node ( fpidx - 1 ) ; switch ( kFactor ) { case 2 : balance2 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; case 4 : balance4 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; case 6 : balance6 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; case 8 : balance8 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; case 12 : balance12 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; case 16 : balance16 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; case 24 : balance24 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; case 32 : balance32 ( stack , bparent , fpoint , fpidx , maxBal ) ; break ; default : String x = "Unknown K factor in fringe balance: " + kFactor ; error ( x ) ; break ; } }
Balance a fringe following the addition of its final node .
276
11
161,118
private void balance2 ( NodeStack stack , GBSNode bparent , /* Parent of fringe balance point */ GBSNode fpoint , /* Fringe balance point */ int fpidx , /* Index within stack of fpoint */ int maxBal ) /* Maximum allowed fringe imbalance */ { /* k = 2, 2k-1 = 5, k-1 = 1 [A-B-C] [3 children] becomes: *----B----* | | A C ------------------------------- *----B----* | | A C - D - E [3 children] becomes: *----B----* | | A *--D--* | | C E */ GBSNode a = fpoint ; GBSNode b = a . rightChild ( ) ; if ( bparent . rightChild ( ) == a ) bparent . setRightChild ( b ) ; else bparent . setLeftChild ( b ) ; b . setLeftChild ( a ) ; a . clearRightChild ( ) ; if ( ( fpidx > 1 ) && ( stack . balancePointIndex ( ) > - 1 ) ) { GBSNode qpoint = b ; stack . setNode ( fpidx , qpoint ) ; GBSInsertHeight . singleInstance ( ) . balance ( stack , qpoint ) ; } }
Balance a fringe with a K factor of two .
271
10
161,119
private void balance4 ( NodeStack stack , GBSNode bparent , /* Parent of fringe balance point */ GBSNode fpoint , /* Fringe balance point */ int fpidx , /* Index within stack of fpoint */ int maxBal ) /* Maximum allowed fringe imbalance */ { /* k = 4, 2k-1 = 7, k-1 = 3 [A-B-C] [3 children] becomes: *----B----* | | A C ------------------------------- *----B----* | | A C - D - E - F - G [5 children] becomes: *------D------* | | *--B--* *--F--* | | | | A C E G */ if ( maxBal == 3 ) { GBSNode a = fpoint ; GBSNode b = a . rightChild ( ) ; if ( bparent . rightChild ( ) == a ) bparent . setRightChild ( b ) ; else bparent . setLeftChild ( b ) ; b . setLeftChild ( a ) ; a . clearRightChild ( ) ; } else { if ( maxBal != 5 ) error ( "fringeBalance4: maxBal != 5, maxBal = " + maxBal ) ; GBSNode t0_top = stack . node ( fpidx - 2 ) ; GBSNode c = fpoint ; GBSNode d = c . rightChild ( ) ; GBSNode e = d . rightChild ( ) ; GBSNode f = e . rightChild ( ) ; d . setChildren ( bparent , f ) ; c . clearRightChild ( ) ; f . setLeftChild ( e ) ; e . clearRightChild ( ) ; if ( t0_top . rightChild ( ) == bparent ) t0_top . setRightChild ( d ) ; else t0_top . setLeftChild ( d ) ; if ( ( fpidx > 2 ) && ( stack . balancePointIndex ( ) > - 1 ) ) { GBSNode qpoint = d ; stack . setNode ( fpidx - 1 , qpoint ) ; GBSInsertHeight . singleInstance ( ) . balance ( stack , qpoint ) ; } } }
Balance a fringe with a K factor of four .
465
10
161,120
private void balance6 ( NodeStack stack , GBSNode bparent , /* Parent of fringe balance point */ GBSNode fpoint , /* Fringe balance point */ int fpidx , /* Index within stack of fpoint */ int maxBal ) /* Maximum allowed fringe imbalance */ { /* k = 6, 2k-1 = 11, k-1 = 5 [A-B-C-D-E] [5 children] becomes: *--C--* | | *-B D-* | | A E ------------------------------- *--C--* | | [8 children] *-B D-* | | A E - F - G - H - I - J - K becomes: *-------F-------* | | *--C--* *--I--* | | | | *-B D-* *-H J-* | | | | A E G K */ if ( maxBal == 5 ) { GBSNode a = fpoint ; GBSNode b = a . rightChild ( ) ; GBSNode c = b . rightChild ( ) ; if ( bparent . rightChild ( ) == a ) bparent . setRightChild ( c ) ; else bparent . setLeftChild ( c ) ; c . setLeftChild ( b ) ; b . setChildren ( a , null ) ; a . clearRightChild ( ) ; } else { if ( maxBal != 8 ) error ( "fringeBalance6: maxBal != 8, maxBal = " + maxBal ) ; GBSNode t0_top = stack . node ( fpidx - 2 ) ; GBSNode c = bparent ; GBSNode d = fpoint ; GBSNode e = d . rightChild ( ) ; GBSNode f = e . rightChild ( ) ; GBSNode g = f . rightChild ( ) ; GBSNode h = g . rightChild ( ) ; GBSNode i = h . rightChild ( ) ; f . setChildren ( c , i ) ; i . setLeftChild ( h ) ; h . setChildren ( g , null ) ; g . clearRightChild ( ) ; e . clearRightChild ( ) ; if ( t0_top . rightChild ( ) == c ) t0_top . setRightChild ( f ) ; else t0_top . setLeftChild ( f ) ; if ( ( fpidx > 2 ) && ( stack . balancePointIndex ( ) > - 1 ) ) { GBSNode qpoint = f ; stack . setNode ( fpidx - 1 , qpoint ) ; GBSInsertHeight . singleInstance ( ) . balance ( stack , qpoint ) ; } } }
Balance a fringe with a K factor of six .
567
10
161,121
private void balance8 ( NodeStack stack , GBSNode bparent , /* Parent of fringe balance point */ GBSNode fpoint , /* Fringe balance point */ int fpidx , /* Index within stack of fpoint */ int maxBal ) /* Maximum allowed fringe imbalance */ { /* k = 8, 2k-1 = 15, k-1 = 7 [A-B-C-D-E-F-G] [7 children] becomes: *------D------* | | *--B--* *--F--* | | | | A C E G ------------------------------------------- *------D------* | | *--B--* *--F--* [9 children] | | | | A C E G - H - I - J - K - L - M - N - O becomes: *--------H--------* | | *---D---* *---L---* | | | | *-B-* *-F-* *-J-* *-N-* | | | | | | | | A C E G I K M O */ if ( maxBal == 7 ) { GBSNode a = fpoint ; GBSNode b = a . rightChild ( ) ; GBSNode c = b . rightChild ( ) ; GBSNode d = c . rightChild ( ) ; GBSNode e = d . rightChild ( ) ; GBSNode f = e . rightChild ( ) ; d . setLeftChild ( b ) ; d . setRightChild ( f ) ; b . setLeftChild ( a ) ; a . clearRightChild ( ) ; c . clearRightChild ( ) ; f . setLeftChild ( e ) ; e . clearRightChild ( ) ; if ( bparent . rightChild ( ) == a ) bparent . setRightChild ( d ) ; else bparent . setLeftChild ( d ) ; } else { if ( maxBal != 9 ) error ( "fringeBalance8: maxBal != 9, maxBal = " + maxBal ) ; GBSNode t0_top = stack . node ( fpidx - 3 ) ; GBSNode d = stack . node ( fpidx - 2 ) ; GBSNode g = fpoint ; GBSNode h = g . rightChild ( ) ; GBSNode i = h . rightChild ( ) ; GBSNode j = i . rightChild ( ) ; GBSNode k = j . rightChild ( ) ; GBSNode l = k . rightChild ( ) ; GBSNode m = l . rightChild ( ) ; GBSNode n = m . rightChild ( ) ; h . setLeftChild ( d ) ; h . setRightChild ( l ) ; l . setLeftChild ( j ) ; l . setRightChild ( n ) ; j . setLeftChild ( i ) ; i . clearRightChild ( ) ; k . clearRightChild ( ) ; n . setLeftChild ( m ) ; m . clearRightChild ( ) ; g . clearRightChild ( ) ; if ( t0_top . rightChild ( ) == d ) t0_top . setRightChild ( h ) ; else t0_top . setLeftChild ( h ) ; if ( ( fpidx > 3 ) && ( stack . balancePointIndex ( ) > - 1 ) ) { GBSNode qpoint = h ; stack . setNode ( fpidx - 2 , qpoint ) ; GBSInsertHeight . singleInstance ( ) . balance ( stack , qpoint ) ; } } }
Balance a fringe with a K factor of eight .
749
10
161,122
@ Reference ( name = BASE_INSTANCE , service = ContextService . class , cardinality = ReferenceCardinality . OPTIONAL , policy = ReferencePolicy . DYNAMIC , policyOption = ReferencePolicyOption . GREEDY , target = "(id=unbound)" ) protected void setBaseInstance ( ServiceReference < ContextService > ref ) { lock . writeLock ( ) . lock ( ) ; try { threadContextConfigurations = null ; } finally { lock . writeLock ( ) . unlock ( ) ; } }
Declarative Services method for setting the service reference to the base contextService instance .
110
17
161,123
@ Reference ( name = THREAD_CONTEXT_MANAGER , service = WSContextService . class , cardinality = ReferenceCardinality . MANDATORY , policy = ReferencePolicy . STATIC , target = "(component.name=com.ibm.ws.context.manager)" ) protected void setThreadContextManager ( WSContextService svc ) { threadContextMgr = ( ThreadContextManager ) svc ; }
Declarative Services method for setting the thread context manager .
91
12
161,124
protected void unsetBaseInstance ( ServiceReference < ContextService > ref ) { lock . writeLock ( ) . lock ( ) ; try { threadContextConfigurations = null ; } finally { lock . writeLock ( ) . unlock ( ) ; } }
Declarative Services method for unsetting the service reference to the base contextService instance .
52
18
161,125
@ Override public synchronized void complete ( ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . entering ( CLASS_NAME , "complete" , this ) ; } if ( ! lockHeldByDifferentThread ( ) ) { //We can't call this or WebContainer won't know to run the complete runnable which kicks off the async listeners // WebContainerRequestState.getInstance(true).setAsyncMode(false); if ( ! completePending ) { //Move this inside of if block because it complete is called //after a previous complete, you can get a NPE because the //request may have already been cleaned up. If complete is not //pending, then it shouldn't have been cleaned up. if ( com . ibm . ws . webcontainer . osgi . WebContainer . getServletContainerSpecLevel ( ) > 31 ) { //setAsyncStarted(false) upon exit service() WebContainerRequestState reqState = WebContainerRequestState . getInstance ( true ) ; reqState . setAttribute ( "webcontainer.resetAsyncStartedOnExit" , "true" ) ; } else { iExtendedRequest . setAsyncStarted ( false ) ; } createNewAsyncServletReeentrantLock ( ) ; cancelAsyncTimer ( ) ; completeRunnable = new CompleteRunnable ( iExtendedRequest , this ) ; completePending = true ; if ( ! dispatching ) { executeNextRunnable ( ) ; } } } else { if ( WCCustomProperties . THROW_EXCEPTION_WHEN_UNABLE_TO_COMPLETE_OR_DISPATCH ) { throw new IllegalStateException ( nls . getString ( "AsyncContext.lock.already.held" , "Unable to obtain the lock. Error processing has already been invoked by another thread." ) ) ; } } dispatchURI = null ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . exiting ( CLASS_NAME , "complete" , this ) ; } }
we re okay to sync on the scheduling of the complete
485
11
161,126
@ Override public synchronized void dispatch ( ServletContext context , String path ) throws IllegalStateException { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . entering ( CLASS_NAME , "dispatch(ctx,path)" , new Object [ ] { this , context , path } ) ; } if ( ! lockHeldByDifferentThread ( ) ) { if ( completePending ) { throw new IllegalStateException ( nls . getString ( "called.dispatch.after.complete" ) ) ; } else if ( ! dispatchAllowed ) { throw new IllegalStateException ( nls . getString ( "trying.to.call.dispatch.twice.for.the.same.async.operation" ) ) ; } // PI28910, the effect of calling dispatch should not take effect until the calling // thread completes so it is too early to set asyncStarted to false // iExtendedRequest.setAsyncStarted(false); createNewAsyncServletReeentrantLock ( ) ; //cancel timer inside lock so we don't kick off timeout events after we've decided to dispatch cancelAsyncTimer ( ) ; WebAppRequestDispatcher requestDispatcher = ( WebAppRequestDispatcher ) context . getRequestDispatcher ( path ) ; dispatchRunnable = new DispatchRunnable ( requestDispatcher , this ) ; dispatchPending = true ; dispatchAllowed = false ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . logp ( Level . FINEST , CLASS_NAME , "dispatch(ctx,path)" , "dispatching -->" + dispatching ) ; } if ( ! dispatching ) { executeNextRunnable ( ) ; } } else { if ( WCCustomProperties . THROW_EXCEPTION_WHEN_UNABLE_TO_COMPLETE_OR_DISPATCH ) { throw new IllegalStateException ( nls . getString ( "AsyncContext.lock.already.held" , "Unable to obtain the lock. Error processing has already been invoked by another thread." ) ) ; } } dispatchURI = null ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . exiting ( CLASS_NAME , "dispatch(ctx,path)" , this ) ; } }
we re okay to sync on the scheduling of the dispatch
569
11
161,127
public final void commit_one_phase ( ) throws XAException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "commit_one_phase" , _resource ) ; if ( tcSummary . isDebugEnabled ( ) ) Tr . debug ( tcSummary , "commit_one_phase" , this ) ; // // Commit the one-phase resource. // try { _resource . commit ( _xid , true ) ; // Record the completion direction and Automatic vote. _completedCommit = true ; _vote = JTAResourceVote . commit ; } catch ( XAException xae ) { // Record the completion XA return code _completionXARC = xae . errorCode ; throw xae ; } finally { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "commit_one_phase" , _completionXARC ) ; if ( tcSummary . isDebugEnabled ( ) ) Tr . debug ( tcSummary , "commit_one_phase result: " + XAReturnCodeHelper . convertXACode ( _completionXARC ) ) ; } }
Commit a transaction using one - phase optimization .
243
10
161,128
public final void rollback ( ) throws XAException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "rollback" , _resource ) ; if ( tcSummary . isDebugEnabled ( ) ) Tr . debug ( tcSummary , "rollback" , this ) ; try { _resource . rollback ( _xid ) ; // Record the vote. // _completedCommit defaults to false. _vote = JTAResourceVote . rollback ; } catch ( XAException xae ) { // Record the completion XA return code _completionXARC = xae . errorCode ; throw xae ; } finally { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "rollback" ) ; if ( tcSummary . isDebugEnabled ( ) ) Tr . debug ( tcSummary , "rollback result: " + XAReturnCodeHelper . convertXACode ( _completionXARC ) ) ; } }
Rollback a transaction .
210
5
161,129
public final void forget ( ) throws XAException { if ( tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "forget" , _resource ) ; Tr . exit ( tc , "forget" ) ; } }
The resource manager can forget all knowledge of the transaction . Only allowed because commit_one_phase may return heuristic
51
23
161,130
private void verifyConfiguration ( ) throws DeploymentException { Map < URL , ModuleMetaData > mmds = getModuleMetaDataMap ( ) ; if ( mmds != null ) { for ( Map . Entry < URL , ModuleMetaData > entry : mmds . entrySet ( ) ) { ModuleMetaData mmd = entry . getValue ( ) ; if ( mmd instanceof WebModuleMetaData ) { String j2eeModuleName = mmd . getJ2EEName ( ) . getModule ( ) ; Map < Class < ? > , Properties > authMechs = getAuthMechs ( j2eeModuleName ) ; if ( authMechs != null && ! authMechs . isEmpty ( ) ) { // make sure that only one HAM. if ( authMechs . size ( ) != 1 ) { String appName = mmd . getJ2EEName ( ) . getApplication ( ) ; String authMechNames = getAuthMechNames ( authMechs ) ; Tr . error ( tc , "JAVAEESEC_CDI_ERROR_MULTIPLE_HTTPAUTHMECHS" , j2eeModuleName , appName , authMechNames ) ; String msg = Tr . formatMessage ( tc , "JAVAEESEC_CDI_ERROR_MULTIPLE_HTTPAUTHMECHS" , j2eeModuleName , appName , authMechNames ) ; throw new DeploymentException ( msg ) ; } SecurityMetadata smd = ( SecurityMetadata ) ( ( WebModuleMetaData ) mmd ) . getSecurityMetaData ( ) ; if ( smd != null ) { LoginConfiguration lc = smd . getLoginConfiguration ( ) ; if ( lc != null && ! lc . isAuthenticationMethodDefaulted ( ) ) { String appName = mmd . getJ2EEName ( ) . getApplication ( ) ; String msg = Tr . formatMessage ( tc , "JAVAEESEC_CDI_ERROR_LOGIN_CONFIG_EXISTS" , j2eeModuleName , appName ) ; Tr . error ( tc , "JAVAEESEC_CDI_ERROR_LOGIN_CONFIG_EXISTS" , j2eeModuleName , appName ) ; throw new DeploymentException ( msg ) ; } } } } } } }
make sure that there is one HAM for each modules and if there is a HAM in a module make sure there is no login configuration in web . xml .
508
31
161,131
private String getModuleFromClass ( Class < ? > klass , Map < String , ModuleProperties > moduleMap ) { String file = getClassFileLocation ( klass ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "File name : " + file ) ; } String moduleName = null ; for ( Map . Entry < String , ModuleProperties > entry : moduleMap . entrySet ( ) ) { URL location = entry . getValue ( ) . getLocation ( ) ; String filePath = location . getFile ( ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "location : " + filePath ) ; } if ( location . getProtocol ( ) . equals ( "file" ) && file . startsWith ( filePath ) ) { moduleName = entry . getKey ( ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "module name from the list : " + moduleName ) ; } break ; } } if ( moduleName == null ) { moduleName = file ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "no match. use filename as module name : " + moduleName ) ; } } return moduleName ; }
Identify the module name from the class . If the class exists in the jar file return war file name if it is located under the war file otherwise returning jar file name .
272
35
161,132
private Properties getGlobalLoginBasicProps ( ) throws Exception { String realm = getWebAppSecurityConfig ( ) . getBasicAuthRealmName ( ) ; Properties props = new Properties ( ) ; if ( realm == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "basicAuthenticationMechanismRealmName is not set. the default value " + JavaEESecConstants . DEFAULT_REALM + " is used." ) ; } } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The container provided BasicAuthenticationMechanism will be used with the realm name : " + realm ) ; } props . put ( JavaEESecConstants . REALM_NAME , realm ) ; } return props ; }
Returns BasicAuth realm name for container override basic login
171
10
161,133
private Properties getGlobalLoginFormProps ( ) throws Exception { WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig ( ) ; String loginURL = webAppSecConfig . getLoginFormURL ( ) ; String errorURL = webAppSecConfig . getLoginErrorURL ( ) ; if ( loginURL == null || loginURL . isEmpty ( ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_NO_URL" , "loginFormURL" ) ; } if ( errorURL == null || errorURL . isEmpty ( ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_NO_URL" , "loginErrorURL" ) ; } String contextRoot = webAppSecConfig . getLoginFormContextRoot ( ) ; if ( contextRoot == null ) { // if a context root is not set, use the first path element of the login page. contextRoot = getFirstPathElement ( loginURL ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "loginFormContextRoot is not set, use the first element of loginURL : " + contextRoot ) ; } } else { if ( ! validateContextRoot ( contextRoot , loginURL ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_INVALID_CONTEXT_ROOT" , contextRoot , loginURL , "loginFormURL" ) ; } if ( ! validateContextRoot ( contextRoot , errorURL ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_INVALID_CONTEXT_ROOT" , contextRoot , errorURL , "loginErrorURL" ) ; } } // adjust the login and error url which need to be relative path from the context root. loginURL = FixUpUrl ( loginURL , contextRoot ) ; errorURL = FixUpUrl ( errorURL , contextRoot ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The container provided FormAuthenticationMechanism will be used with the following attributes. login page : " + loginURL + ", error page : " + errorURL + ", context root : " + contextRoot ) ; } Properties props = new Properties ( ) ; if ( loginURL != null ) { props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_LOGINPAGE , loginURL ) ; } if ( errorURL != null ) { props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_ERRORPAGE , errorURL ) ; } props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_USEFORWARDTOLOGIN , true ) ; props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_USE_GLOBAL_LOGIN , true ) ; if ( contextRoot != null ) { props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_LOGIN_FORM_CONTEXT_ROOT , contextRoot ) ; } return props ; }
Returns LoginToContinue properties for container override form login
674
10
161,134
private void initialize ( Map < String , Object > metadata ) { if ( metadata == null ) { metadata = new HashMap < String , Object > ( ) ; } metadata . put ( REQUEST_ID , generateRequestID ( ) ) ; this . metadata = metadata ; }
Generates a new metadata Map if none is given . Generates and adds a request ID to the metadata .
57
22
161,135
@ Override public void addObserver ( Observer observer ) { super . addObserver ( observer ) ; if ( countObservers ( ) > 1 ) { super . deleteObserver ( observer ) ; AbstractConnectionFactoryService cfSvc = ( AbstractConnectionFactoryService ) observer ; Object [ ] params = new Object [ ] { CONNECTION_MANAGER , name , cfSvc . getConfigElementName ( ) } ; RuntimeException failure = connectorSvc . ignoreWarnOrFail ( tc , null , UnsupportedOperationException . class , "CARDINALITY_ERROR_J2CA8040" , params ) ; if ( failure != null ) throw failure ; } }
Add an observer for this connection manager service .
145
9
161,136
@ Override public void destroyConnectionFactories ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) { final String pmName ; if ( pm != null ) pmName = pm . getUniqueId ( ) ; else pmName = "factory name not avaiable" ; Tr . entry ( this , tc , "destroyConnectionFactories" , pmName ) ; } lock . writeLock ( ) . lock ( ) ; try { if ( pmMBean != null ) { pmMBean . unregister ( ) ; pmMBean = null ; } if ( pm != null ) { try { pm . serverShutDown ( ) ; pm = null ; cfKeyToCM . clear ( ) ; } catch ( Throwable x ) { FFDCFilter . processException ( x , getClass ( ) . getName ( ) , "263" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , x . getMessage ( ) , CommonFunction . stackTraceToString ( x ) ) ; } } } finally { lock . writeLock ( ) . unlock ( ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "destroyConnectionFactories" ) ; }
Destroy all connection factories that are using this connection manager service .
296
12
161,137
private final CMConfigData getCMConfigData ( AbstractConnectionFactoryService cfSvc , ResourceInfo refInfo ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getCMConfigData" ) ; // Defaults for direct lookup int auth = J2CConstants . AUTHENTICATION_APPLICATION ; int branchCoupling = ResourceRefInfo . BRANCH_COUPLING_UNSET ; int commitPriority = 0 ; int isolation = Connection . TRANSACTION_NONE ; int sharingScope ; String loginConfigName = null ; HashMap < String , String > loginConfigProps = null ; String resRefName = null ; if ( refInfo != null ) { if ( refInfo . getAuth ( ) == ResourceRef . AUTH_CONTAINER ) auth = J2CConstants . AUTHENTICATION_CONTAINER ; branchCoupling = refInfo . getBranchCoupling ( ) ; commitPriority = refInfo . getCommitPriority ( ) ; isolation = refInfo . getIsolationLevel ( ) ; loginConfigName = refInfo . getLoginConfigurationName ( ) ; loginConfigProps = toHashMap ( refInfo . getLoginPropertyList ( ) ) ; resRefName = refInfo . getName ( ) ; sharingScope = refInfo . getSharingScope ( ) ; } else { if ( properties != null ) { Object enableSharingForDirectLookups = properties . get ( "enableSharingForDirectLookups" ) ; sharingScope = enableSharingForDirectLookups == null || ( Boolean ) enableSharingForDirectLookups ? ResourceRefInfo . SHARING_SCOPE_SHAREABLE : ResourceRefInfo . SHARING_SCOPE_UNSHAREABLE ; } else { sharingScope = ResourceRefInfo . SHARING_SCOPE_SHAREABLE ; } } CMConfigData cmConfig = new CMConfigDataImpl ( cfSvc . getJNDIName ( ) , sharingScope , isolation , auth , cfSvc . getID ( ) , loginConfigName , loginConfigProps , resRefName , commitPriority , branchCoupling , null // no mmProps ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getCMConfigData" , cmConfig ) ; return cmConfig ; }
Construct the CMConfigData including properties from the resource reference if applicable .
522
14
161,138
@ Override public ConnectionManager getConnectionManager ( ResourceInfo refInfo , AbstractConnectionFactoryService svc ) throws ResourceException { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getConnectionManager" , refInfo , svc ) ; ConnectionManager cm ; lock . readLock ( ) . lock ( ) ; try { if ( pm == null ) try { // Switch to write lock for lazy initialization lock . readLock ( ) . unlock ( ) ; lock . writeLock ( ) . lock ( ) ; if ( pm == null ) createPoolManager ( svc ) ; } finally { // Downgrade to read lock for rest of method lock . readLock ( ) . lock ( ) ; lock . writeLock ( ) . unlock ( ) ; } CMConfigData cmConfigData = getCMConfigData ( svc , refInfo ) ; String cfDetailsKey = cmConfigData . getCFDetailsKey ( ) ; cm = cfKeyToCM . get ( cfDetailsKey ) ; if ( cm == null ) { CommonXAResourceInfo xaResInfo = new EmbXAResourceInfo ( cmConfigData ) ; J2CGlobalConfigProperties gConfigProps = pm . getGConfigProps ( ) ; synchronized ( this ) { cm = cfKeyToCM . get ( cfDetailsKey ) ; if ( cm == null ) { cm = new ConnectionManager ( svc , pm , gConfigProps , xaResInfo ) ; cfKeyToCM . put ( cfDetailsKey , cm ) ; } } } } finally { lock . readLock ( ) . unlock ( ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getConnectionManager" , cm ) ; return cm ; }
Returns the connection manager for this configuration . This method lazily initializes the connection manager service if necessary .
394
21
161,139
private final static HashMap < String , String > toHashMap ( List < ? extends ResourceInfo . Property > propList ) { if ( propList == null ) return null ; HashMap < String , String > propMap = new HashMap < String , String > ( ) ; for ( ResourceInfo . Property prop : propList ) propMap . put ( prop . getName ( ) , prop . getValue ( ) ) ; return propMap ; }
Utility method that converts a list of properties to HashMap .
94
13
161,140
@ Override @ FFDCIgnore ( BAD_OPERATION . class ) public Object narrow ( Object narrowFrom , @ SuppressWarnings ( "rawtypes" ) Class narrowTo ) throws ClassCastException { if ( narrowFrom == null ) { return null ; } if ( narrowTo . isInstance ( narrowFrom ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "object is already an instance" ) ; return narrowFrom ; } if ( ! ! ! ( narrowFrom instanceof ObjectImpl ) ) throw new ClassCastException ( narrowTo . getName ( ) ) ; if ( IDLEntity . class . isAssignableFrom ( narrowTo ) ) return super . narrow ( narrowFrom , narrowTo ) ; Class < ? > stubClass = loadStubClass ( narrowTo ) ; if ( stubClass == null ) { // The stub class could not be loaded. Fallback to the default // implementation to allow it to dynamically generate one. return super . narrow ( narrowFrom , narrowTo ) ; } Object stubObject ; try { stubObject = stubClass . newInstance ( ) ; } catch ( Throwable t ) { // This will fail if the stub class is "invalid" (missing default // constructor, non-public default constructor, logic in the // constructor that throws, etc.). ClassCastException e = new ClassCastException ( narrowTo . getName ( ) ) ; e . initCause ( t ) ; throw e ; } // This will fail if the loaded class does not actually extend Stub. Stub stub = ( Stub ) stubObject ; try { stub . _set_delegate ( ( ( ObjectImpl ) narrowFrom ) . _get_delegate ( ) ) ; } catch ( org . omg . CORBA . BAD_OPERATION e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unable to copy delegate" , e ) ; } // This will fail if the loaded stub class does not implement the // interface. For example, narrow was called with one version of the // interface, but the context class loader loaded a stub that // implemented a different version of the interface. return narrowTo . cast ( stub ) ; }
An implementation of narrow that always attempts to load stub classes from the class loader before dynamically generating a stub class .
489
22
161,141
private void scanClasses ( ) throws PersistenceUnitScannerException { try { for ( URL url : urlSet ) { final HashSet < ClassInfoType > citSet = new HashSet < ClassInfoType > ( ) ; final String urlProtocol = url . getProtocol ( ) ; if ( "file" . equalsIgnoreCase ( urlProtocol ) ) { // Protocol is "file", which either addresses a jar file or an exploded jar file final Path taPath = Paths . get ( url . toURI ( ) ) ; if ( Files . isDirectory ( taPath ) ) { // Exploded Archive citSet . addAll ( processExplodedJarFormat ( taPath ) ) ; } else { // Unexploded Archive citSet . addAll ( processUnexplodedFile ( taPath ) ) ; } } else if ( url . toString ( ) . startsWith ( "jar:file" ) ) { citSet . addAll ( processJarFileURL ( url ) ) ; } else { // InputStream will be in jar format. citSet . addAll ( processJarFormatInputStreamURL ( url ) ) ; } processInnerClasses ( citSet ) ; scannedClassesMap . put ( url , citSet ) ; } } catch ( Exception e ) { FFDCFilter . processException ( e , PersistenceUnitScanner . class . getName ( ) + ".scanClasses" , "118" ) ; throw new PersistenceUnitScannerException ( e ) ; } }
Scan classes in persistence unit root and referenced jar - files
320
11
161,142
private void scanEntityMappings ( ) throws PersistenceUnitScannerException { /* * From the JPA 2.1 Specification: * * 8.2.1.6.2 Object/relational Mapping Files * An object/relational mapping XML file contains mapping information for the classes listed in it. * * A object/relational mapping XML file named orm.xml may be specified in the META-INF directory * in the root of the persistence unit or in the META-INF directory of any jar file referenced by the persistence. * xml. Alternatively, or in addition, one or more mapping files may be referenced by the * mapping-file elements of the persistence-unit element. These mapping files may be * present anywhere on the class path. * * An orm.xml mapping file or other mapping file is loaded as a resource by the persistence provider. If * a mapping file is specified, the classes and mapping information specified in the mapping file will be * used as described in Chapter 12. If multiple mapping files are specified (possibly including one or more * orm.xml files), the resulting mappings are obtained by combining the mappings from all of the files. * The result is undefined if multiple mapping files (including any orm.xml file) referenced within a single * persistence unit contain overlapping mapping information for any given class. The object/relational * mapping information contained in any mapping file referenced within the persistence unit must be disjoint * at the class-level from object/relational mapping information contained in any other such mapping * file. */ final HashSet < URL > mappingFilesLocated = new HashSet < URL > ( ) ; final HashSet < String > searchNames = new HashSet < String > ( ) ; for ( PersistenceUnitInfo pui : puiList ) { try { mappingFilesLocated . clear ( ) ; searchNames . clear ( ) ; searchNames . add ( "META-INF/orm.xml" ) ; if ( pui . getMappingFileNames ( ) != null ) { searchNames . addAll ( pui . getMappingFileNames ( ) ) ; } for ( String mappingFile : searchNames ) { mappingFilesLocated . addAll ( findORMResources ( pui , mappingFile ) ) ; } final List < EntityMappingsDefinition > parsedOrmList = pu_ormFileParsed_map . get ( pui ) ; pu_ormFiles_map . get ( pui ) . addAll ( mappingFilesLocated ) ; // Process discovered mapping files for ( final URL mappingFileURL : mappingFilesLocated ) { if ( scanned_ormfile_map . containsKey ( mappingFileURL ) ) { // Already processed this ORM File, no need to process it again. parsedOrmList . add ( scanned_ormfile_map . get ( mappingFileURL ) ) ; continue ; } EntityMappingsDefinition emapdef = EntityMappingsFactory . parseEntityMappings ( mappingFileURL ) ; parsedOrmList . add ( emapdef ) ; scanned_ormfile_map . put ( mappingFileURL , emapdef ) ; } } catch ( Exception e ) { FFDCFilter . processException ( e , PersistenceUnitScanner . class . getName ( ) + ".scanEntityMappings" , "460" ) ; throw new PersistenceUnitScannerException ( e ) ; } } }
Scan Entity Mappings Files
716
5
161,143
private List < URL > findORMResources ( PersistenceUnitInfo pui , String ormFileName ) throws IOException { final boolean isMetaInfoOrmXML = "META-INF/orm.xml" . equals ( ormFileName ) ; final ArrayList < URL > retArr = new ArrayList < URL > ( ) ; Enumeration < URL > ormEnum = pui . getClassLoader ( ) . getResources ( ormFileName ) ; while ( ormEnum . hasMoreElements ( ) ) { final URL url = ormEnum . nextElement ( ) ; final String urlExtern = url . toExternalForm ( ) ; // ParserUtils.decode(url.toExternalForm()); if ( ! isMetaInfoOrmXML ) { // If it's not "META-INF/orm.xml", then the mapping files may be present anywhere in the classpath. retArr . add ( url ) ; continue ; } // Check against persistence unit root if ( urlExtern . startsWith ( pui . getPersistenceUnitRootUrl ( ) . toExternalForm ( ) ) ) { retArr . add ( url ) ; continue ; } // Check against Jar files, if any for ( URL jarUrl : pui . getJarFileUrls ( ) ) { final String jarExtern = jarUrl . toExternalForm ( ) ; if ( urlExtern . startsWith ( jarExtern ) ) { retArr . add ( url ) ; continue ; } } } return retArr ; }
Finds all specified ORM files by name constrained in location by the persistence unit root and jar files .
339
21
161,144
public boolean writeSilence ( SIMPMessage m ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writeSilence" , new Object [ ] { m } ) ; JsMessage jsMsg = m . getMessage ( ) ; // There may be Completed ticks after the Value, if so then // write these into the stream too long stamp = jsMsg . getGuaranteedValueValueTick ( ) ; long starts = jsMsg . getGuaranteedValueStartTick ( ) ; long ends = jsMsg . getGuaranteedValueEndTick ( ) ; if ( ends < stamp ) ends = stamp ; TickRange tr = new TickRange ( TickRange . Completed , starts , ends ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilence from: " + starts + " to " + ends + " on Stream " + streamID ) ; } synchronized ( this ) { tr = oststream . writeCompletedRange ( tr ) ; long completedPrefix = oststream . getCompletedPrefix ( ) ; if ( completedPrefix > oack ) { oack = completedPrefix ; } // Only want to send Silence if we know it has been missed // because we have sent something beyond it if ( lastSent > ends ) sendSilence ( ends + 1 , completedPrefix ) ; // SIB0105 // Message silenced so reset the health state if ( blockedStreamAlarm != null ) blockedStreamAlarm . checkState ( false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilence" ) ; setLastSent ( jsMsg . getGuaranteedValueEndTick ( ) ) ; return true ; }
This method uses a Value message to write Silence into the stream either because a message has been filtered out or because it has been rolled back
414
27
161,145
public void writeSilence ( ControlSilence m ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writeSilence" , new Object [ ] { m } ) ; boolean sendMessage = false ; // to use in messages sent downstream long completedPrefix ; // Construct a TickRange from the Silence message long starts = m . getStartTick ( ) ; long ends = m . getEndTick ( ) ; boolean requestedOnly = m . getRequestedOnly ( ) ; TickRange tr = new TickRange ( TickRange . Completed , starts , ends ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilence from: " + starts + " to " + ends + " on Stream " + streamID ) ; } synchronized ( this ) { if ( requestedOnly ) { // Only send this Silence message if there are some ticks in // its tick range which are in Requested state in the stream if ( oststream . containsRequested ( tr ) == false ) sendMessage = false ; } // Write the range of Completed ticks to the stream and // get the resultant maximal Completed range tr = oststream . writeCompletedRange ( tr ) ; if ( oststream . getCompletedPrefix ( ) > oack ) { oack = oststream . getCompletedPrefix ( ) ; } completedPrefix = oststream . getCompletedPrefix ( ) ; } // end synchronized if ( sendMessage ) { // send silence message corresponding to tr to downstream cellule // to target cellule try { downControl . sendSilenceMessage ( tr . startstamp , tr . endstamp , completedPrefix , requestedOnly , priority , reliability , streamID ) ; } catch ( SIResourceException e ) { // FFDC FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.gd.InternalOutputStream.writeSilence" , "1:788:1.83.1.1" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilence" , e ) ; throw e ; } setLastSent ( tr . endstamp ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilence" , Boolean . valueOf ( sendMessage ) ) ; }
This method writes the ticks in a Silence message into the stream It is called when a Silence message arrives from another ME If the RequestedOnly flag in the message is set then the message is only sent on to downstream MEs if they have previously requested it . Otherwise it is always sent .
569
58
161,146
public void writeAckPrefix ( long stamp ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writeAckPrefix" , Long . valueOf ( stamp ) ) ; synchronized ( this ) { // SIB0105 // Update controllable health state if poss if ( stamp >= lastAckExpTick ) { getControlAdapter ( ) . getHealthState ( ) . updateHealth ( HealthStateListener . ACK_EXPECTED_STATE , HealthState . GREEN ) ; // Disable the checking until another ackExpected is sent lastAckExpTick = Long . MAX_VALUE ; } if ( stamp >= lastNackReceivedTick ) { getControlAdapter ( ) . getHealthState ( ) . updateHealth ( HealthStateListener . NACK_RECEIVED_STATE , HealthState . GREEN ) ; // Disable the checking until another ackExpected is sent lastNackReceivedTick = Long . MAX_VALUE ; } // Keep track of the highest ack we have received if ( stamp > ack ) ack = stamp ; // This will update the prefix if stamp > completedPrefix // It also combines any adjacent Completed ranges oststream . setCompletedPrefix ( stamp ) ; long newCompletedPrefix = oststream . getCompletedPrefix ( ) ; if ( newCompletedPrefix > oack ) { oack = newCompletedPrefix ; upControl . sendAckMessage ( null , null , null , newCompletedPrefix , priority , reliability , streamID , false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeAckPrefix" ) ; } }
This method is called when an Ack message is recieved from a downstream ME . It updates the ackPrefix of the stream and then passes the message up to the PubSubInputHandler which will aggregate the Acks from all InternalOutputStreams .
389
51
161,147
public void writeSilenceForced ( TickRange vtr ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writeSilenceForced" , new Object [ ] { vtr } ) ; long start = vtr . startstamp ; long end = vtr . endstamp ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilenceForced from: " + start + " to " + end + " on Stream " + streamID ) ; } TickRange tr = new TickRange ( TickRange . Completed , start , end ) ; synchronized ( this ) { tr = oststream . writeCompletedRangeForced ( tr ) ; try { if ( tr . startstamp == 0 ) { //we are completed up to this point so we can //simulate receiving an ack. This will enable the //src stream to remove the msg from the store if it is no longer //needed writeAckPrefix ( tr . endstamp ) ; } } catch ( SIResourceException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.gd.InternalOutputStream.writeSilenceForced" , "1:1273:1.83.1.1" , this ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilenceForced" ) ; }
This method uses a Value TickRange to write Silence into the stream because a message has expired before it was sent and so needs to be removed from the stream It forces the stream to be updated to Silence without checking the existing state It then updates the upstream control with this new completed prefix
348
56
161,148
public static final byte [ ] serialize ( Serializable serializable ) throws IOException { if ( serializable == null ) { return null ; } ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; ObjectOutputStream objectOutputStream = null ; byte [ ] result = null ; if ( null != _instance ) { SerializationService ss = _instance . serializationServiceRef . getService ( ) ; if ( null != ss ) { objectOutputStream = ss . createObjectOutputStream ( byteArrayOutputStream ) ; } } if ( null == objectOutputStream ) { objectOutputStream = new ObjectOutputStream ( byteArrayOutputStream ) ; } try { objectOutputStream . writeObject ( serializable ) ; result = byteArrayOutputStream . toByteArray ( ) ; } finally { if ( byteArrayOutputStream != null ) { byteArrayOutputStream . close ( ) ; } if ( objectOutputStream != null ) { objectOutputStream . close ( ) ; } } return result ; }
This serializes an object into a byte array .
212
10
161,149
public Object nextElement ( ) { try { return nextElementR ( ) ; } catch ( NoMoreElementsException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".nextElement", "109", this); throw new NoSuchElementException ( ) ; } catch ( EnumeratorException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".nextElement", "112", this); throw new RuntimeException ( e . toString ( ) ) ; } catch ( NoSuchObjectException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".nextElement", "115", this); throw new IllegalStateException ( "Cannot access finder result outside transaction" ) ; } catch ( RemoteException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".nextElement", "118", this); throw new RuntimeException ( e . toString ( ) ) ; } }
Obtain the next element from the enumeration
202
9
161,150
public boolean hasMoreElements ( ) { try { return hasMoreElementsR ( ) ; } catch ( NoMoreElementsException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".hasMoreElements", "131", this); return false ; } catch ( EnumeratorException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".hasMoreElements", "134", this); throw new RuntimeException ( e . toString ( ) ) ; } catch ( NoSuchObjectException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".hasMoreElements", "137", this); throw new IllegalStateException ( "Cannot access finder result outside transaction" ) ; } catch ( RemoteException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".hasMoreElements", "140", this); throw new RuntimeException ( e . toString ( ) ) ; } }
Find out if there are any more elements available
208
9
161,151
public synchronized boolean hasMoreElementsR ( ) throws RemoteException , EnumeratorException { if ( elements != null && index < elements . length ) { return true ; } else if ( ! exhausted ) { // Reset our local cache and attempt to fetch the next batch // from the server try { elements = null ; index = 0 ; elements = fetchElements ( PREFETCH_COUNT ) ; return true ; } catch ( NoMoreElementsException ex ) { // We've exhausted the remote result set // FFDCFilter.processException(ex, CLASS_NAME + ".hasMoreElementsR", // "172", this); return false ; } } // Exhausted! return false ; }
Find out if there are any more elements available ; this method will perform prefetching from the remote result set .
147
23
161,152
public synchronized Object [ ] nextNElements ( int n ) throws RemoteException , EnumeratorException { if ( ! hasMoreElementsR ( ) ) { throw new NoMoreElementsException ( ) ; } EJBObject [ ] remainder = null ; final int numCached = elements . length - index ; if ( ! exhausted && numCached < n ) { // We must fetch more elements from the remote result set // to satisfy the request try { remainder = fetchElements ( n - numCached ) ; } catch ( NoMoreElementsException ex ) { // FFDCFilter.processException(ex, CLASS_NAME + ".nextNElements", // "220", this); } } final int numRemaining = remainder != null ? remainder . length : 0 ; final int totalAvail = numCached + numRemaining ; final int numToReturn = Math . min ( n , totalAvail ) ; final EJBObject [ ] result = new EJBObject [ numToReturn ] ; final int numFromCache = Math . min ( numToReturn , numCached ) ; System . arraycopy ( elements , index , result , 0 , numFromCache ) ; index += numFromCache ; if ( remainder != null ) { System . arraycopy ( remainder , 0 , result , numFromCache , numRemaining ) ; } return result ; }
Obtain the next n elements from the enumeration ; the array may contain fewer than n elements if the enumeration is exhausted .
286
26
161,153
public EJBObject [ ] loadEntireCollection ( ) { EJBObject [ ] result = null ; try { result = ( EJBObject [ ] ) allRemainingElements ( ) ; } catch ( NoMoreElementsException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "270", this); return elements ; } catch ( EnumeratorException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "276", this); throw new RuntimeException ( e . toString ( ) ) ; } catch ( RemoteException e ) { // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "282", this); throw new RuntimeException ( e . toString ( ) ) ; } elements = result ; return result ; }
Load the entire result set in a greedy fashion . This is required to support methods on the Collection interface
186
20
161,154
public synchronized Object [ ] allRemainingElements ( ) throws RemoteException , EnumeratorException { if ( ! hasMoreElementsR ( ) ) { throw new NoMoreElementsException ( ) ; } EJBObject [ ] remainder = null ; if ( ! exhausted ) { // We must fetch the remaining elements from the remote // result set try { //110799 remainder = vEnum . allRemainingElements ( ) ; } catch ( NoMoreElementsException ex ) { // FFDCFilter.processException(ex, CLASS_NAME + ".allRemainingElements", // "313", this); } catch ( java . rmi . NoSuchObjectException exc ) { // FFDCFilter.processException(exc, CLASS_NAME + ".allRemainingElements", // "319", this); throw new com . ibm . ejs . container . finder . CollectionCannotBeFurtherAccessedException ( "Cannot access finder result outside transaction" ) ; } //110799 finally { exhausted = true ; vEnum = null ; } } // Concatenate the unenumerated elements from our local cache // and the remaining elements from the remote result set. final int numCached = elements . length - index ; final int numRemaining = remainder != null ? remainder . length : 0 ; final EJBObject [ ] result = new EJBObject [ numCached + numRemaining ] ; System . arraycopy ( elements , index , result , 0 , numCached ) ; if ( remainder != null ) { System . arraycopy ( remainder , 0 , result , numCached , numRemaining ) ; } elements = null ; return result ; }
Obtain all of the remaining elements from the enumeration
355
11
161,155
void close ( ) { synchronized ( ivPuList ) { for ( JPAPUnitInfo puInfo : ivPuList . values ( ) ) { puInfo . close ( ) ; } ivPuList . clear ( ) ; } }
Close all the active EntityManagers declared in this persistence . xml .
51
14
161,156
JPAPUnitInfo addPU ( String puName , JPAPUnitInfo puInfo ) { synchronized ( ivPuList ) { return ivPuList . put ( puName , puInfo ) ; } }
Adds the puInfo to the collection maintained in this xml info object .
44
14
161,157
StringBuilder toStringBuilder ( StringBuilder sbuf ) { synchronized ( ivPuList ) { sbuf . append ( "\n PxmlInfo: ScopeName=" ) . append ( ivScopeInfo . getScopeName ( ) ) . append ( "\tRootURL = " ) . append ( ivRootURL ) . append ( "\t# PUs = " ) . append ( ivPuList . size ( ) ) . append ( "\t[" ) ; int index = 0 ; for ( JPAPUnitInfo puInfo : ivPuList . values ( ) ) { puInfo . toStringBuilder ( sbuf ) ; if ( ++ index < ivPuList . size ( ) ) { sbuf . append ( ", " ) ; } } sbuf . append ( ' ' ) ; } return sbuf ; }
Dump this persistence . xml data to the input StringBuilder .
172
13
161,158
private static void restoreInvocationSubject ( SubjectCookie cookie ) { try { if ( cookie . token != null ) { // We sync'ed the subject's identity to the thread under setInvocationSubject. // Now restore the previous identity using the token returned when we sync'ed. ThreadIdentityManager . resetChecked ( cookie . token ) ; } } catch ( ThreadIdentityException e ) { throw new SecurityException ( e ) ; } finally { SubjectManagerService sms = smServiceRef . getService ( ) ; if ( sms != null ) { sms . setInvocationSubject ( cookie . subject ) ; } } }
Restore the invocation subject .
134
6
161,159
public RetryState createRetryState ( RetryPolicy policy , MetricRecorder metricRecorder ) { if ( policy == null ) { return new RetryStateNullImpl ( ) ; } else { return new RetryStateImpl ( policy , metricRecorder ) ; } }
Create an object implementing Retry
59
6
161,160
public SyncBulkheadState createSyncBulkheadState ( BulkheadPolicy policy , MetricRecorder metricRecorder ) { if ( policy == null ) { return new SyncBulkheadStateNullImpl ( ) ; } else { return new SyncBulkheadStateImpl ( policy , metricRecorder ) ; } }
Create an object implementing a synchronous Bulkhead
67
9
161,161
public TimeoutState createTimeoutState ( ScheduledExecutorService executorService , TimeoutPolicy policy , MetricRecorder metricRecorder ) { if ( policy == null ) { return new TimeoutStateNullImpl ( ) ; } else { return new TimeoutStateImpl ( executorService , policy , metricRecorder ) ; } }
Create an object implementing Timeout
71
6
161,162
public CircuitBreakerState createCircuitBreakerState ( CircuitBreakerPolicy policy , MetricRecorder metricRecorder ) { if ( policy == null ) { return new CircuitBreakerStateNullImpl ( ) ; } else { return new CircuitBreakerStateImpl ( policy , metricRecorder ) ; } }
Create an object implementing CircuitBreaker
65
7
161,163
public Object [ ] getResults ( String topic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getResults" , topic ) ; if ( cachedResults != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getResults" , cachedResults ) ; return cachedResults ; } postProcess ( topic ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getResults" , "finalResults: " + Arrays . toString ( finalResults ) ) ; return finalResults ; }
postProcessMatches methods of the handlers .
161
9
161,164
protected String createPlainTextJWT ( ) { com . google . gson . JsonObject header = createHeader ( ) ; com . google . gson . JsonObject payload = createPayload ( ) ; String plainTextTokenString = computeBaseString ( header , payload ) ; StringBuffer sb = new StringBuffer ( plainTextTokenString ) ; sb . append ( "." ) . append ( "" ) ; return sb . toString ( ) ; }
Creates the plain text JWT .
100
8
161,165
private ConnectionData findConnectionDataToUse ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "findConnectionDataToUse" ) ; // Look through the the connection data in this group to try and find // a connection with the lowest use count. ConnectionData connectionDataToUse = null ; synchronized ( connectionData ) { int lowestUseCount = conversationsPerConnection ; for ( int i = 0 ; i < connectionData . size ( ) ; ++ i ) { final ConnectionData cd = connectionData . get ( i ) ; if ( cd . getUseCount ( ) < lowestUseCount ) { lowestUseCount = cd . getUseCount ( ) ; connectionDataToUse = cd ; } } // If we cannot find a suitable connection data object, see if the // idle connections pool has a connection we could use to create one. if ( connectionDataToUse == null ) { final IdleConnectionPool p = IdleConnectionPool . getInstance ( ) ; final OutboundConnection oc = p . remove ( groupEndpointDescriptor ) ; if ( oc != null ) { connectionDataToUse = new ConnectionData ( this , groupEndpointDescriptor ) ; oc . setConnectionData ( connectionDataToUse ) ; connectionDataToUse . setConnection ( oc ) ; connectionData . add ( connectionDataToUse ) ; } } // If we now have a connectionDataToUse, increment its use count NOW // so that it won't get accidentally added to the idle pool if ( connectionDataToUse != null ) { connectionDataToUse . incrementUseCount ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findConnectionDataToUse" , connectionDataToUse ) ; return connectionDataToUse ; }
Helper method chooses the connection to use for a new conversation .
408
12
161,166
private Conversation doConnect ( ConversationReceiveListener conversationReceiveListener , ConversationUsageType usageType , JFapAddressHolder jfapAddressHolder , final NetworkConnectionFactoryHolder ncfHolder ) throws JFapConnectFailedException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "doConnect" , new Object [ ] { conversationReceiveListener , usageType , jfapAddressHolder , ncfHolder } ) ; Conversation retConversation ; ConnectionData connectionDataToUse ; synchronized ( connectionMonitor ) { try { connectionDataToUse = findConnectionDataToUse ( ) ; boolean isNewConnectionData = false ; if ( connectionDataToUse == null ) { // We were either unable to find a connection at all, or we could not // find a connection with a use count lower than the maximum number of // conversations we want to share a connection. Either way, create a // new connection and add it to the group. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "connection data does not already exist" ) ; try { NetworkConnection vc = connectOverNetwork ( jfapAddressHolder , ncfHolder ) ; connectionDataToUse = createnewConnectionData ( vc ) ; isNewConnectionData = true ; } catch ( FrameworkException frameworkException ) { // Something went wrong attempting to establish the outbound connection. // Link the exception that was thrown to a new SICommsException and throw // it back to the caller. FFDCFilter . processException ( frameworkException , "com.ibm.ws.sib.jfapchannel.impl.octracker.ConnectionDataGroup.doConnect" , JFapChannelConstants . CONNDATAGROUP_CONNECT_04 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . exception ( this , tc , frameworkException ) ; throw new SIErrorException ( nls . getFormattedMessage ( "CONNDATAGROUP_INTERNAL_SICJ0062" , null , "CONNDATAGROUP_INTERNAL_SICJ0062" ) , frameworkException ) ; } } retConversation = startNewConversation ( connectionDataToUse , conversationReceiveListener , isNewConnectionData , usageType . requiresNormalHandshakeProcessing ( ) ) ; } finally { // Whatever happened, this connection attempt is no longer pending. // //We have to hold the connectionMonitor lock prior to obtaining the lock on 'this' as there is the potential for deadlock in the following //scenario. // //Thread 1 starts the first conversation over the connection and has to perform handshaking. //Thread 2 starts another conversation and has to wait for thread 1 to perform the handshake. This means that thread 2 has acquired the lock on 'this'. //Thread 1 tries to acquire the lock on 'this' below. //Deadlock... synchronized ( this ) { -- connectAttemptsPending ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , connectAttemptsPending + " connection attempts still pending" ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "doConnect" , retConversation ) ; return retConversation ; }
Actually do the connecting creating a new ConnectionData if required
781
11
161,167
private NetworkConnection connectOverNetwork ( JFapAddressHolder addressHolder , NetworkConnectionFactoryHolder factoryHolder ) throws JFapConnectFailedException , FrameworkException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "connectOverNetwork" , new Object [ ] { addressHolder , factoryHolder } ) ; NetworkConnectionFactory vcf = factoryHolder . getFactory ( ) ; NetworkConnection vc = vcf . createConnection ( ) ; Semaphore sem = new Semaphore ( ) ; ClientConnectionReadyCallback callback = new ClientConnectionReadyCallback ( sem ) ; vc . connectAsynch ( addressHolder . getAddress ( ) , callback ) ; sem . waitOnIgnoringInterruptions ( ) ; if ( ! callback . connectionSucceeded ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Connect has failed due to " , callback . getException ( ) ) ; String failureKey ; Object [ ] failureInserts ; if ( addressHolder . getAddress ( ) != null ) { failureKey = "CONNDATAGROUP_CONNFAILED_SICJ0063" ; failureInserts = addressHolder . getErrorInserts ( ) ; } else { failureKey = "CONNDATAGROUP_CONNFAILED_SICJ0080" ; failureInserts = new Object [ ] { } ; } String message = nls . getFormattedMessage ( failureKey , failureInserts , failureKey ) ; throw new JFapConnectFailedException ( message , callback . getException ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "connectOverNetwork" , vc ) ; return vc ; }
Create a new connection over the network
430
7
161,168
private ConnectionData createnewConnectionData ( NetworkConnection vc ) throws FrameworkException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createnewConnectionData" , vc ) ; ConnectionData connectionDataToUse ; NetworkConnectionContext connLink = vc . getNetworkConnectionContext ( ) ; connectionDataToUse = new ConnectionData ( this , groupEndpointDescriptor ) ; connectionDataToUse . incrementUseCount ( ) ; // New connections start with a use count of zero and it is now in use // No need to lock as it's not in the connectionData list yet OutboundConnection oc = new OutboundConnection ( connLink , vc , tracker , heartbeatInterval , heartbeatTimeout , connectionDataToUse ) ; connectionDataToUse . setConnection ( oc ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createnewConnectionData" , connectionDataToUse ) ; return connectionDataToUse ; }
Create a new Connection data object
241
6
161,169
private Conversation startNewConversation ( ConnectionData connectionDataToUse , ConversationReceiveListener conversationReceiveListener , boolean isNewConnectionData , boolean handshake ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "startNewConversation" , new Object [ ] { connectionDataToUse , conversationReceiveListener , Boolean . valueOf ( isNewConnectionData ) , Boolean . valueOf ( handshake ) } ) ; Conversation retConversation ; synchronized ( this ) { if ( isNewConnectionData ) { synchronized ( connectionData ) { connectionData . add ( connectionDataToUse ) ; } } // Start a new conversation over the designated connection. // If this is a connection on behalf of the WMQRA then we need to disable the normal handshaking behaviour // in order to allow other non WMQRA conversations to handshake as normal. retConversation = connectionDataToUse . getConnection ( ) . startNewConversation ( conversationReceiveListener , handshake ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "startNewConversation" , retConversation ) ; return retConversation ; }
start a new conversation using the specified ConnectionData object
285
10
161,170
protected synchronized void connectionPending ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "connectionPending" ) ; ++ connectAttemptsPending ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , connectAttemptsPending + " connection attempts now pending" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "connectionPending" ) ; }
Marks the group as having been selected to establish a new conversation . This is used to close a window where the group can be selected but then get closed before the connect call is made .
136
38
161,171
protected synchronized void close ( OutboundConnection connection ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "close" , connection ) ; // Paranoia: Check that this connection believes that it belongs in this group. if ( connection . getConnectionData ( ) . getConnectionDataGroup ( ) != this ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "connection does not belong to this group" , connection . getConnectionData ( ) . getConnectionDataGroup ( ) ) ; throw new SIErrorException ( nls . getFormattedMessage ( "CONNDATAGROUP_INTERNAL_SICJ0062" , null , "CONNDATAGROUP_INTERNAL_SICJ0062" ) ) ; // D226223 } ConnectionData data ; boolean isNowIdle = false ; synchronized ( connectionData ) { data = connection . getConnectionData ( ) ; data . decrementUseCount ( ) ; if ( data . getUseCount ( ) == 0 ) { // If no one is using this connection, then remove it from our group and // add it to the idle pool. connectionData . remove ( data ) ; isNowIdle = true ; } } if ( isNowIdle ) { IdleConnectionPool . getInstance ( ) . add ( data . getConnection ( ) , groupEndpointDescriptor ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "close" ) ; }
Close a conversation on the specified connection . The connection must be part of this group . If the connection has no more conversations left using it then it is added to the idle pool .
366
36
161,172
protected boolean isEmpty ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "isEmpty" ) ; boolean result ; synchronized ( this ) { synchronized ( connectionData ) { result = connectionData . isEmpty ( ) ; } result = result && ( connectAttemptsPending == 0 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "isEmpty" , "" + result ) ; return result ; }
Determines if this group is empty . For the group to be empty it must contain no connection data objects and have no connection attempts pending . This second criteria stops the group from being discarded between selection for establishing a new conversation and actually establishing the conversation .
128
51
161,173
protected void purgeFromInvalidateImpl ( OutboundConnection connection , boolean notifyPeer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "purgeFromInvalidateImpl" , new Object [ ] { connection , Boolean . valueOf ( notifyPeer ) } ) ; purge ( connection , true , notifyPeer ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "purgeFromInvalidateImpl" ) ; }
Purge a connection from this group from within invalidate processing . Purging a connection removes it from the group even if the connection still has conversations associated with it . The purged connection is closed and not added to the idle pool .
131
47
161,174
protected void purgeClosedConnection ( OutboundConnection connection ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "purgeClosedConnection" , connection ) ; purge ( connection , false , false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "purgeClosedConnection" ) ; }
Purge a connection from this group because it has already been closed . The purged connection is not added to the idle pool .
105
26
161,175
public void removeConnectionDataFromGroup ( ConnectionData cd ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeConnectionDataFromGroup" , new Object [ ] { cd } ) ; boolean removed = false ; synchronized ( connectionData ) { removed = connectionData . remove ( cd ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeConnectionDataFromGroup" , new Object [ ] { removed } ) ; }
Remove the connection from the group
132
6
161,176
public static String getDateString ( Date date ) { SimpleDateFormat sdf = new SimpleDateFormat ( sdformatMillisec ) ; sdf . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; StringBuffer dateBuffer = new StringBuffer ( sdf . format ( date ) ) ; // above string is in this format // 2005-05-04T09:34:18.444-0400 // convert it to // 2005-05-04T09:34:18.444-04:00 dateBuffer . insert ( dateBuffer . length ( ) - 2 , ":" ) ; return dateBuffer . toString ( ) ; }
Returns a date String from the specified Date object . It is expected to be called before passing the date to SDO set method .
140
26
161,177
public static String [ ] getRDNAttributes ( String dn ) { String rdnstr = getRDN ( dn ) ; StringTokenizer st = new StringTokenizer ( rdnstr . toLowerCase ( ) , "+" ) ; List < String > list = new ArrayList < String > ( ) ; while ( st . hasMoreTokens ( ) ) { String rdn = st . nextToken ( ) ; int index = rdn . indexOf ( ' ' ) ; if ( index > - 1 ) { list . add ( rdn . substring ( 0 , index ) ) ; } } return list . toArray ( new String [ 0 ] ) ; }
Return an array of RDN attributes of the given DN in lower case form .
143
16
161,178
public static String getRDN ( String DN ) { if ( DN == null || DN . trim ( ) . length ( ) == 0 ) { return DN ; } String RDN = null ; try { LdapName name = new LdapName ( DN ) ; if ( name . size ( ) == 0 ) { return DN ; } RDN = name . get ( name . size ( ) - 1 ) ; } catch ( InvalidNameException e ) { e . getMessage ( ) ; DN = DN . trim ( ) ; int pos1 = DN . indexOf ( ' ' ) ; if ( DN . charAt ( pos1 - 1 ) == ' ' ) { pos1 = DN . indexOf ( pos1 , ' ' ) ; } if ( pos1 > - 1 ) { RDN = DN . substring ( 0 , pos1 ) . trim ( ) ; } else { RDN = DN ; } } return RDN ; }
Gets the RDN from the specified DN For example uid = persona will be returned for given uid = persona cn = users dc = yourco dc = com .
200
36
161,179
static public LdapURL [ ] getLdapURLs ( Attribute attr ) throws WIMException { final String METHODNAME = "getLdapURLs" ; LdapURL [ ] ldapURLs = new LdapURL [ 0 ] ; if ( attr != null ) { List < LdapURL > ldapURLList = new ArrayList < LdapURL > ( attr . size ( ) ) ; try { for ( NamingEnumeration < ? > enu = attr . getAll ( ) ; enu . hasMoreElements ( ) ; ) { LdapURL ldapURL = new LdapURL ( ( String ) ( enu . nextElement ( ) ) ) ; if ( ldapURL . parsedOK ( ) ) { ldapURLList . add ( ldapURL ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Member URL query: " + ldapURL . get_url ( ) + " is invalid and ingored." ) ; } } } } catch ( NamingException e ) { throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ) ; } ldapURLs = ldapURLList . toArray ( ldapURLs ) ; } return ldapURLs ; }
Gets the LdapURL array from the given dynamic member attribute .
350
15
161,180
public static String getUniqueKey ( X509Certificate cert ) { // TBD - Would like to use public key instead of subject name, but // cert.getPublicKey().getEncoded() appears to return different // values for each call, using the same certificate?? StringBuffer key = new StringBuffer ( "subjectDN:" ) ; key . append ( cert . getSubjectX500Principal ( ) . getName ( ) ) . append ( "issuerDN:" ) . append ( cert . getIssuerX500Principal ( ) . getName ( ) ) ; // TODO:: // return Base64Coder.base64Encode(getDigest(key.toString())); return null ; }
Get a unique key for a certificate .
149
8
161,181
static String getDNSubField ( String varName , String DN ) throws CertificateMapperException { if ( varName . equals ( "DN" ) ) { return DN ; // return the whole DN } // Parse the DN looking for 'varName' StringTokenizer st = new StringTokenizer ( DN ) ; for ( ; ; ) { String name , value ; try { name = st . nextToken ( ",= " ) ; value = st . nextToken ( "," ) ; if ( value != null ) { value = value . substring ( 1 ) ; } } catch ( NoSuchElementException e ) { e . getMessage ( ) ; break ; } if ( name . equals ( varName ) ) { return value ; } } throw new CertificateMapperException ( WIMMessageKey . UNKNOWN_DN_FIELD , Tr . formatMessage ( tc , WIMMessageKey . UNKNOWN_DN_FIELD , WIMMessageHelper . generateMsgParms ( varName ) ) ) ; }
Given input return the digest version .
211
7
161,182
public static short getMembershipScope ( String scope ) { if ( scope != null ) { scope = scope . trim ( ) ; if ( LdapConstants . LDAP_DIRECT_GROUP_MEMBERSHIP_STRING . equalsIgnoreCase ( scope ) ) { return LdapConstants . LDAP_DIRECT_GROUP_MEMBERSHIP ; } else if ( LdapConstants . LDAP_NESTED_GROUP_MEMBERSHIP_STRING . equalsIgnoreCase ( scope ) ) { return LdapConstants . LDAP_NESTED_GROUP_MEMBERSHIP ; } else if ( LdapConstants . LDAP_ALL_GROUP_MEMBERSHIP_STRING . equalsIgnoreCase ( scope ) ) { return LdapConstants . LDAP_ALL_GROUP_MEMBERSHIP ; } else { return LdapConstants . LDAP_DIRECT_GROUP_MEMBERSHIP ; } } else { return LdapConstants . LDAP_DIRECT_GROUP_MEMBERSHIP ; } }
Gets the short form the scope from the string form of the scope
255
14
161,183
public static boolean inAttributes ( String attrName , Attributes attrs ) { for ( NamingEnumeration < String > neu = attrs . getIDs ( ) ; neu . hasMoreElements ( ) ; ) { String attrId = neu . nextElement ( ) ; if ( attrId . equalsIgnoreCase ( attrName ) ) { return true ; } } return false ; }
Whether the specified attribute name is contained in the attributes .
88
11
161,184
public static Attribute cloneAttribute ( String newAttrName , Attribute attr ) throws WIMSystemException { Attribute newAttr = new BasicAttribute ( newAttrName ) ; try { for ( NamingEnumeration < ? > neu = attr . getAll ( ) ; neu . hasMoreElements ( ) ; ) { newAttr . add ( neu . nextElement ( ) ) ; } } catch ( NamingException e ) { throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ) ; } return newAttr ; }
Clone the specified attribute with a new name .
168
10
161,185
public static String convertToDashedString ( byte [ ] objectGUID ) { StringBuilder displayStr = new StringBuilder ( ) ; displayStr . append ( prefixZeros ( objectGUID [ 3 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 2 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 1 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 0 ] & 0xFF ) ) ; displayStr . append ( "-" ) ; displayStr . append ( prefixZeros ( objectGUID [ 5 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 4 ] & 0xFF ) ) ; displayStr . append ( "-" ) ; displayStr . append ( prefixZeros ( objectGUID [ 7 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 6 ] & 0xFF ) ) ; displayStr . append ( "-" ) ; displayStr . append ( prefixZeros ( objectGUID [ 8 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 9 ] & 0xFF ) ) ; displayStr . append ( "-" ) ; displayStr . append ( prefixZeros ( objectGUID [ 10 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 11 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 12 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 13 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 14 ] & 0xFF ) ) ; displayStr . append ( prefixZeros ( objectGUID [ 15 ] & 0xFF ) ) ; return displayStr . toString ( ) ; }
Convert the byte array to Active Directory GUID format .
426
12
161,186
public static JsonValue serializeAsJson ( Object o ) throws IOException { try { return findFieldsToSerialize ( o ) . mainObject ; } catch ( IllegalStateException ise ) { // the reflective attempt to build the object failed. throw new IOException ( "Unable to build JSON for Object" , ise ) ; } catch ( JsonException e ) { throw new IOException ( "Unable to build JSON for Object" , e ) ; } }
Convert a POJO into a serialized JsonValue object
102
13
161,187
private static ClassAndMethod getClassForFieldName ( String fieldName , Class < ? > classToLookForFieldIn ) { return internalGetClassForFieldName ( fieldName , classToLookForFieldIn , false ) ; }
Gets a class for a JSON field name by looking in a given Class for an appropriate setter . The setter is assumed not to be a Collection .
49
32
161,188
private static ClassAndMethod getClassForCollectionOfFieldName ( String fieldName , Class < ? > classToLookForFieldIn ) { return internalGetClassForFieldName ( fieldName , classToLookForFieldIn , true ) ; }
Gets a class for a JSON field name by looking in a given Class for an appropriate setter . The setter is assumed to be a Collection .
51
31
161,189
private static ClassAndMethod internalGetClassForFieldName ( String fieldName , Class < ? > classToLookForFieldIn , boolean isForArray ) { Method found = null ; //precalc the field name as a setter to use for each method test. String fieldNameAsASetter = new StringBuilder ( "set" ) . append ( fieldName . substring ( 0 , 1 ) . toUpperCase ( ) ) . append ( fieldName . substring ( 1 ) ) . toString ( ) ; //hunt for any matching setter in the object for ( Method m : classToLookForFieldIn . getMethods ( ) ) { String methodName = m . getName ( ) ; //eligible setters must only accept a single argument. if ( m . getParameterTypes ( ) . length == 1 && methodName . equals ( fieldNameAsASetter ) ) { found = m ; break ; } } //at the mo, if we don't match a setter, we sysout a warning, this will likely need to become a toggle. if ( found == null ) { if ( DataModelSerializer . IGNORE_UNKNOWN_FIELDS ) { return null ; } else { throw new IllegalStateException ( "Data Model Error: Found unexpected JSON field " + fieldName + " supposedly for in class " + classToLookForFieldIn . getName ( ) ) ; } } else { ClassAndMethod cm = new ClassAndMethod ( ) ; cm . m = found ; if ( isForArray ) { //for an array we return the type of the collection, eg String for List<String> instead of List. Type t = found . getGenericParameterTypes ( ) [ 0 ] ; cm . cls = getClassForType ( t ) ; return cm ; } else { cm . cls = found . getParameterTypes ( ) [ 0 ] ; return cm ; } } }
Utility method given a JSON field name and an associated POJO it will hunt for the appropriate setter to use and if located return the type the setter expects along with a reflected reference to the method itself .
403
43
161,190
public static void addThreadIdentityService ( ThreadIdentityService tis ) { if ( tis != null ) { threadIdentityServices . add ( tis ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "A ThreadIdentityService implementation was added." , tis . getClass ( ) . getName ( ) ) ; } } }
Add a ThreadIdentityService reference . This method is called by ThreadIdentityManagerConfigurator when a ThreadIdentityService shows up in the OSGI framework .
92
34
161,191
public static void addJ2CIdentityService ( J2CIdentityService j2cIdentityService ) { if ( j2cIdentityService != null ) { j2cIdentityServices . add ( j2cIdentityService ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "A J2CIdentityService implementation was added." , j2cIdentityService . getClass ( ) . getName ( ) ) ; } } }
Add a J2CIdentityService reference . This method is called by ThreadIdentityManagerConfigurator when a J2CIdentityService shows up in the OSGI framework .
116
38
161,192
public static void removeThreadIdentityService ( ThreadIdentityService tis ) { if ( tis != null ) { threadIdentityServices . remove ( tis ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "A ThreadIdentityService implementation was removed." , tis . getClass ( ) . getName ( ) ) ; } } }
Remove a ThreadIdentityService reference . This method is called by ThreadIdentityManagerConfigurator when a ThreadIdentityService leaves the OSGI framework .
92
32
161,193
public static void removeJ2CIdentityService ( J2CIdentityService j2cIdentityService ) { if ( j2cIdentityService != null ) { j2cIdentityServices . remove ( j2cIdentityService ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "A J2CIdentityService implementation was removed." , j2cIdentityService . getClass ( ) . getName ( ) ) ; } } }
Remove a J2CIdentityService reference . This method is called by ThreadIdentityManagerConfigurator when a J2CIdentityService leaves the OSGI framework .
116
36
161,194
public static void removeAllThreadIdentityServices ( ) { threadIdentityServices . clear ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "All the ThreadIdentityService implementations were removed." ) ; } }
Remove all the ThreadIdentityService references . This method is called by ThreadIdentityManagerConfigurator when the ThreadIdentityService service tracker is closed .
64
32
161,195
public static void removeAllJ2CIdentityServices ( ) { j2cIdentityServices . clear ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "All the J2CIdentityService implementations were removed." ) ; } }
Remove all the J2CIdentityService references . This method is called by ThreadIdentityManagerConfigurator when the J2CIdentityService service tracker is closed .
70
36
161,196
private static boolean checkForRecursionAndSet ( ) { if ( recursionMarker . get ( ) == null ) { recursionMarker . set ( Boolean . TRUE ) ; return false ; } else { return true ; // recursion detected. } }
Check for recursion .
54
5
161,197
public static Object runAsServer ( ) { LinkedHashMap < ThreadIdentityService , Object > token = null ; if ( ! checkForRecursionAndSet ( ) ) { try { for ( int i = 0 , size = threadIdentityServices . size ( ) ; i < size ; ++ i ) { ThreadIdentityService tis = threadIdentityServices . get ( i ) ; if ( tis . isAppThreadIdentityEnabled ( ) ) { if ( token == null ) { token = new LinkedHashMap < ThreadIdentityService , Object > ( ) ; } token . put ( tis , tis . runAsServer ( ) ) ; } } } finally { resetRecursionCheck ( ) ; } } return token == null ? Collections . EMPTY_MAP : token ; }
Set the server s identity as the thread identity .
170
10
161,198
@ SuppressWarnings ( { "rawtypes" } ) private static void resetCheckedInternal ( Object token , Exception firstException ) throws ThreadIdentityException { Exception cachedException = firstException ; if ( threadIdentityServices . isEmpty ( ) == false || j2cIdentityServices . isEmpty ( ) == false ) { if ( ! checkForRecursionAndSet ( ) ) { try { if ( token != null ) { Map tokenMap = ( Map ) token ; int size = tokenMap . size ( ) ; if ( size > 0 ) { @ SuppressWarnings ( "unchecked" ) List < Map . Entry > identityServicesToTokensMap = new ArrayList < Map . Entry > ( tokenMap . entrySet ( ) ) ; for ( int idx = size - 1 ; idx >= 0 ; idx -- ) { Map . Entry entry = identityServicesToTokensMap . get ( idx ) ; Object identityService = entry . getKey ( ) ; Object identityServiceToken = entry . getValue ( ) ; try { if ( identityService instanceof ThreadIdentityService ) { ( ( ThreadIdentityService ) identityService ) . reset ( identityServiceToken ) ; } else if ( identityService instanceof J2CIdentityService ) { ( ( J2CIdentityService ) identityService ) . reset ( identityServiceToken ) ; } } catch ( Exception e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , thisClass , "385" ) ; if ( cachedException == null ) { cachedException = e ; } } } } } } finally { resetRecursionCheck ( ) ; if ( cachedException != null ) { throw new ThreadIdentityException ( cachedException ) ; } } } } }
Reset the identity on the thread .
378
8
161,199
public static Subject getJ2CInvocationSubject ( ) { Subject j2cSubject = null ; for ( J2CIdentityService j2cIdentityService : j2cIdentityServices ) { if ( j2cIdentityService . isJ2CThreadIdentityEnabled ( ) ) { Subject subject = j2cIdentityService . getJ2CInvocationSubject ( ) ; if ( subject != null ) { j2cSubject = subject ; break ; } } } return j2cSubject ; }
Get a J2C subject based on the invocation subject . Use first subject that is not null .
111
20