idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,300
@ Override protected MatchResponse getMatchResponse ( SecurityConstraint securityConstraint , String resourceName , String method ) { CollectionMatch collectionMatch = getCollectionMatch ( securityConstraint . getWebResourceCollections ( ) , resourceName , method ) ; if ( CollectionMatch . RESPONSE_NO_MATCH . equals ( collectionMatch ) ) { return MatchResponse . NO_MATCH_RESPONSE ; } if ( com . ibm . ws . webcontainer . osgi . WebContainer . getServletContainerSpecLevel ( ) >= 31 ) { if ( collectionMatch . isExactMatch ( ) && securityConstraint . isAccessUncovered ( ) && securityConstraint . isFromHttpConstraint ( ) ) { return new MatchResponse ( securityConstraint . getRoles ( ) , securityConstraint . isSSLRequired ( ) , securityConstraint . isAccessPrecluded ( ) , CollectionMatch . RESPONSE_PERMIT ) ; } } return new MatchResponse ( securityConstraint . getRoles ( ) , securityConstraint . isSSLRequired ( ) , securityConstraint . isAccessPrecluded ( ) , collectionMatch ) ; }
Gets the response object that contains the roles the SSL required and access precluded indicators . Gets the response using the standard method algorithm .
257
27
161,301
public void purge ( ) { synchronized ( this ) { // Clear all references to VirtualHost objects for ( DynamicVirtualHost host : hostMap . values ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Purge host : " + host . hashCode ( ) + ", this : " + this ) ; } host . getHostConfiguration ( ) . setConfiguration ( null ) ; } hostMap . clear ( ) ; } //do not clear the transport map. //DS looks after the transport map via set/unset/updateVirtualHost //transportMap.clear(); }
Called when the webcontainer is deactivated . This will clean up all maps within the host manager to facilitate garbage collection and clean up .
140
28
161,302
private void setSsoTokenCredential ( Subject subject , String principalAccessId ) throws CredentialException { try { TokenManager tokenManager = tokenManagerRef . getService ( ) ; SingleSignonToken ssoToken = null ; Set < Token > tokens = subject . getPrivateCredentials ( Token . class ) ; if ( tokens . isEmpty ( ) == false ) { Token ssoLtpaToken = tokens . iterator ( ) . next ( ) ; subject . getPrivateCredentials ( ) . remove ( ssoLtpaToken ) ; ssoToken = tokenManager . createSSOToken ( ssoLtpaToken ) ; } else { Map < String , Object > tokenData = new HashMap < String , Object > ( ) ; tokenData . put ( "unique_id" , principalAccessId ) ; ssoToken = tokenManager . createSSOToken ( tokenData ) ; } subject . getPrivateCredentials ( ) . add ( ssoToken ) ; } catch ( TokenCreationFailedException e ) { throw new CredentialException ( e . getLocalizedMessage ( ) ) ; } }
Create an SSO token for the specified accessId .
240
11
161,303
public ManagedObject get ( Token token ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) { trace . entry ( this , cclass , "get" , token ) ; trace . exit ( this , cclass , "get returns null" ) ; } return null ; // TODO If the memory object store has been restarted after a restart of the ObjectManager, // TODO we may have reused an ObjectSequenceNumber, in which case rathet than findingin null // TODO getManagedObject will find a newly created MAnagedObject instead of null. // TODO Need some kind of ObjectManagerCycle number in the Token! // TODO Alternatively we know that any Token trying to find the currentToken after restart // TODO of the ObjectMAnager must have been restored from previous run so it must return // TODO null and leave the get method the to throw an exception. // TODO Alternatively we could occasionally save a safe staer sequencenumber, perhaps on e // TODO checkpoint when the ObjectStopre is serialized anyway. }
Retrieve an object in the store . For MemoryObjectStores this should only be called for a ManagedObject that was lost over a restart so null is returned .
233
34
161,304
public synchronized void flush ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) { trace . entry ( this , cclass , "flush" ) ; trace . exit ( this , cclass , "flush" ) ; } }
For MemoryObjectstore there is nothing to do .
63
10
161,305
static void buildEjbWebServiceEndpointInfos ( EndpointInfoBuilder endpointInfoBuilder , EndpointInfoBuilderContext ctx , JaxWsServerMetaData jaxWsServerMetaData , List < EJBEndpoint > ejbEndpoints , JaxWsModuleInfo jaxWsModuleInfo ) throws UnableToAdaptException { Set < String > presentedServices = jaxWsModuleInfo . getEndpointImplBeanClassNames ( ) ; for ( EJBEndpoint ejbEndpoint : ejbEndpoints ) { if ( ! ejbEndpoint . isWebService ( ) ) { continue ; } if ( presentedServices . contains ( ejbEndpoint . getClassName ( ) ) ) { continue ; } String ejbName = ejbEndpoint . getJ2EEName ( ) . getComponent ( ) ; ctx . addContextEnv ( JaxWsConstants . ENV_ATTRIBUTE_ENDPOINT_BEAN_NAME , ejbName ) ; EndpointInfo endpointInfo = endpointInfoBuilder . build ( ctx , ejbEndpoint . getClassName ( ) , EndpointType . EJB ) ; if ( endpointInfo != null ) { jaxWsModuleInfo . addEndpointInfo ( ejbEndpoint . getName ( ) , endpointInfo ) ; jaxWsServerMetaData . putEndpointNameAndJ2EENameEntry ( ejbName , ejbEndpoint . getJ2EEName ( ) ) ; } } }
build Web Service endpoint infos
336
6
161,306
public static Jose4jRsaJWK getInstance ( int size , String alg , String use , String type ) { String kid = RandomUtils . getRandomAlphaNumeric ( KID_LENGTH ) ; KeyPairGenerator keyGenerator = null ; try { keyGenerator = KeyPairGenerator . getInstance ( "RSA" ) ; } catch ( NoSuchAlgorithmException e ) { // This should not happen, since we hardcoded as "RSA" if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught unexpected exception: " + e . getLocalizedMessage ( ) , e ) ; } return null ; } keyGenerator . initialize ( size ) ; KeyPair keypair = keyGenerator . generateKeyPair ( ) ; RSAPublicKey pubKey = ( RSAPublicKey ) keypair . getPublic ( ) ; RSAPrivateKey priKey = ( RSAPrivateKey ) keypair . getPrivate ( ) ; Jose4jRsaJWK jwk = new Jose4jRsaJWK ( pubKey ) ; jwk . setPrivateKey ( priKey ) ; jwk . setAlgorithm ( alg ) ; jwk . setKeyId ( kid ) ; jwk . setUse ( ( use == null ) ? JwkConstants . sig : use ) ; return jwk ; }
generate a new JWK with the specified parameters
301
11
161,307
public static Jose4jRsaJWK getInstance ( String alg , String use , PublicKey publicKey , PrivateKey privateKey , String kid ) { //String kid = RandomUtils.getRandomAlphaNumeric(KID_LENGTH); RSAPublicKey pubKey = ( RSAPublicKey ) publicKey ; RSAPrivateKey priKey = ( RSAPrivateKey ) privateKey ; Jose4jRsaJWK jwk = new Jose4jRsaJWK ( pubKey ) ; jwk . setPrivateKey ( priKey ) ; jwk . setAlgorithm ( alg ) ; jwk . setKeyId ( kid ) ; jwk . setUse ( use == null ? JwkConstants . sig : use ) ; return jwk ; }
alg use publicKey privateKey
170
6
161,308
private List < Object > reprocessFormParams ( Method method , List < Object > origParams , Message m ) { Form form = null ; boolean hasFormParamAnnotations = false ; Object [ ] newValues = new Object [ origParams . size ( ) ] ; java . lang . reflect . Parameter [ ] methodParams = method . getParameters ( ) ; for ( int i = 0 ; i < methodParams . length ; i ++ ) { if ( Form . class . equals ( methodParams [ i ] . getType ( ) ) ) { form = ( Form ) origParams . get ( i ) ; } if ( methodParams [ i ] . getAnnotation ( FormParam . class ) != null ) { hasFormParamAnnotations = true ; } else { newValues [ i ] = origParams . get ( i ) ; } } if ( ! hasFormParamAnnotations || form == null ) { return origParams ; } for ( int i = 0 ; i < newValues . length ; i ++ ) { if ( newValues [ i ] == null ) { String formFieldName = methodParams [ i ] . getAnnotation ( FormParam . class ) . value ( ) ; List < String > values = form . asMap ( ) . get ( formFieldName ) ; newValues [ i ] = InjectionUtils . createParameterObject ( values , methodParams [ i ] . getType ( ) , methodParams [ i ] . getParameterizedType ( ) , methodParams [ i ] . getAnnotations ( ) , ( String ) origParams . get ( i ) , false , ParameterType . FORM , m ) ; if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . log ( Level . FINEST , "replacing @FormParam value of {0} with {1}" , new Object [ ] { origParams . get ( i ) , newValues [ i ] } ) ; } } } return Arrays . asList ( newValues ) ; }
Liberty change start - CXF - 7860
437
11
161,309
private Collection < LibertyVersion > filterVersions ( Collection < LibertyVersion > minimumVersions , String version ) { LibertyVersion versionToMatch = LibertyVersion . valueOf ( version ) ; if ( versionToMatch == null ) { return minimumVersions ; } Collection < LibertyVersion > filteredVersions = new HashSet < LibertyVersion > ( ) ; for ( LibertyVersion versionToTest : minimumVersions ) { if ( versionToTest . matchesToMicros ( versionToMatch ) ) { filteredVersions . add ( versionToTest ) ; } } return filteredVersions ; }
This will filter the supplied versions to make sure they all have the same major minor and micro parts as the supplied version . This may return the original collection .
114
31
161,310
Map < Object , Object > createOrRestoreMap ( FacesContext context , String prefix , boolean create ) { ExternalContext external = context . getExternalContext ( ) ; Map < String , Object > sessionMap = external . getSessionMap ( ) ; Map < Object , Object > map = ( Map < Object , Object > ) sessionMap . get ( prefix ) ; if ( map == null && create ) { map = new ConcurrentHashMap < Object , Object > ( ) ; sessionMap . put ( prefix , map ) ; } return map ; }
Create a new subkey - wrapper of the session map with the given prefix . This wrapper is used to implement the maps for the flash scope . For more information see the SubKeyMap doc .
115
39
161,311
public static TSSConfig getTSSConfig ( Map < String , Object > props , Map < OptionsKey , List < TransportAddress > > addrMap , Bundle bundle ) throws Exception { TSSConfig tssConfig = new TSSConfig ( ) ; List < Map < String , Object > > tssConfigs = Nester . nest ( CSIV2_CONFIGURATION , props ) ; if ( ! tssConfigs . isEmpty ( ) ) { Map < String , Object > properties = tssConfigs . get ( 0 ) ; // tssConfig.setInherit((Boolean) properties.get(INHERIT)); List < Map < String , Object > > mechList = Nester . nest ( COMPOUND_SEC_MECH_TYPE_LIST , properties ) ; //TODO liberty get the ssl transport info from the corbabean? // List<Map<String, Object>> transportMechGroups = mechInfo.get(SSL_OPTIONS); // if (!transportMechGroups.isEmpty()) { // Map<String, Object> transportMechGroup = transportMechGroups.get(0); // String type = (String) transportMechGroup.get(CONFIG_REFERENCE_TYPE); // if (SSL_TRANSPORT_MECH.equals(type)) { // tssConfig.setTransport_mech(extractSSL(transportMechGroup)); // } else if (SECIOP_TRANSPORT_MECH.equals(type)) { // throw new IllegalStateException("SECIOP processing not implemented"); // } else { // throw new IllegalStateException("Unrecognized transport mech type: " + type); // } // } else { // tssConfig.setTransport_mech(new TSSNULLTransportConfig()); // } // List<Map<String, Object>> secmechlists = mechInfo.get(COMPOUND_SEC_MECH_TYPE_LIST); // if (!secmechlists.isEmpty()) { // Map<String, Object> secMechList = secmechlists.get(0); TSSCompoundSecMechListConfig mechListConfig = tssConfig . getMechListConfig ( ) ; mechListConfig . setStateful ( ( Boolean ) properties . get ( STATEFUL ) ) ; // List<Map<String, Object>> mechList = Nester.nest(COMPOUND_SECH_MECH_LIST, secMechList); for ( Map < String , Object > mech : mechList ) { TSSCompoundSecMechConfig cMech = extractCompoundSecMech ( mech , addrMap , bundle ) ; // cMech.setTransport_mech(tssConfig.getTransport_mech()); mechListConfig . add ( cMech ) ; } // } } return tssConfig ; }
Returns a TSSConfig object initialized with the input object as an XML string .
614
16
161,312
public ZipFileData addFirst ( ZipFileData newFirstData ) { String newFirstPath = newFirstData . path ; Cell dupCell = cells . get ( newFirstPath ) ; if ( dupCell != null ) { throw new IllegalArgumentException ( "Path [ " + newFirstPath + " ] is already stored" ) ; } Cell oldFirstCell = anchor . next ; Cell newFirstCell = new Cell ( newFirstData ) ; cells . put ( newFirstPath , newFirstCell ) ; newFirstCell . putBetween ( anchor , oldFirstCell ) ; return oldFirstCell . data ; }
Add data as new first data .
129
7
161,313
public ZipFileData addLast ( ZipFileData newLastData ) { String newLastPath = newLastData . path ; Cell dupCell = cells . get ( newLastPath ) ; if ( dupCell != null ) { throw new IllegalArgumentException ( "Path [ " + newLastPath + " ] is already stored" ) ; } Cell oldLastCell = anchor . prev ; Cell newLastCell = new Cell ( newLastData ) ; cells . put ( newLastPath , newLastCell ) ; newLastCell . putBetween ( oldLastCell , anchor ) ; return oldLastCell . data ; }
Add data as new last data .
129
7
161,314
public ZipFileData addLast ( ZipFileData newLastData , int maximumSize ) { String newLastPath = newLastData . path ; Cell dupCell = cells . get ( newLastPath ) ; if ( dupCell != null ) { throw new IllegalArgumentException ( "Path [ " + newLastPath + " ] is already stored" ) ; } int size = size ( ) ; if ( ( maximumSize == - 1 ) || ( size < maximumSize ) ) { @ SuppressWarnings ( "unused" ) ZipFileData oldLastData = addLast ( newLastData ) ; return null ; } Cell oldFirstCell = anchor . next ; ZipFileData oldFirstData = oldFirstCell . data ; String oldFirstPath = oldFirstData . path ; if ( oldFirstCell != cells . remove ( oldFirstPath ) ) { throw new IllegalStateException ( "Bad cell alignment on path [ " + oldFirstPath + " ]" ) ; } oldFirstCell . data = newLastData ; cells . put ( newLastPath , oldFirstCell ) ; if ( size != 1 ) { oldFirstCell . excise ( ) ; oldFirstCell . putBetween ( anchor . prev , anchor ) ; } return oldFirstData ; }
Add data as the last data of the store . If the addition pushes a cell out of the list answer the data of the cell which was removed .
265
30
161,315
public void refresh ( ApplicationMonitorConfig config ) { _config . set ( config ) ; UpdateTrigger trigger = config . getUpdateTrigger ( ) ; if ( trigger != UpdateTrigger . DISABLED ) { // Start all existing listeners for ( ApplicationListeners listeners : _appListeners . values ( ) ) { listeners . startListeners ( config . getPollingRate ( ) , config . getUpdateTrigger ( ) == UpdateTrigger . MBEAN ) ; } } else { // Stop all existing listeners for ( ApplicationListeners listeners : _appListeners . values ( ) ) { listeners . stopListeners ( false ) ; } } }
Starts the service with properties
133
6
161,316
@ FFDCIgnore ( value = UnableToAdaptException . class ) public void addApplication ( ApplicationInstallInfo installInfo ) { // ...and now create the new... start by asking the handler what needs monitoring final Collection < Notification > notificationsToMonitor ; final boolean listenForRootStructuralChanges ; ApplicationMonitoringInformation ami = installInfo . getApplicationMonitoringInformation ( ) ; if ( ami != null ) { notificationsToMonitor = ami . getNotificationsToMonitor ( ) ; listenForRootStructuralChanges = ami . isListeningForRootStructuralChanges ( ) ; } else { notificationsToMonitor = null ; listenForRootStructuralChanges = true ; } try { // Now create the listeners for these notifications ApplicationListeners listeners = new ApplicationListeners ( installInfo . getUpdateHandler ( ) , _executorService ) ; /* * Go through all of the notifications to monitor and create a listener for it. Note we also always create a different type of listener for root so if the app is * deleted we * know about it. Optionally (based on the handler) this might also monitor for files being added or removed from the root to trigger an update, i.e. if a WAR gets * added to * the root of an EAR. */ if ( notificationsToMonitor != null ) { for ( Notification notificationToMonitor : notificationsToMonitor ) { ApplicationListener listener = new ApplicationListener ( notificationToMonitor , listeners , installInfo ) ; listeners . addListener ( listener ) ; } // If the handler did request monitoring then we still need a non-recursive handler to check root listeners . addListener ( new RootApplicationListener ( installInfo . getContainer ( ) , listenForRootStructuralChanges , listeners ) ) ; } else { /* * If the handler didn't give us any information about what to monitor then monitor the whole application, note we use another type of listener again here that will * monitor for root deletions or updates to any part of the application */ listeners . addListener ( new CompleteApplicationListener ( installInfo . getContainer ( ) , listeners ) ) ; } ApplicationListeners old = _appListeners . put ( installInfo . getPid ( ) , listeners ) ; if ( old != null ) { old . stopListeners ( true ) ; } // If we're actively scanning, start the new listener ApplicationMonitorConfig config = _config . get ( ) ; if ( config . getUpdateTrigger ( ) != UpdateTrigger . DISABLED ) { listeners . startListeners ( config . getPollingRate ( ) , config . getUpdateTrigger ( ) == UpdateTrigger . MBEAN ) ; } } catch ( UnableToAdaptException e ) { // Ignore, we just won't monitor this application but do put out a warning message AppMessageHelper . get ( installInfo . getHandler ( ) ) . warning ( "APPLICATION_MONITORING_FAIL" , installInfo . getName ( ) ) ; } }
adds an application s information to the update monitor
617
10
161,317
public void removeApplication ( String pid ) { // remove the application listener from the set we know about and stop it ApplicationListeners listeners = _appListeners . remove ( pid ) ; //check that the app is known, this can be run after the app is already removed. if ( listeners != null ) { listeners . stopListeners ( true ) ; } }
Removes an application from the update monitor
75
8
161,318
public static void traceEJBCallEntry ( String methodDesc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { StringBuffer sbuf = new StringBuffer ( ) ; sbuf . append ( BeanLifeCycle_EJBCallEntry_Type_Str ) . append ( DataDelimiter ) . append ( BeanLifeCycle_EJBCallEntry_Type ) . append ( DataDelimiter ) . append ( methodDesc ) ; Tr . debug ( tc , sbuf . toString ( ) ) ; } }
This is called by the EJB container server code to write a ejb method callback entry record to the trace log if enabled .
124
27
161,319
public static void traceEJBCallExit ( String methodDesc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { StringBuffer sbuf = new StringBuffer ( ) ; sbuf . append ( BeanLifeCycle_EJBCallExit_Type_Str ) . append ( DataDelimiter ) . append ( BeanLifeCycle_EJBCallExit_Type ) . append ( DataDelimiter ) . append ( methodDesc ) ; Tr . debug ( tc , sbuf . toString ( ) ) ; } }
This is called by the EJB container server code to write a ejb method callback exit record to the trace log if enabled .
124
27
161,320
public static void traceBeanState ( int oldState , String oldString , int newState , String newString ) // d167264 { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { StringBuffer sbuf = new StringBuffer ( ) ; sbuf . append ( BeanLifeCycle_State_Type_Str ) . append ( DataDelimiter ) . append ( BeanLifeCycle_State_Type ) . append ( DataDelimiter ) . append ( oldState ) . append ( DataDelimiter ) // d167264 . append ( oldString ) . append ( DataDelimiter ) // d167264 . append ( newState ) . append ( DataDelimiter ) // d167264 . append ( newString ) . append ( DataDelimiter ) // d167264 ; Tr . debug ( tc , sbuf . toString ( ) ) ; } }
This is called by the EJB container server code to write a ejb bean state record to the trace log if enabled .
196
26
161,321
protected synchronized void add ( Object id , int bufferType , int cause , int source , boolean fromDepIdTemplateInvalidation , boolean fireEvent , boolean isAlias ) { final String methodName = "add(Object)" ; if ( id == null ) { return ; } if ( bufferType == EXPLICIT_BUFFER ) { byte info = 0 ; if ( cause != 0 && source != 0 ) { info = ( byte ) cause ; if ( source == CachePerf . REMOTE ) { info = ( byte ) ( info | STATUS_REMOTE ) ; } if ( fromDepIdTemplateInvalidation ) { info = ( byte ) ( info | STATUS_FROM_DEPID_TEMPLATE ) ; } if ( isAlias ) { info = ( byte ) ( info | STATUS_ALIAS ) ; } if ( fireEvent ) { info = ( byte ) ( info | STATUS_FIRE_EVENT ) ; } } this . explicitBuffer . put ( id , new Byte ( info ) ) ; this . scanBuffer . remove ( id ) ; } else if ( bufferType == SCAN_BUFFER ) { if ( ! this . explicitBuffer . containsKey ( id ) ) { this . scanBuffer . add ( id ) ; } } else if ( bufferType == GC_BUFFER ) { this . garbageCollectorBuffer . add ( id ) ; } traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " id=" + id + " bufferType=" + bufferType + " ExplicitBuffer=" + this . explicitBuffer . size ( ) + " ScanBuffer=" + this . scanBuffer . size ( ) + " GCBuffer=" + this . garbageCollectorBuffer . size ( ) + " cause=" + cause + " source=" + source + " fireEvent=" + fireEvent ) ; if ( isFull ( ) || bufferType == GC_BUFFER ) { // 3821 NK end invokeBackgroundInvalidation ( ! SCAN ) ; } }
Call this method to store a cache id in the one of invalidation buffers . The entry is going to remove from the disk using LPBT .
424
29
161,322
protected synchronized void add ( ValueSet idSet , int bufferType , int cause , int source , boolean fromDepIdTemplateInvalidation , boolean fireEvent , boolean checkFull ) { final String methodName = "add(ValueSet)" ; if ( idSet == null || idSet . isEmpty ( ) ) { return ; } int size = idSet . size ( ) ; if ( bufferType == EXPLICIT_BUFFER ) { byte info = 0 ; if ( cause != 0 && source != 0 ) { info = ( byte ) cause ; if ( source == CachePerf . REMOTE ) { info = ( byte ) ( info | STATUS_REMOTE ) ; } if ( fromDepIdTemplateInvalidation ) { info = ( byte ) ( info | STATUS_FROM_DEPID_TEMPLATE ) ; } if ( fireEvent ) { info = ( byte ) ( info | STATUS_FIRE_EVENT ) ; } } Iterator it = idSet . iterator ( ) ; while ( it . hasNext ( ) ) { Object entryId = it . next ( ) ; this . explicitBuffer . put ( entryId , new Byte ( info ) ) ; } if ( ! this . scanBuffer . isEmpty ( ) ) { filter ( this . scanBuffer , idSet ) ; } } else if ( bufferType == SCAN_BUFFER ) { if ( ! explicitBuffer . isEmpty ( ) ) { filter ( idSet , this . explicitBuffer ) ; } this . scanBuffer . addAll ( idSet ) ; } else if ( bufferType == GC_BUFFER ) { this . garbageCollectorBuffer . addAll ( idSet ) ; } // if (size > 50) { traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " idSet=" + size + " idSetFilter=" + idSet . size ( ) + " bufferType=" + bufferType + " explicitBuffer=" + this . explicitBuffer . size ( ) + " scanBuffer=" + this . scanBuffer . size ( ) + " GCBuffer=" + this . garbageCollectorBuffer . size ( ) ) ; // } if ( ( checkFull && isFull ( ) ) || bufferType == GC_BUFFER ) { // 3821 NK end invokeBackgroundInvalidation ( ! SCAN ) ; } }
Call this method to store a collection of cache ids in the one of invalidation buffers . The entries are going to remove from the disk using LPBT .
494
32
161,323
protected synchronized Object get ( int bufferType ) { // final String methodName = "get(boolean)"; Object id = null ; if ( bufferType == this . EXPLICIT_BUFFER ) { if ( ! this . explicitBuffer . isEmpty ( ) ) { Set s = this . explicitBuffer . keySet ( ) ; Iterator it = s . iterator ( ) ; ExplicitIdData idData = new ExplicitIdData ( ) ; while ( it . hasNext ( ) ) { idData . id = it . next ( ) ; idData . info = ( ( Byte ) this . explicitBuffer . get ( idData . id ) ) . byteValue ( ) ; if ( ( idData . info & HTODInvalidationBuffer . STATUS_ALIAS ) == 0 ) { id = idData ; break ; } } } } else if ( bufferType == this . SCAN_BUFFER ) { if ( ! this . scanBuffer . isEmpty ( ) ) { id = this . scanBuffer . getOne ( ) ; } } else if ( bufferType == this . GC_BUFFER ) { if ( ! this . garbageCollectorBuffer . isEmpty ( ) ) { // Always get the first one from the list id = this . garbageCollectorBuffer . get ( 0 ) ; } } // if (id != null) { // traceDebug(methodName, "cacheName=" + this.cod.cacheName + " id=" + id + " bufferType=" + bufferType); // } return id ; }
Call this method when a cache id is retrieved from one of invalidation buffers . The entry is being used to remove from the disk using LPBT .
322
30
161,324
protected synchronized void remove ( Object id , int bufferType , boolean returnToPool ) { // final String methodName = "remove(Object,bufferType)"; if ( id == null ) { return ; } if ( bufferType == this . EXPLICIT_BUFFER ) { this . explicitBuffer . remove ( id ) ; } else if ( bufferType == this . SCAN_BUFFER ) { this . scanBuffer . remove ( id ) ; } else if ( bufferType == this . GC_BUFFER ) { if ( id instanceof EvictionTableEntry ) { EvictionTableEntry evt1 = ( EvictionTableEntry ) id ; int i ; for ( i = 0 ; i < garbageCollectorBuffer . size ( ) ; i ++ ) { EvictionTableEntry evt = ( EvictionTableEntry ) garbageCollectorBuffer . get ( i ) ; if ( evt == evt1 ) break ; } if ( i < garbageCollectorBuffer . size ( ) ) this . garbageCollectorBuffer . remove ( i ) ; if ( returnToPool ) { cod . htod . evictionEntryPool . add ( id ) ; } } } // traceDebug(methodName, "cacheName=" + this.cod.cacheName + " id=" + id + " bufferType=" + bufferType); }
returnToPool boolean is used by GC buffer only
279
10
161,325
protected synchronized void remove ( Object id ) { // final String methodName = "remove(Object)"; if ( id == null ) { return ; } this . explicitBuffer . remove ( id ) ; this . scanBuffer . remove ( id ) ; // this.garbageCollectorBuffer.remove(id); // if (id instanceof HTODDynacache.EvictionTableEntry) // cod.htod.evictionEntryPool.add(id); // traceDebug(methodName, "id=" + id); }
Call this method to remove a specified cache id from invalidation buffers excluding garbage collector buffers .
111
18
161,326
protected synchronized ValueSet getAndRemoveFromExplicitBuffer ( ) { final String methodName = "getAndRemoveFromExplicitBuffer()" ; ValueSet valueSet = null ; if ( this . explicitBuffer . size ( ) == 0 ) { valueSet = new ValueSet ( 1 ) ; } else { valueSet = new ValueSet ( this . explicitBuffer . size ( ) ) ; Iterator it = this . explicitBuffer . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Object current = it . next ( ) ; byte info = ( ( Byte ) this . explicitBuffer . get ( current ) ) . byteValue ( ) ; if ( ( info & HTODInvalidationBuffer . STATUS_ALIAS ) == 0 ) { valueSet . add ( current ) ; } } this . explicitBuffer . clear ( ) ; } traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " bufferSize=" + valueSet . size ( ) ) ; return valueSet ; }
Call this method to get and remove all the cache ids from explicit buffer .
218
16
161,327
protected synchronized boolean findAndRemoveFromGCBuffer ( long expirationTime , int hashcode , int size ) { EvictionTableEntry evt = null ; int i ; for ( i = 0 ; i < garbageCollectorBuffer . size ( ) ; i ++ ) { evt = ( EvictionTableEntry ) garbageCollectorBuffer . get ( i ) ; if ( evt . expirationTime == expirationTime && evt . hashcode == hashcode && evt . size == size ) { break ; } } if ( i < garbageCollectorBuffer . size ( ) ) { this . garbageCollectorBuffer . remove ( i ) ; if ( evt != null ) { cod . htod . evictionEntryPool . add ( evt ) ; } return true ; } return false ; }
Call this method to get and remove the EVT from GC buffer .
165
14
161,328
protected synchronized void clear ( int bufferType ) { final String methodName = "clear()" ; if ( bufferType == HTODInvalidationBuffer . EXPLICIT_BUFFER ) { this . explicitBuffer . clear ( ) ; } else if ( bufferType == HTODInvalidationBuffer . SCAN_BUFFER ) { this . scanBuffer . clear ( ) ; } else if ( bufferType == HTODInvalidationBuffer . GC_BUFFER ) { // todo: return GC to pool? for ( int i = 0 ; i < garbageCollectorBuffer . size ( ) ; i ++ ) { EvictionTableEntry evt = ( EvictionTableEntry ) garbageCollectorBuffer . get ( i ) ; cod . htod . evictionEntryPool . add ( evt ) ; } this . garbageCollectorBuffer . clear ( ) ; } traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " bufferType=" + bufferType ) ; }
Call this method to clear the invalidation buffers .
207
10
161,329
protected synchronized void invokeBackgroundInvalidation ( boolean scan ) { final String methodName = "invokeBackgroundInvalidation()" ; if ( ! stopping ) { synchronized ( cod . diskCleanupThread . dcMonitor ) { if ( cod . diskCleanupThread . currentThread != null ) { this . cod . invokeDiskCleanup ( scan ) ; } else { if ( scan == SCAN ) { traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " set cleanupDiskPending to true" ) ; this . cleanupDiskPending = true ; } } } } }
Call this method to invoke LPBT .
125
8
161,330
protected synchronized boolean contains ( Object id ) { boolean found = false ; if ( this . explicitBuffer . containsKey ( id ) || this . scanBuffer . contains ( id ) ) { found = true ; } return found ; }
Call this method to check whether a specified id exists in the invalidation explicit or scan buffer .
47
19
161,331
@ Trivial public synchronized boolean isFull ( ) { // final String methodName = "isFull()"; boolean isFull = false ; int size = this . explicitBuffer . size ( ) + this . scanBuffer . size ( ) + this . garbageCollectorBuffer . size ( ) ; if ( size > this . maxInvalidationBufferSize || ( System . currentTimeMillis ( ) - this . lastRemoveTime ) >= this . maxInvalidationBufferLife ) { isFull = true ; setlastRemoveTime ( ) ; } // if (isFull) { // traceDebug(methodName, "cacheName=" + this.cod.cacheName + " isFull=" + isFull + " explicitBuffer=" + // explicitBuffer.size() + " scanBuffer=" + this.scanBuffer.size()); // } return isFull ; }
Call this method to check whether a full condition is met to start LPBT .
177
16
161,332
protected synchronized void filter ( ValueSet filterValueSet ) { boolean explicitBufferEmpty = this . explicitBuffer . isEmpty ( ) ; boolean scanBufferEmpty = this . scanBuffer . isEmpty ( ) ; if ( filterValueSet != null && ! filterValueSet . isEmpty ( ) && ( ! explicitBufferEmpty || ! scanBufferEmpty ) ) { Iterator it = filterValueSet . iterator ( ) ; while ( it . hasNext ( ) ) { Object o = it . next ( ) ; if ( ! explicitBufferEmpty && this . explicitBuffer . containsKey ( o ) ) { it . remove ( ) ; } else if ( ! scanBufferEmpty && this . scanBuffer . contains ( o ) ) { it . remove ( ) ; } } } }
Call this method to filter out the specified collection of cache ids based on invalidation buffers .
159
19
161,333
@ Trivial protected synchronized int size ( int bufferType ) { if ( bufferType == EXPLICIT_BUFFER ) { return this . explicitBuffer . size ( ) ; } else if ( bufferType == SCAN_BUFFER ) { return this . scanBuffer . size ( ) ; } else if ( bufferType == GC_BUFFER ) { return this . garbageCollectorBuffer . size ( ) ; } return 0 ; }
Call this method to get the size from one of invalidation buffers .
91
14
161,334
protected synchronized boolean isBackgroundInvalidationInProgress ( ) { boolean cleanupThreadRunning = false ; if ( this . cod . diskCleanupThread != null ) { synchronized ( cod . diskCleanupThread . dcMonitor ) { cleanupThreadRunning = this . cod . diskCleanupThread . currentThread != null ; } } boolean garbageCollectorThreadRunning = false ; if ( this . cod . garbageCollectionThread != null ) { synchronized ( cod . garbageCollectionThread . gcMonitor ) { garbageCollectorThreadRunning = this . cod . garbageCollectionThread . currentThread != null ; } } return ( cleanupThreadRunning || garbageCollectorThreadRunning ) ? true : false ; }
Call this method to check the state of LPBT in Progress .
140
13
161,335
protected synchronized boolean isLoopOnce ( ) { final String methodName = "isLoopOnce()" ; if ( loopOnce ) { traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " isLoopOnce=" + loopOnce + " explicitBuffer=" + explicitBuffer . size ( ) + " scanBuffer=" + this . scanBuffer . size ( ) ) ; } return this . loopOnce ; }
Call this method to check the state of Loop Once .
89
11
161,336
protected synchronized void setStopping ( boolean stopping ) { final String methodName = "setStopping()" ; this . stopping = stopping ; traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " stopping=" + this . stopping ) ; }
Call this method to set the state of Stopping . No more invoking the LPBT .
57
18
161,337
@ Override public void updateProperties ( Dictionary < String , Object > properties ) throws IOException { lock . lock ( ) ; try { doUpdateProperties ( properties ) ; } finally { lock . unlock ( ) ; } }
without other guards separating updating the properties and sending configuration events can result in missing and duplicate update events even if every update is eventually associated with an event .
48
30
161,338
@ Override public void updateCache ( Dictionary < String , Object > properties , Set < ConfigID > references , Set < String > newUniques ) throws IOException { lock . lock ( ) ; try { removeReferences ( ) ; setProperties ( properties ) ; this . references = references ; this . uniqueVariables = newUniques ; caFactory . getConfigurationStore ( ) . saveConfiguration ( pid , this ) ; changeCount . incrementAndGet ( ) ; addReferences ( ) ; sendEvents = true ; } finally { lock . unlock ( ) ; } }
Updates ConfigurationAdmin s cache with current config properties . If replaceProp is set to true current config properties is replace with the given properties before caching and the internal pid - to - config table is updated to reflect the new config properties .
118
47
161,339
private void setProperties ( Dictionary < String , ? > d ) { if ( d == null ) { this . properties = null ; return ; } ConfigurationDictionary newDictionary = new ConfigurationDictionary ( ) ; Enumeration < String > keys = d . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = keys . nextElement ( ) ; if ( newDictionary . get ( key ) == null ) { Object value = d . get ( key ) ; if ( value . getClass ( ) . isArray ( ) ) { int arrayLength = Array . getLength ( value ) ; Object copyOfArray = Array . newInstance ( value . getClass ( ) . getComponentType ( ) , arrayLength ) ; System . arraycopy ( value , 0 , copyOfArray , 0 , arrayLength ) ; newDictionary . put ( key , copyOfArray ) ; } else if ( value instanceof Collection ) { newDictionary . put ( key , new Vector < Object > ( ( Collection < ? > ) value ) ) ; } else { newDictionary . put ( key , value ) ; } } else throw new IllegalArgumentException ( key + " is already present or is a case variant." ) ; //$NON-NLS-1$ } // fill in necessary properties if ( this . factoryPid != null ) { newDictionary . put ( ConfigurationAdmin . SERVICE_FACTORYPID , this . factoryPid ) ; } newDictionary . put ( Constants . SERVICE_PID , this . pid ) ; if ( this . inOverridesFile ) { newDictionary . put ( "config.overrides" , "true" ) ; } this . properties = newDictionary ; //we got new props so we should redo the mappings in case they changed addPidMapping ( ) ; }
This is not part of Configuration interface . It sets configuration dictionary with specified dictionary and updates configuration attributes if they are not set and found in given dictionary .
399
30
161,340
@ SuppressWarnings ( "unchecked" ) public static Object proprietaryEvaluate ( final String expression , final Class expectedType , final PageContext pageContext , final ProtectedFunctionMapper functionMap , final boolean escape ) throws ELException { Object retValue ; ExpressionFactory exprFactorySetInPageContext = ( ExpressionFactory ) pageContext . getAttribute ( Constants . JSP_EXPRESSION_FACTORY_OBJECT ) ; if ( exprFactorySetInPageContext == null ) { exprFactorySetInPageContext = JspFactory . getDefaultFactory ( ) . getJspApplicationContext ( pageContext . getServletContext ( ) ) . getExpressionFactory ( ) ; } final ExpressionFactory exprFactory = exprFactorySetInPageContext ; //if (SecurityUtil.isPackageProtectionEnabled()) { ELContextImpl ctx = ( ELContextImpl ) pageContext . getELContext ( ) ; ctx . setFunctionMapper ( new FunctionMapperImpl ( functionMap ) ) ; ValueExpression ve = exprFactory . createValueExpression ( ctx , expression , expectedType ) ; retValue = ve . getValue ( ctx ) ; if ( escape && retValue != null ) { retValue = XmlEscape ( retValue . toString ( ) ) ; } return retValue ; }
Proprietary method to evaluate EL expressions . XXX - This method should go away once the EL interpreter moves out of JSTL and into its own project . For now this is necessary because the standard machinery is too slow .
281
45
161,341
public void addListener ( InstallEventListener listener , String notificationType ) { if ( listener == null || notificationType == null ) return ; if ( notificationType . isEmpty ( ) ) return ; if ( listenersMap == null ) { listenersMap = new HashMap < String , Collection < InstallEventListener > > ( ) ; } Collection < InstallEventListener > listeners = listenersMap . get ( notificationType ) ; if ( listeners == null ) { listeners = new ArrayList < InstallEventListener > ( 1 ) ; listenersMap . put ( notificationType , listeners ) ; } listeners . add ( listener ) ; }
Adds an install event listener to the listenersMap with a specified notification type
126
14
161,342
public void removeListener ( InstallEventListener listener ) { if ( listenersMap != null ) { for ( Collection < InstallEventListener > listeners : listenersMap . values ( ) ) { listeners . remove ( listener ) ; } } }
Removes a listener from listenersMap
47
7
161,343
public void fireProgressEvent ( int state , int progress , String message ) throws Exception { if ( listenersMap != null ) { Collection < InstallEventListener > listeners = listenersMap . get ( InstallConstants . EVENT_TYPE_PROGRESS ) ; if ( listeners != null ) { for ( InstallEventListener listener : listeners ) { listener . handleInstallEvent ( new InstallProgressEvent ( state , progress , message ) ) ; } } } }
Fires progress event messages
92
5
161,344
public void putToFront ( QueueData queueData , short msgBatch ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "putToFront" , new Object [ ] { queueData , msgBatch } ) ; _put ( queueData , msgBatch , false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "putToFront" ) ; }
Places a message on to the front of the proxy queue so that the next get operation will consume it .
121
22
161,345
public synchronized JsMessage [ ] getBatch ( int batchSize , short id ) throws SIResourceException , SIConnectionDroppedException , SIConnectionLostException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getBatch" , "" + batchSize ) ; int size ; synchronized ( queue ) { size = queue . size ( ) ; } if ( size > batchSize ) size = batchSize ; JsMessage [ ] retArray = new JsMessage [ size ] ; for ( int i = 0 ; i < retArray . length ; ++ i ) retArray [ i ] = get ( id ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getBatch" , retArray ) ; return retArray ; }
Gets a batch of several messages from the queue .
204
11
161,346
public synchronized void setTrackBytes ( boolean trackBytes ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setTrackBytes" , trackBytes ) ; this . trackBytes = trackBytes ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setTrackBytes" ) ; }
Sets the trackBytes parameter . This flag is used to indicate whether this queue should keep track of the bytes on the queue and request more from the server when it is running low .
100
37
161,347
public void reset ( ) { current = null ; _hasWritten = false ; byteBuffersRetrieved = false ; limit = - 1 ; total = 0 ; if ( ! byteBuffersRetrieved ) { ListIterator < WsByteBuffer > it = bbList . listIterator ( ) ; while ( it . hasNext ( ) ) { WsByteBuffer next = it . next ( ) ; next . release ( ) ; it . remove ( ) ; } } }
clean up ...
99
3
161,348
public void write ( byte [ ] buf , int offset , int len ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { // 306998.15 Tr . debug ( tc , "write len --> " + len + ", limit->" + limit ) ; } if ( len < 0 ) { if ( tc . isErrorEnabled ( ) ) Tr . error ( tc , "Illegal.Argument.Trying.to.write.chars" ) ; throw new IllegalArgumentException ( ) ; } if ( ! _hasWritten && obs != null ) { _hasWritten = true ; obs . alertFirstWrite ( ) ; } if ( limit > - 1 ) { if ( total + len > limit ) { len = limit - total ; except = new WriteBeyondContentLengthException ( ) ; } } int toWrite = 0 , amountWritten = 0 , remaining = 0 ; while ( amountWritten != len ) { checkList ( ) ; toWrite = len - amountWritten ; remaining = current . remaining ( ) ; if ( toWrite <= remaining ) { /* * We can write it all in the current buffer */ current . put ( buf , offset + amountWritten , toWrite ) ; amountWritten += toWrite ; } else { /* * Write what we can to the current position */ current . put ( buf , offset + amountWritten , remaining ) ; amountWritten += remaining ; } } count += len ; total += len ; check ( ) ; }
Writes a byte array
317
5
161,349
@ Override public void doWork ( Work work , long startTimeout , ExecutionContext execContext , WorkListener workListener ) throws WorkException { try { beforeRunCheck ( work , workListener , startTimeout ) ; new WorkProxy ( work , startTimeout , execContext , workListener , bootstrapContext , runningWork , false ) . call ( ) ; } catch ( WorkException ex ) { throw ex ; } catch ( Throwable t ) { WorkRejectedException wrex = new WorkRejectedException ( t ) ; wrex . setErrorCode ( WorkException . INTERNAL ) ; if ( workListener != null ) workListener . workRejected ( new WorkEvent ( work , WorkEvent . WORK_REJECTED , work , wrex ) ) ; throw wrex ; } }
This method does not return until the work is completed as the caller expects to wait until the work is completed before getting control back . This method accomplishes this by NOT spinning a thread .
165
37
161,350
@ Override public void scheduleWork ( Work work , long startTimeout , ExecutionContext execContext , WorkListener workListener ) throws WorkException { try { beforeRunCheck ( work , workListener , startTimeout ) ; WorkProxy workProxy = new WorkProxy ( work , startTimeout , execContext , workListener , bootstrapContext , runningWork , true ) ; FutureTask < Void > futureTask = new FutureTask < Void > ( workProxy ) ; bootstrapContext . execSvc . executeGlobal ( futureTask ) ; if ( futures . add ( futureTask ) && futures . size ( ) % FUTURE_PURGE_INTERVAL == 0 ) purgeFutures ( ) ; } catch ( WorkException ex ) { throw ex ; } catch ( Throwable t ) { WorkRejectedException wrex = new WorkRejectedException ( t ) ; wrex . setErrorCode ( WorkException . INTERNAL ) ; if ( workListener != null ) workListener . workRejected ( new WorkEvent ( work , WorkEvent . WORK_REJECTED , work , wrex ) ) ; throw wrex ; } }
This method puts the work on a queue that is later processed by the scheduler thread . This allows the method to return to the caller without having to wait for the thread to start .
236
37
161,351
@ Trivial private void beforeRunCheck ( Work work , WorkListener workListener , long startTimeout ) throws WorkRejectedException { WorkRejectedException wrex = null ; if ( work == null ) { wrex = new WorkRejectedException ( new NullPointerException ( "work" ) ) ; wrex . setErrorCode ( WorkException . UNDEFINED ) ; } else if ( startTimeout < WorkManager . IMMEDIATE ) wrex = new WorkRejectedException ( "startTimeout=" + startTimeout , WorkException . START_TIMED_OUT ) ; else if ( stopped ) wrex = new WorkRejectedException ( new UnavailableException ( bootstrapContext . resourceAdapterID ) ) ; if ( wrex != null ) { if ( workListener != null ) { WorkEvent event = new WorkEvent ( work == null ? this : work , WorkEvent . WORK_REJECTED , work , wrex ) ; workListener . workRejected ( event ) ; } throw wrex ; } }
Input parameter checks that can be done before calling run .
218
11
161,352
public void stop ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; // Stop accepting work stopped = true ; // Cancel futures for submitted work for ( Future < Void > future = futures . poll ( ) ; future != null ; future = futures . poll ( ) ) if ( ! future . isDone ( ) && future . cancel ( true ) ) if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "canceled" , future ) ; // Release running work for ( Work work = runningWork . poll ( ) ; work != null ; work = runningWork . poll ( ) ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "release" , work ) ; work . release ( ) ; } }
Provides a way to stop the WorkManager .
172
10
161,353
public void close ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "close" ) ; // begin F177053 ChannelFramework framework = ChannelFrameworkFactory . getChannelFramework ( ) ; // F196678.10 try { framework . stopChain ( chainInbound , CHAIN_STOP_TIME ) ; } catch ( ChainException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close" , JFapChannelConstants . LISTENERPORTIMPL_CLOSE_01 , new Object [ ] { framework , chainInbound } ) ; // D232185 if ( tc . isEventEnabled ( ) ) SibTr . exception ( this , tc , e ) ; } catch ( ChannelException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close" , JFapChannelConstants . LISTENERPORTIMPL_CLOSE_02 , new Object [ ] { framework , chainInbound } ) ; // D232185 if ( tc . isEventEnabled ( ) ) SibTr . exception ( this , tc , e ) ; } // end F177053 if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "close" ) ; }
Stops the listener port listening .
313
7
161,354
public AcceptListener getAcceptListener ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getAcceptListener" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getAcceptListener" , acceptListener ) ; return acceptListener ; }
Returns the accept listener associated with this listener port .
71
10
161,355
public int getPortNumber ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getPortNumber" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getPortNumber" , "" + portNumber ) ; return portNumber ; }
Returns the port number associated with this listener port .
72
10
161,356
public static boolean containsRoutingContext ( RESTRequest request ) { if ( request . getHeader ( RESTHandlerContainer . COLLECTIVE_HOST_NAMES ) != null ) { return true ; } //No routing header found, so check query strings return getQueryParameterValue ( request , RESTHandlerContainer . COLLECTIVE_HOST_NAMES ) != null ; }
Quick check for multiple routing context without actually fetching all pieces
82
12
161,357
private PersistenceServiceUnit createPsu ( int jobInstanceVersion , int jobExecutionVersion ) throws Exception { return databaseStore . createPersistenceServiceUnit ( getJobInstanceEntityClass ( jobInstanceVersion ) . getClassLoader ( ) , getJobExecutionEntityClass ( jobExecutionVersion ) . getName ( ) , getJobInstanceEntityClass ( jobInstanceVersion ) . getName ( ) , StepThreadExecutionEntity . class . getName ( ) , StepThreadInstanceEntity . class . getName ( ) , TopLevelStepExecutionEntity . class . getName ( ) , TopLevelStepInstanceEntity . class . getName ( ) ) ; }
Creates a PersistenceServiceUnit using the specified entity versions .
138
13
161,358
public JobExecution updateJobExecutionAndInstanceFinalStatus ( PersistenceServiceUnit psu , final long jobExecutionId , final BatchStatus finalBatchStatus , final String finalExitStatus , final Date endTime ) throws NoSuchJobExecutionException { EntityManager em = psu . createEntityManager ( ) ; try { return new TranRequest < JobExecution > ( em ) { @ Override public JobExecution call ( ) { JobExecutionEntity exec = entityMgr . find ( JobExecutionEntity . class , jobExecutionId ) ; if ( exec == null ) { throw new NoSuchJobExecutionException ( "No job execution found for id = " + jobExecutionId ) ; } try { verifyStatusTransitionIsValid ( exec , finalBatchStatus ) ; exec . setBatchStatus ( finalBatchStatus ) ; exec . getJobInstance ( ) . setBatchStatus ( finalBatchStatus ) ; exec . setExitStatus ( finalExitStatus ) ; exec . getJobInstance ( ) . setExitStatus ( finalExitStatus ) ; exec . getJobInstance ( ) . setLastUpdatedTime ( endTime ) ; // set the state to be the same value as the batchstatus // Note: we only want to do this is if the batchStatus is one of the "done" statuses. if ( isFinalBatchStatus ( finalBatchStatus ) ) { InstanceState newInstanceState = InstanceState . valueOf ( finalBatchStatus . toString ( ) ) ; verifyStateTransitionIsValid ( exec . getJobInstance ( ) , newInstanceState ) ; exec . getJobInstance ( ) . setInstanceState ( newInstanceState ) ; } exec . setLastUpdatedTime ( endTime ) ; exec . setEndTime ( endTime ) ; return exec ; } catch ( BatchIllegalJobStatusTransitionException e ) { throw new PersistenceException ( e ) ; } } } . runInNewOrExistingGlobalTran ( ) ; } finally { em . close ( ) ; } }
This method is called during recovery as well as during normal operation .
437
13
161,359
@ Override public List < StepExecution > getStepExecutionsTopLevelFromJobExecutionId ( final long jobExecutionId ) throws NoSuchJobExecutionException { final EntityManager em = getPsu ( ) . createEntityManager ( ) ; try { List < StepExecution > exec = new TranRequest < List < StepExecution > > ( em ) { @ Override public List < StepExecution > call ( ) throws Exception { TypedQuery < StepExecution > query = em . createNamedQuery ( TopLevelStepExecutionEntity . GET_TOP_LEVEL_STEP_EXECUTIONS_BY_JOB_EXEC_SORT_BY_START_TIME_ASC , StepExecution . class ) ; query . setParameter ( "jobExecId" , jobExecutionId ) ; List < StepExecution > result = query . getResultList ( ) ; if ( result == null ) { result = new ArrayList < StepExecution > ( ) ; } // If empty, try to get job execution to generate NoSuchJobExecutionException if unknown id if ( result . isEmpty ( ) ) { getJobExecution ( jobExecutionId ) ; } return result ; } } . runInNewOrExistingGlobalTran ( ) ; return exec ; } finally { em . close ( ) ; } }
order by start time ascending
289
5
161,360
public RemotablePartitionEntity updateRemotablePartitionOnRecovery ( PersistenceServiceUnit psu , final RemotablePartitionEntity partition ) { // TODO Auto-generated method stub EntityManager em = psu . createEntityManager ( ) ; try { return new TranRequest < RemotablePartitionEntity > ( em ) { @ Override public RemotablePartitionEntity call ( ) { RemotablePartitionKey key = new RemotablePartitionKey ( partition ) ; RemotablePartitionEntity remotablePartition = entityMgr . find ( RemotablePartitionEntity . class , key ) ; remotablePartition . setLastUpdated ( new Date ( ) ) ; return remotablePartition ; } } . runInNewOrExistingGlobalTran ( ) ; } finally { em . close ( ) ; } }
This method is called during recovery
186
6
161,361
public < T > void addMessageHandler ( Class < T > clazz , Whole < T > handler ) { connLink . addMessageHandler ( clazz , handler ) ; }
websocket 1 . 1 methods
37
7
161,362
public String promptForUser ( String arg ) { String user = console . readLine ( CommandUtils . getMessage ( "user.enterText" , arg ) + " " ) ; return user ; }
Prompt the user to enter text .
43
8
161,363
public void end ( Xid xid , int flags ) throws XAException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "end" , new Object [ ] { ivManagedConnection , AdapterUtil . toString ( xid ) , AdapterUtil . getXAResourceEndFlagString ( flags ) } ) ; try { if ( flags == XAResource . TMFAIL ) { ivStateManager . setState ( WSStateManager . XA_END_FAIL ) ; } else { ivStateManager . setState ( WSStateManager . XA_END ) ; } } catch ( TransactionException te ) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter . processException ( te , "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.end" , "189" , this ) ; Tr . error ( tc , "INVALID_TX_STATE" , new Object [ ] { "OnePhaseXAResource.end()" , ivManagedConnection . getTransactionStateAsString ( ) } ) ; XAException xae = new XAException ( XAException . XA_RBPROTO ) ; traceXAException ( xae , currClass ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "end" , "Exception" ) ; throw xae ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "end" ) ; }
XAException with return code XA_RBROLLBACK
377
14
161,364
public void rollback ( Xid xid ) throws XAException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "rollback" , new Object [ ] { ivManagedConnection , AdapterUtil . toString ( xid ) } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { String cId = null ; try { cId = ivManagedConnection . mcf . getCorrelator ( ivManagedConnection ) ; } catch ( SQLException x ) { // will just log the exception here and ignore it since its in trace Tr . debug ( this , tc , "got an exception trying to get the correlator in commit, exception is: " , x ) ; } if ( cId != null ) { StringBuffer stbuf = new StringBuffer ( 200 ) ; stbuf . append ( "Correlator: DB2, ID: " ) ; stbuf . append ( cId ) ; if ( xid != null ) { stbuf . append ( "Transaction ID : " ) ; stbuf . append ( xid ) ; } stbuf . append ( " ROLLBACK" ) ; Tr . debug ( this , tc , stbuf . toString ( ) ) ; } } // Reset so we can deferred enlist in a future global transaction. ivManagedConnection . wasLazilyEnlistedInGlobalTran = false ; try { // If no work was done during the transaction, the autoCommit value may still // be on. In this case, just no-op, since some drivers like ConnectJDBC 3.1 // don't allow commit/rollback when autoCommit is on. ivSqlConn . rollback ( ) ; ivStateManager . setState ( WSStateManager . XA_ROLLBACK ) ; } catch ( SQLException sqe ) { FFDCFilter . processException ( sqe , "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback" , "342" , this ) ; Tr . error ( tc , "DSA_INTERNAL_ERROR" , new Object [ ] { "Exception caught during rollback on the OnePhaseXAResource" , sqe } ) ; XAException xae = new XAException ( XAException . XAER_RMERR ) ; traceXAException ( xae , currClass ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "rollback" , "Exception" ) ; throw xae ; } catch ( TransactionException te ) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter . processException ( te , "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback" , "351" , this ) ; Tr . error ( tc , "INVALID_TX_STATE" , new Object [ ] { "OnePhaseXAResource.rollback()" , ivManagedConnection . getTransactionStateAsString ( ) } ) ; XAException xae = new XAException ( XAException . XAER_RMERR ) ; traceXAException ( xae , currClass ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "rollback" , "Exception" ) ; throw xae ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "rollback" ) ; }
XAER_RMERR return code in XAException
819
13
161,365
private static BundleContext getBundleContext ( final Bundle bundle ) { if ( System . getSecurityManager ( ) == null ) return bundle . getBundleContext ( ) ; else return AccessController . doPrivileged ( new PrivilegedAction < BundleContext > ( ) { @ Override public BundleContext run ( ) { return bundle . getBundleContext ( ) ; } } ) ; }
no need for an updatedJdbcDriver because changes will not impact the mbean
81
17
161,366
public static void debugHtml ( Writer writer , FacesContext faces , Throwable e ) throws IOException { debugHtml ( writer , faces , faces . getViewRoot ( ) , null , e ) ; }
Generates the HTML error page for the given Throwable and writes it to the given writer .
44
19
161,367
public static void debugHtml ( Writer writer , FacesContext faces ) throws IOException { _init ( faces ) ; Date now = new Date ( ) ; for ( int i = 0 ; i < debugParts . length ; i ++ ) { if ( "message" . equals ( debugParts [ i ] ) ) { writer . write ( faces . getViewRoot ( ) . getViewId ( ) ) ; } else if ( "now" . equals ( debugParts [ i ] ) ) { writer . write ( DateFormat . getDateTimeInstance ( ) . format ( now ) ) ; } else if ( "tree" . equals ( debugParts [ i ] ) ) { _writeComponent ( faces , writer , faces . getViewRoot ( ) , null , true ) ; } else if ( "extendedtree" . equals ( debugParts [ i ] ) ) { _writeExtendedComponentTree ( writer , faces ) ; } else if ( "vars" . equals ( debugParts [ i ] ) ) { _writeVariables ( writer , faces , faces . getViewRoot ( ) ) ; } else { writer . write ( debugParts [ i ] ) ; } } }
Generates the HTML debug page for the current view and writes it to the given writer .
248
18
161,368
private int hashToTable ( Long id , Entry [ ] table ) { int posVal = id . intValue ( ) & Integer . MAX_VALUE ; return ( posVal % table . length ) ; }
The Long Id is already effectively a hashcode for the Schema and should be unique . All we should need to do is get a positive integer version of it & divide by the table size .
43
39
161,369
private void resize ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "resize" , table . length ) ; Entry [ ] newTable = new Entry [ table . length + ( table . length / 2 ) ] ; /* We have to walk the entire SchemaSet, rehashing each Entry and putting */ /* it in its new home. As contains() may be running at the same time, we */ /* have to create a new Entry instance for each. */ for ( int i = 0 ; i < table . length ; i ++ ) { Entry ent = table [ i ] ; Entry newEntry ; int j ; while ( ent != null ) { j = hashToTable ( ent . schemaId , newTable ) ; newEntry = new Entry ( ent . schemaId , newTable [ j ] ) ; newTable [ j ] = newEntry ; ent = ent . next ; } } /* Now replace the old table with the new one. */ table = newTable ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "resize" , table . length ) ; }
Resize the SchemaSet adding 50% to the size .
268
13
161,370
public String toVerboseString ( ) { /* Take a local reference to the table in case a resize happens. */ Entry [ ] tempTable = table ; StringBuffer buf = new StringBuffer ( ) ; /* Include the SchemaSet hashcode just in case we need to distinguish them */ buf . append ( "SchemaSet " ) ; buf . append ( this . hashCode ( ) ) ; buf . append ( " {\n" ) ; /* For each table entry, write out all the SchemaIds */ for ( int i = 0 ; i < tempTable . length ; i ++ ) { buf . append ( " [" ) ; buf . append ( i ) ; buf . append ( "] " ) ; Entry ent = tempTable [ i ] ; buf . append ( ent ) ; while ( ent != null ) { ent = ent . next ; buf . append ( " " ) ; buf . append ( ent ) ; } buf . append ( "\n" ) ; } buf . append ( " }\n" ) ; return buf . toString ( ) ; }
Returns a printable view of the SchemaSet and contents for use in debugging and Unit Tests .
225
20
161,371
private static final String debugId ( Object o ) { Long id = ( Long ) o ; byte [ ] buf = new byte [ 8 ] ; ArrayUtil . writeLong ( buf , 0 , id . longValue ( ) ) ; return HexUtil . toString ( buf ) ; }
Write a Schema Id out as a hex string .
61
11
161,372
@ XmlElement ( name = "authentication-mechanism-type" , required = true ) public void setAuthenticationMechanismType ( String authMech ) { AuthenticationMechanismType type = AuthenticationMechanismType . valueOf ( authMech ) ; authenticationMechanismType = type . name ( ) ; }
Set the authentication mechanism type
66
5
161,373
@ FFDCIgnore ( ClassCastException . class ) void autoBind ( WSName subname , Object obj ) throws InvalidNameException , NotContextException , NameAlreadyBoundException { ContextNode target = this , parent = this ; int i = 0 ; try { for ( /* int i = 0 */ ; i < subname . size ( ) - 1 ; i ++ ) { String elem = subname . get ( i ) ; target = ( ContextNode ) target . children . get ( elem ) ; // create an auto-deleteable subcontext if ( target == null ) { target = new ContextNode ( parent , elem , true ) ; Object existingEntry = parent . children . putIfAbsent ( elem , target ) ; if ( existingEntry != null ) { // another thread just beat me to it creating this entry // assume it is a context and continue target = ( ContextNode ) existingEntry ; } } parent = target ; } } catch ( ClassCastException e ) { throw new NotContextException ( "" + fullName . plus ( subname . getPrefix ( i + 1 ) ) ) ; } // allow multiple entries during invocation by JndiServiceBinder boolean replaced = false ; String lastName = subname . getLast ( ) ; AutoBindNode abNode = new AutoBindNode ( obj ) ; while ( ! replaced ) { Object oldObj = target . children . putIfAbsent ( lastName , abNode ) ; if ( oldObj != null ) { if ( oldObj instanceof AutoBindNode ) { abNode = ( AutoBindNode ) oldObj ; // This synch ensures that addition of entries to an // AutoBindNode does not take place during removal of // the same AutoBindNode. synchronized ( abNode ) { abNode . addLastEntry ( obj ) ; // This is a no-op in the normal case, but if we're racing an unbind, // we might need to modify a different AutoBindNode replaced = target . children . replace ( lastName , oldObj , abNode ) ; } } else { throw new NameAlreadyBoundException ( "" + fullName . plus ( lastName ) ) ; } } else { replaced = true ; } } }
Works like bind but automatically creates intermediate contexts if they do not exist . Any automatically created contexts will be cleaned up automatically when their last child is unbound .
465
31
161,374
@ Override protected void onMethodEntry ( ) { if ( enabledListeners . isEmpty ( ) ) return ; String probeKey = createKey ( ) ; ProbeImpl probe = getProbe ( probeKey ) ; long probeId = probe . getIdentifier ( ) ; setProbeInProgress ( true ) ; visitLdcInsn ( Long . valueOf ( probeId ) ) ; // long1 long2 if ( isStatic ( ) || isConstructor ( ) ) { visitInsn ( ACONST_NULL ) ; // long1 long2 this } else { visitVarInsn ( ALOAD , 0 ) ; // long1 long2 this } visitInsn ( ACONST_NULL ) ; // long1 long2 this that createParameterArray ( ) ; // long1 long2 this that args visitFireProbeInvocation ( ) ; setProbeInProgress ( false ) ; setProbeListeners ( probe , enabledListeners ) ; }
Inject the byte code required to fire a method entry probe .
203
13
161,375
static long getBufAddress ( ByteBuffer theBuffer ) { /* * This only works for DIRECT byte buffers. Direct ByteBuffers have a field called "address" which * holds the physical address of the start of the buffer contents in native memory. * This method obtains the value of the address field through reflection. */ if ( ! theBuffer . isDirect ( ) ) { throw new IllegalArgumentException ( AsyncProperties . aio_direct_buffers_only ) ; } try { return addrField . getLong ( theBuffer ) ; } catch ( IllegalAccessException exception ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error getting async provider instance, exception: " + exception . getMessage ( ) ) ; } FFDCFilter . processException ( exception , "com.ibm.io.async.AbstractAsyncChannel" , "149" ) ; throw new RuntimeException ( exception . getMessage ( ) ) ; } }
Returns the address of the start of the given direct byte buffer in OS memory .
217
16
161,376
public AsyncFuture getFutureFromIndex ( int theIndex ) { if ( theIndex == READ_FUTURE_INDEX || theIndex == SYNC_READ_FUTURE_INDEX ) { return this . readFuture ; } if ( theIndex == WRITE_FUTURE_INDEX || theIndex == SYNC_WRITE_FUTURE_INDEX ) { return this . writeFuture ; } return null ; }
Gets the Future corresponding to a supplied index value .
93
11
161,377
void cancel ( AsyncChannelFuture future , Exception reason ) throws ClosedChannelException , IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "cancel" ) ; } if ( ! isOpen ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Cancel request on closed connection" ) ; } future . setCancelInProgress ( 0 ) ; throw new ClosedChannelException ( ) ; } // Cannot cancel a completed call. if ( future . isCompleted ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Cancel request on completed future" ) ; } future . setCancelInProgress ( 0 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "cancel" ) ; } return ; } long callid ; if ( ( ( AsyncFuture ) future ) . isRead ( ) ) { callid = this . readIOCB . getCallIdentifier ( ) ; } else { callid = this . writeIOCB . getCallIdentifier ( ) ; } int rc = provider . cancel2 ( this . channelIdentifier , callid ) ; if ( rc == 0 ) { // Mark the future completed with an Exception if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Cancel Successful, resetting CancelInProgress state to 0" ) ; } future . setCancelInProgress ( 0 ) ; future . completed ( reason ) ; } else { // could not cancel if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Cancel could not be completed" ) ; } future . setCancelInProgress ( 0 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "cancel" ) ; } }
Package private version of cancel which takes an exception as an additional parameter . The exception is applied to the future on cancellation .
478
24
161,378
public void enable ( int level ) { if ( level >= PmiConstants . LEVEL_HIGH ) sync = true ; else sync = false ; if ( ! enabled ) { enabled = true ; reset ( ) ; } }
mark the data enabled and reset the value and createTime
47
11
161,379
protected final Bucket < K , V > getBucketForKey ( K key ) { int bucket_index = ( key . hashCode ( ) & 0x7FFFFFFF ) % buckets . length ; Bucket < K , V > thebucket = buckets [ bucket_index ] ; if ( thebucket == null ) { synchronized ( this ) { thebucket = buckets [ bucket_index ] ; if ( thebucket == null ) { thebucket = new Bucket < K , V > ( ) ; buckets [ bucket_index ] = thebucket ; } // if } // sync } // if return thebucket ; }
Returns the bucket which the specified key hashes to
134
9
161,380
protected void introspect ( ObjectName objectName , QueryExp query , PrintWriter writer ) { // Iterate over the mbean servers, query for the beans, introspect for ( MBeanServer mbeanServer : getMBeanServers ( ) ) { for ( ObjectName mbean : mbeanServer . queryNames ( objectName , query ) ) { introspectMBeanAttributes ( mbeanServer , mbean , writer ) ; } } }
GIven a JMX object name and a filter introspect all matching MBeans that are found associated with registered MBean servers .
96
28
161,381
String getFormattedArray ( Object attribute , String indent ) { int arrayLength = Array . getLength ( attribute ) ; if ( arrayLength == 0 ) { return "[]" ; } Class < ? > componentType = attribute . getClass ( ) . getComponentType ( ) ; // For the 8 primitive types, a cast is necessary when invoking // Arrays.toString. The array data is then broken into separate // lines if ( componentType . equals ( boolean . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( boolean [ ] ) attribute ) , indent ) ; } else if ( componentType . equals ( byte . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( byte [ ] ) attribute ) , indent ) ; } else if ( componentType . equals ( char . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( char [ ] ) attribute ) , indent ) ; } else if ( componentType . equals ( double . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( double [ ] ) attribute ) , indent ) ; } else if ( componentType . equals ( float . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( float [ ] ) attribute ) , indent ) ; } else if ( componentType . equals ( int . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( int [ ] ) attribute ) , indent ) ; } else if ( componentType . equals ( long . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( long [ ] ) attribute ) , indent ) ; } else if ( componentType . equals ( short . class ) ) { return formatPrimitiveArrayString ( Arrays . toString ( ( short [ ] ) attribute ) , indent ) ; } // Arbitrary strings can have ', ' in them so we iterate here StringBuilder sb = new StringBuilder ( ) ; indent += INDENT ; Object [ ] array = ( Object [ ] ) attribute ; for ( int i = 0 ; i < array . length ; i ++ ) { sb . append ( "\n" ) . append ( indent ) . append ( "[" ) . append ( i ) . append ( "]: " ) ; sb . append ( String . valueOf ( array [ i ] ) ) ; } return sb . toString ( ) ; }
Format an array .
520
4
161,382
String getFormattedCompositeData ( CompositeData cd , String indent ) { StringBuilder sb = new StringBuilder ( ) ; indent += INDENT ; CompositeType type = cd . getCompositeType ( ) ; for ( String key : type . keySet ( ) ) { sb . append ( "\n" ) . append ( indent ) ; sb . append ( key ) . append ( ": " ) ; OpenType < ? > openType = type . getType ( key ) ; if ( openType instanceof SimpleType ) { sb . append ( cd . get ( key ) ) ; } else if ( openType instanceof CompositeType ) { CompositeData nestedData = ( CompositeData ) cd . get ( key ) ; sb . append ( getFormattedCompositeData ( nestedData , indent ) ) ; } else if ( openType instanceof TabularType ) { TabularData tabularData = ( TabularData ) cd . get ( key ) ; sb . append ( tabularData ) ; } } return String . valueOf ( sb ) ; }
Format an open MBean composite data attribute .
232
10
161,383
@ SuppressWarnings ( "unchecked" ) String getFormattedTabularData ( TabularData td , String indent ) { StringBuilder sb = new StringBuilder ( ) ; indent += INDENT ; sb . append ( "{" ) ; Collection < CompositeData > values = ( Collection < CompositeData > ) td . values ( ) ; int valuesRemaining = values . size ( ) ; for ( CompositeData cd : values ) { sb . append ( getFormattedCompositeData ( cd , indent ) ) ; if ( -- valuesRemaining > 0 ) { sb . append ( "\n" ) . append ( indent ) . append ( "}, {" ) ; } } sb . append ( "}" ) ; return String . valueOf ( sb ) ; }
Format an open MBean tabular data attribute .
167
11
161,384
@ Override public void handle ( Callback [ ] callbacks ) throws IOException , UnsupportedCallbackException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "handle" ) ; } if ( callbacks == null || callbacks . length == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "handle" , "No Callbacks received, do nothing." ) ; } return ; } arrangeCallbacks ( callbacks ) ; // 675924 try { for ( Callback callback : callbacks ) { if ( callback instanceof CallerPrincipalCallback ) { J2CSecurityHelper . handleCallerPrincipalCallback ( ( CallerPrincipalCallback ) callback , _executionSubject , _addedCred , _realmName , _unauthenticated , _invocations ) ; // TODO Mapping to principals in the same domain in case the inflown // principal is not in the same security domain as the application server. } else if ( callback instanceof GroupPrincipalCallback ) { // Names of group principals to be added to the subject J2CSecurityHelper . handleGroupPrincipalCallback ( ( GroupPrincipalCallback ) callback , _executionSubject , _addedCred , _realmName , _invocations ) ; } else if ( callback instanceof PasswordValidationCallback ) { J2CSecurityHelper . handlePasswordValidationCallback ( ( PasswordValidationCallback ) callback , _executionSubject , _addedCred , _realmName , _invocations ) ; } else { throw new UnsupportedCallbackException ( callback ) ; } } J2CSecurityHelper . addSubjectCustomData ( _executionSubject , _addedCred ) ; } catch ( Exception ex ) { Tr . error ( tc , "ERROR_HANDLING_CALLBACK_J2CA0672" , new Object [ ] { ex . getClass ( ) . getName ( ) , ex . getMessage ( ) } ) ; FFDCFilter . processException ( ex , getClass ( ) . getName ( ) + ".handle" , "153" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The exception is " + ex ) ; //ex.printStackTrace(System.out); } if ( ex instanceof IOException ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "handle" ) ; } throw ( IOException ) ex ; } else if ( ex instanceof UnsupportedCallbackException ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "handle" ) ; } throw ( UnsupportedCallbackException ) ex ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "handle" ) ; } throw new IOException ( ex ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "handle" ) ; } }
This method is invoked by the resource adapter after passing the list of callbacks that it needs the application server to handle . The behaviour of the handler for each of the callbacks is given below
708
38
161,385
private void arrangeCallbacks ( Callback [ ] callbacks ) { if ( callbacks [ 0 ] instanceof CallerPrincipalCallback ) return ; int length = callbacks . length ; for ( int i = 0 ; i < length ; i ++ ) { if ( callbacks [ i ] instanceof CallerPrincipalCallback ) { Callback callback = callbacks [ 0 ] ; callbacks [ 0 ] = callbacks [ i ] ; callbacks [ i ] = callback ; break ; } } }
This method is called to ensure that the first callback is always a CallerPrincipalCallback irrespective of the order in which the callbacks are passed in by the resource adapter . If we need to return false to the PasswordValidationCallback when the name passed in by the CallerPrincipalCallback is different from the one set in the PasswordValidationCallback the PasswordValidationCallback should always be processed after the CallerPrincipalCallback .
103
85
161,386
public final void makeEmptyAndClean ( ) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "makeEmptyAndClean"); makeEmpty ( ) ; for ( int i = 0 ; i < m_array . length ; ++ i ) m_array [ i ] = null ; // if (tc.isEntryEnabled()) // SibTr.entry(tc, "makeEmptyAndClean"); }
Empty the queue and also set every element of the internal array to null so that the removed elements can be GC d .
91
24
161,387
public final int size ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "size" ) ; int result = ( m_tail >= m_head ) ? ( m_tail - m_head ) : ( m_array . length - m_head + m_tail ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "size" , new Integer ( result ) ) ; return result ; }
Return the number of elements in the queue .
102
9
161,388
public final void enqueue ( Object obj ) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "enqueue", obj); // m_array has at least one position in it that is free. m_array [ m_tail ++ ] = obj ; if ( m_tail == m_array . length ) m_tail = 0 ; if ( m_head == m_tail ) expand_array ( ) ; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "enqueue"); }
Store an object in the queue .
118
7
161,389
public final Object dequeue ( ) throws NoSuchElementException { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "dequeue"); if ( m_head == m_tail ) throw new NoSuchElementException ( ) ; Object obj = m_array [ m_head ] ; m_array [ m_head ++ ] = null ; if ( m_head == m_array . length ) m_head = 0 ; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "dequeue", obj); return obj ; }
Return the first element on the queue .
124
8
161,390
private final void expand_array ( ) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "expand_array"); int length = m_array . length ; Object [ ] m_new = new Object [ length * 2 ] ; System . arraycopy ( m_array , m_head , m_new , m_head , length - m_head ) ; System . arraycopy ( m_array , 0 , m_new , length , m_tail ) ; m_tail += length ; m_array = m_new ; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "expand_array"); }
Increase the size of the internal array to accomodate more queue elements .
146
16
161,391
@ Override public LinkedHashMap < String , Object > getConfigDump ( String aLocalId , boolean aRegisteredOnly ) { // 327843 removed unused parameter if ( TC . isEntryEnabled ( ) ) { Tr . entry ( this , TC , "getConfigDump" ) ; } LinkedHashMap < String , Object > cp = new LinkedHashMap < String , Object > ( ) ; if ( TC . isEntryEnabled ( ) ) { Tr . exit ( this , TC , "getConfigDump" ) ; } return cp ; }
Generate a config dump containing all the attributes which match the regular expression .
120
15
161,392
private Transactional findInterceptorFromStereotype ( Annotation [ ] anns ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "findInterceptorFromStereotype" , new Object [ ] { anns , this } ) ; Transactional ret = null ; for ( Annotation ann : anns ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Examining annotation: " + ann . toString ( ) ) ; Class < ? extends Annotation > annType = ann . annotationType ( ) ; if ( annType . getAnnotation ( Stereotype . class ) != null ) { // we've found a stereotype. Check if it has an interceptor, // and if not recurse! ret = findTransactionalInterceptor ( annType ) ; if ( ret != null ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findInterceptorFromStereotype" , ret ) ; return ret ; } } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findInterceptorFromStereotype" , null ) ; return null ; }
it here .
253
3
161,393
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "writeObject : " + this ) ; // d468174 out . writeObject ( ivPuRefId ) ; out . writeObject ( ivJ2eeName ) ; // d510184 out . writeObject ( ivRefName ) ; // d510184 out . writeObject ( ivProperties ) ; out . writeBoolean ( ivUnsynchronized ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeObject : " + this ) ; }
Instance serialization .
162
4
161,394
protected void registerEmInvocation ( UOWCoordinator uowCoord , Synchronization emInvocation ) { try { ivAbstractJPAComponent . getEmbeddableWebSphereTransactionManager ( ) . registerSynchronization ( uowCoord , emInvocation , SYNC_TIER_OUTER ) ; //d638095.4 } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "registerEmInvocation experienced unexpected exception while registering with transaction: " + e ) ; FFDCFilter . processException ( e , CLASS_NAME + ".registerEmInvocation" , "507" , this ) ; throw new RuntimeException ( "Registration of Entity Manager invocation with Transaction failed." , e ) ; } }
d638095 . 4
176
6
161,395
private void buildDiscriminatorNodes ( DiscriminatorNode node ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "buildDiscriminatorNodes: " + node ) ; } DiscriminatorNode dn = node ; if ( dn == null ) { return ; } DiscriminatorNode newDN = null , lastDN = null ; discriminators = new DiscriminatorNode ( dn . disc , dn . weight , null , null ) ; discAL . add ( dn . disc ) ; Channel chan = dn . disc . getChannel ( ) ; addChannel ( chan ) ; newDN = discriminators ; lastDN = discriminators ; while ( dn . next != null ) { dn = dn . next ; newDN = new DiscriminatorNode ( dn . disc , dn . weight , null , lastDN ) ; lastDN . next = newDN ; lastDN = newDN ; discAL . add ( dn . disc ) ; chan = dn . disc . getChannel ( ) ; addChannel ( chan ) ; } }
Copy this DiscriminatorNode list .
250
8
161,396
@ Override public void addDiscriminator ( Discriminator d , int weight ) throws DiscriminationProcessException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "addDiscriminator: " + d + " weight=" + weight ) ; } if ( status == STARTED ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Should not add to DiscriminationGroup while started!" ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "239" , this , new Object [ ] { d } ) ; throw e ; } if ( weight < 0 ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Invalid weight for discriminator, " + weight ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "260" , this , new Object [ ] { Long . valueOf ( weight ) } ) ; throw e ; } if ( ! discAL . contains ( d ) ) { if ( d . getDiscriminatoryDataType ( ) . isAssignableFrom ( discriminantClass ) ) { if ( d . getChannel ( ) == null || d . getChannel ( ) . getName ( ) == null ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Discriminator does not have channel or its channel has no name" ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "273" , this , new Object [ ] { d } ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Add discriminator " + d . getChannel ( ) . getName ( ) ) ; } addDiscriminatorNode ( new DiscriminatorNode ( d , weight ) ) ; discAL . add ( d ) ; Channel chan = d . getChannel ( ) ; addChannel ( chan ) ; this . changed = true ; } else { ClassCastException e = new ClassCastException ( ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "292" , this , new Object [ ] { d } ) ; throw e ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Same discriminator added twice?" ) ; } } }
Adds a discriminator to the group . Attempts to add the same discriminator more than once are ignored . It is an error to attempt to add a discriminator which is not able to deal with the groups type of discriminatory data . A class cast exception is thrown if this is attempted .
560
58
161,397
private void addDiscriminatorNode ( DiscriminatorNode dn ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "addDiscriminatorNode, weight=" + dn . weight ) ; } if ( discriminators == null ) { // add it as the first node discriminators = dn ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "addDiscriminatorNode" ) ; } return ; } DiscriminatorNode thisDN = discriminators ; if ( thisDN . weight > dn . weight ) { // add it as the first node if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Adding disc first in list" ) ; } thisDN . prev = dn ; dn . next = thisDN ; discriminators = dn ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "addDiscriminatorNode" ) ; } return ; } DiscriminatorNode lastDN = discriminators ; while ( thisDN . next != null ) { // somewhere in the middle lastDN = thisDN ; thisDN = thisDN . next ; if ( thisDN . weight > dn . weight ) { // put it in the middle if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Adding disc before " + thisDN . disc . getChannel ( ) . getName ( ) ) ; } thisDN . prev = dn ; dn . next = thisDN ; lastDN . next = dn ; dn . prev = lastDN ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "addDiscriminatorNode" ) ; } return ; } } // guess its at the end thisDN . next = dn ; dn . prev = thisDN ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "addDiscriminatorNode" ) ; } }
add a discriminatorNode to the linked list .
498
10
161,398
private void removeDiscriminatorNode ( Discriminator d ) throws DiscriminationProcessException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "removeDiscriminatorNode: " + d ) ; } if ( d == null ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Can't remove a null discriminator" ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".removeDiscriminatorNode" , "484" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removeDiscriminatorNode" ) ; } throw e ; } if ( discriminators . disc . equals ( d ) ) { // removing the first discriminator discriminators = discriminators . next ; if ( discriminators != null ) { discriminators . prev = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removeDiscriminatorNode" ) ; } return ; } // search through the list of discriminators DiscriminatorNode thisDN = discriminators . next , lastDN = discriminators ; while ( thisDN . next != null ) { if ( thisDN . disc . equals ( d ) ) { thisDN . next . prev = lastDN ; lastDN . next = thisDN . next ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removeDiscriminatorNode" ) ; } return ; } // somewhere in the middle lastDN = thisDN ; thisDN = thisDN . next ; } if ( thisDN . disc . equals ( d ) ) { // found it! lastDN . next = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removeDiscriminatorNode" ) ; } return ; } // Does not exist? if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removeDiscriminatorNode: not found" ) ; } throw new NoSuchElementException ( ) ; }
remove the discriminatorNode from the linkedList .
498
10
161,399
@ Override public void start ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Started discriminator list " + discAL + "with size" + discAL . size ( ) ) ; } if ( discAL . size ( ) > 1 ) { rebuildDiscriminatorList ( ) ; discriminationAlgorithm = new MultiDiscriminatorAlgorithm ( this ) ; } else if ( discAL . size ( ) == 1 ) { discriminationAlgorithm = new SingleDiscriminatorAlgorithm ( this ) ; } else { discriminationAlgorithm = new FailureDiscriminatorAlgorithm ( ) ; } status = STARTED ; }
Start this DiscriminatorProcess .
150
7