idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
37,300
private ReturnCode write ( String command , ReturnCode notStartedRC , ReturnCode errorRC ) { SocketChannel channel = null ; try { ServerCommandID commandID = createServerCommand ( command ) ; if ( commandID . getPort ( ) > 0 ) { channel = SelectorProvider . provider ( ) . openSocketChannel ( ) ; channel . connect ( new InetSocketAddress ( InetAddress . getByName ( null ) , commandID . getPort ( ) ) ) ; write ( channel , commandID . getCommandString ( ) ) ; String authID = read ( channel ) ; File authFile = new File ( commandAuthDir , authID ) ; authFile . delete ( ) ; write ( channel , authID ) ; String cmdResponse = read ( channel ) , targetServerUUID = null , responseCode = null ; if ( cmdResponse . isEmpty ( ) ) { throw new IOException ( "connection closed by server without a reply" ) ; } if ( cmdResponse . indexOf ( DELIM ) != - 1 ) { targetServerUUID = cmdResponse . substring ( 0 , cmdResponse . indexOf ( DELIM ) ) ; responseCode = cmdResponse . substring ( cmdResponse . indexOf ( DELIM ) + 1 ) ; } else { targetServerUUID = cmdResponse ; } if ( ! commandID . validateTarget ( targetServerUUID ) ) { throw new IOException ( "command file mismatch" ) ; } ReturnCode result = ReturnCode . OK ; if ( responseCode != null ) { try { int returnCode = Integer . parseInt ( responseCode . trim ( ) ) ; result = ReturnCode . getEnum ( returnCode ) ; } catch ( NumberFormatException nfe ) { throw new IOException ( "invalid return code" ) ; } } if ( result == ReturnCode . INVALID ) { throw new IOException ( "invalid return code" ) ; } return result ; } if ( commandID . getPort ( ) == - 1 ) { return ReturnCode . SERVER_COMMAND_PORT_DISABLED_STATUS ; } return notStartedRC ; } catch ( ConnectException e ) { Debug . printStackTrace ( e ) ; return notStartedRC ; } catch ( IOException e ) { Debug . printStackTrace ( e ) ; return errorRC ; } finally { Utils . tryToClose ( channel ) ; } }
Write a command to the server process .
37,301
public ReturnCode startStatus ( ServerLock lock ) { while ( ! isValid ( ) ) { ReturnCode rc = startStatusWait ( lock ) ; if ( rc != ReturnCode . START_STATUS_ACTION ) { return rc ; } } for ( int i = 0 ; i < BootstrapConstants . MAX_POLL_ATTEMPTS && isValid ( ) ; i ++ ) { ReturnCode rc = write ( STATUS_START_COMMAND , ReturnCode . START_STATUS_ACTION , ReturnCode . ERROR_SERVER_START ) ; if ( rc != ReturnCode . START_STATUS_ACTION ) { return rc ; } rc = startStatusWait ( lock ) ; if ( rc != ReturnCode . START_STATUS_ACTION ) { return rc ; } } return write ( STATUS_START_COMMAND , ReturnCode . ERROR_SERVER_START , ReturnCode . ERROR_SERVER_START ) ; }
Waits for the server to be fully started .
37,302
private ReturnCode startStatusWait ( ServerLock lock ) { try { Thread . sleep ( BootstrapConstants . POLL_INTERVAL_MS ) ; } catch ( InterruptedException ex ) { Debug . printStackTrace ( ex ) ; return ReturnCode . ERROR_SERVER_START ; } if ( ! lock . testServerRunning ( ) ) { return ReturnCode . ERROR_SERVER_START ; } return ReturnCode . START_STATUS_ACTION ; }
Wait a bit because the server process could not be contacted and then verify that the server process is still running .
37,303
public ReturnCode stopServer ( boolean force ) { return write ( force ? FORCE_STOP_COMMAND : STOP_COMMAND , ReturnCode . REDUNDANT_ACTION_STATUS , ReturnCode . ERROR_SERVER_STOP ) ; }
Stop the server by issuing a stop instruction to the server listener
37,304
public ReturnCode introspectServer ( String dumpTimestamp , Set < JavaDumpAction > javaDumpActions ) { String command ; if ( javaDumpActions . isEmpty ( ) ) { command = INTROSPECT_COMMAND + DELIM + dumpTimestamp ; } else { StringBuilder commandBuilder = new StringBuilder ( ) . append ( INTROSPECT_JAVADUMP_COMMAND ) . append ( DELIM ) . append ( dumpTimestamp ) ; for ( JavaDumpAction javaDumpAction : javaDumpActions ) { commandBuilder . append ( ',' ) . append ( javaDumpAction . name ( ) ) ; } command = commandBuilder . toString ( ) ; } return write ( command , ReturnCode . DUMP_ACTION , ReturnCode . ERROR_SERVER_DUMP ) ; }
Dump the server by issuing a introspect instruction to the server listener
37,305
public ReturnCode javaDump ( Set < JavaDumpAction > javaDumpActions ) { StringBuilder commandBuilder = new StringBuilder ( JAVADUMP_COMMAND ) ; char sep = DELIM ; for ( JavaDumpAction javaDumpAction : javaDumpActions ) { commandBuilder . append ( sep ) . append ( javaDumpAction . toString ( ) ) ; sep = ',' ; } return write ( commandBuilder . toString ( ) , ReturnCode . SERVER_INACTIVE_STATUS , ReturnCode . ERROR_SERVER_DUMP ) ; }
Create a java dump of the server JVM by issuing a javadump instruction to the server listener
37,306
public ReturnCode pause ( String targetArg ) { StringBuilder commandBuilder = new StringBuilder ( PAUSE_COMMAND ) ; char sep = DELIM ; if ( targetArg != null ) { commandBuilder . append ( sep ) . append ( targetArg ) ; } return write ( commandBuilder . toString ( ) , ReturnCode . SERVER_INACTIVE_STATUS , ReturnCode . ERROR_SERVER_PAUSE ) ; }
Attempt to Stop the inbound work to a server by issuing a pause request to the server .
37,307
public ReturnCode resume ( String targetArg ) { StringBuilder commandBuilder = new StringBuilder ( RESUME_COMMAND ) ; char sep = DELIM ; if ( targetArg != null ) { commandBuilder . append ( sep ) . append ( targetArg ) ; } return write ( commandBuilder . toString ( ) , ReturnCode . SERVER_INACTIVE_STATUS , ReturnCode . ERROR_SERVER_RESUME ) ; }
Resume Inbound work to a server by issuing a resume request to the server .
37,308
public boolean contain ( OidcTokenImplBase token ) { String key = token . getJwtId ( ) ; if ( key == null ) { return false ; } key = getCacheKey ( token ) ; long currentTimeMilliseconds = ( new Date ( ) ) . getTime ( ) ; synchronized ( primaryTable ) { Long exp = ( Long ) primaryTable . get ( key ) ; if ( exp != null ) { if ( exp . longValue ( ) > currentTimeMilliseconds ) { return true ; } else { primaryTable . remove ( key ) ; } } long tokenExp = token . getExpirationTimeSeconds ( ) * 1000 ; if ( tokenExp == 0 ) { tokenExp = currentTimeMilliseconds + 60 * 60 * 1000 ; } primaryTable . put ( key , Long . valueOf ( tokenExp ) ) ; } return false ; }
Find and return the object associated with the specified key . Add it if not already present .
37,309
public final ResourceException isValid ( int newAction ) { try { setState ( newAction , true ) ; } catch ( TransactionException exp ) { FFDCFilter . processException ( exp , "com.ibm.ws.rsadapter.spi.WSStateManager.isValid" , "385" , this ) ; return exp ; } return null ; }
If the action is valid return null . Otherwise return a TransactionException with the cause .
37,310
public boolean containsValue ( Object value ) throws ObjectManagerException { if ( getRoot ( ) != null ) return containsValue ( getRoot ( ) , value ) ; return false ; }
Searches this TreeMap for the specified value .
37,311
public Set entrySet ( ) throws ObjectManagerException { return new AbstractSetView ( ) { public long size ( ) { return size ; } public boolean contains ( Object object ) throws ObjectManagerException { if ( object instanceof Map . Entry ) { Map . Entry entry = ( Map . Entry ) object ; Object v1 = get ( entry . getKey ( ) ) , v2 = entry . getValue ( ) ; return v1 == null ? v2 == null : v1 . equals ( v2 ) ; } return false ; } public Iterator iterator ( ) throws ObjectManagerException { return makeTreeMapIterator ( new AbstractMapEntry . Type ( ) { public Object get ( AbstractMapEntry entry ) { return entry ; } } ) ; } } ; }
Answers a Set of the mappings contained in this TreeMap . Each element in the set is a Map . Entry . The set is backed by this TreeMap so changes to one are relected by the other . The set does not support adding .
37,312
public Object get ( Object key ) throws ObjectManagerException { Entry node = find ( key ) ; if ( node != null ) return node . value ; return null ; }
Answers the value of the mapping with the specified key .
37,313
public SortedMap headMap ( Object endKey ) { if ( comparator == null ) ( ( Comparable ) endKey ) . compareTo ( endKey ) ; else comparator . compare ( endKey , endKey ) ; return makeSubMap ( null , endKey ) ; }
Answers a SortedMap of the specified portion of this TreeMap which contains keys less than the end key . The returned SortedMap is backed by this TreeMap so changes to one are reflected by the other .
37,314
public Collection keyCollection ( ) { if ( keyCollection == null ) { keyCollection = new AbstractCollectionView ( ) { public long size ( ) throws ObjectManagerException { return AbstractTreeMap . this . size ( ) ; } public Iterator iterator ( ) throws ObjectManagerException { return makeTreeMapIterator ( new AbstractMapEntry . Type ( ) { public Object get ( AbstractMapEntry entry ) { return entry . key ; } } ) ; } } ; } return keyCollection ; }
Answers a Collection of the keys contained in this TreeMap . The set is backed by this TreeMap so changes to one are relected by the other . The Collection does not support adding .
37,315
public Object remove ( Object key ) throws ObjectManagerException { Entry node = find ( key ) ; if ( node == null ) return null ; Object result = node . value ; rbDelete ( node ) ; return result ; }
Removes a mapping with the specified key from this TreeMap .
37,316
public SortedMap subMap ( Object startKey , Object endKey ) { if ( comparator == null ) { if ( ( ( Comparable ) startKey ) . compareTo ( endKey ) <= 0 ) return makeSubMap ( startKey , endKey ) ; } else { if ( comparator . compare ( startKey , endKey ) <= 0 ) return makeSubMap ( startKey , endKey ) ; } throw new IllegalArgumentException ( ) ; }
Answers a SortedMap of the specified portion of this TreeMap which contains keys greater or equal to the start key but less than the end key . The returned SortedMap is backed by this TreeMap so changes to one are reflected by the other .
37,317
public SortedMap tailMap ( Object startKey ) { if ( comparator == null ) ( ( Comparable ) startKey ) . compareTo ( startKey ) ; else comparator . compare ( startKey , startKey ) ; return makeSubMap ( startKey , null ) ; }
Answers a SortedMap of the specified portion of this TreeMap which contains keys greater or equal to the start key . The returned SortedMap is backed by this TreeMap so changes to one are reflected by the other .
37,318
public Collection values ( ) { if ( values == null ) { values = new AbstractCollectionView ( ) { public long size ( ) throws ObjectManagerException { return AbstractTreeMap . this . size ( ) ; } public Iterator iterator ( ) throws ObjectManagerException { return makeTreeMapIterator ( new AbstractMapEntry . Type ( ) { public Object get ( AbstractMapEntry entry ) { return entry . getValue ( ) ; } } ) ; } } ; } return values ; }
Answers a Collection of the values contained in this TreeMap . The collection is backed by this TreeMap so changes to one are relected by the other . The collection does not support adding .
37,319
public static void assignMongoServers ( LibertyServer libertyServer ) throws Exception { MongoServerSelector mongoServerSelector = new MongoServerSelector ( libertyServer ) ; mongoServerSelector . updateLibertyServerMongos ( ) ; }
Reads a server configuration and replaces the placeholder values with an available host and port as specified in the mongo . properties file
37,320
private Map < String , List < MongoElement > > getMongoElements ( ) throws Exception { for ( MongoElement mongo : serverConfig . getMongos ( ) ) { addMongoElementToMap ( mongo ) ; } for ( MongoDBElement mongoDB : serverConfig . getMongoDBs ( ) ) { if ( mongoDB . getMongo ( ) != null ) { addMongoElementToMap ( mongoDB . getMongo ( ) ) ; } } return mongoElements ; }
Creates a mapping of a Mongo server placeholder value to the one or more mongo elements in the server . xml containing that placeholder
37,321
private void updateMongoElements ( String serverPlaceholder , ExternalTestService mongoService ) { Integer [ ] port = { Integer . valueOf ( mongoService . getPort ( ) ) } ; for ( MongoElement mongo : mongoElements . get ( serverPlaceholder ) ) { mongo . setHostNames ( mongoService . getAddress ( ) ) ; mongo . setPorts ( port ) ; String user = mongo . getUser ( ) ; if ( user != null ) { String replacementPassword = mongoService . getProperties ( ) . get ( user + "_password" ) ; if ( replacementPassword != null ) { mongo . setPassword ( replacementPassword ) ; } } } }
For the mongo elements containing the given placeholder value the host and port placeholder values in the mongo element are replaced with an actual host and port of an available mongo server .
37,322
private static boolean validateMongoConnection ( ExternalTestService mongoService ) { String method = "validateMongoConnection" ; MongoClient mongoClient = null ; String host = mongoService . getAddress ( ) ; int port = mongoService . getPort ( ) ; File trustStore = null ; MongoClientOptions . Builder optionsBuilder = new MongoClientOptions . Builder ( ) . connectTimeout ( 30000 ) ; try { trustStore = File . createTempFile ( "mongoTrustStore" , "jks" ) ; Map < String , String > serviceProperties = mongoService . getProperties ( ) ; String password = serviceProperties . get ( TEST_USERNAME + "_password" ) ; SSLSocketFactory sslSocketFactory = null ; try { mongoService . writePropertyAsFile ( "ca_truststore" , trustStore ) ; sslSocketFactory = getSocketFactory ( trustStore ) ; } catch ( IllegalStateException e ) { } if ( sslSocketFactory != null ) { optionsBuilder . socketFactory ( sslSocketFactory ) ; } MongoClientOptions clientOptions = optionsBuilder . build ( ) ; List < MongoCredential > credentials = Collections . emptyList ( ) ; if ( password != null ) { MongoCredential credential = MongoCredential . createCredential ( TEST_USERNAME , TEST_DATABASE , password . toCharArray ( ) ) ; credentials = Collections . singletonList ( credential ) ; } Log . info ( c , method , "Attempting to contact server " + host + ":" + port + " with password " + ( password != null ? "set" : "not set" ) + " and truststore " + ( sslSocketFactory != null ? "set" : "not set" ) ) ; mongoClient = new MongoClient ( new ServerAddress ( host , port ) , credentials , clientOptions ) ; mongoClient . getDB ( "default" ) . getCollectionNames ( ) ; mongoClient . close ( ) ; } catch ( Exception e ) { Log . info ( c , method , "Couldn't create a connection to " + mongoService . getServiceName ( ) + " on " + mongoService . getAddress ( ) + ". " + e . toString ( ) ) ; mongoService . reportUnhealthy ( "Couldn't connect to server. Exception: " + e . toString ( ) ) ; return false ; } finally { if ( trustStore != null ) { trustStore . delete ( ) ; } } return true ; }
Creates a connection to the mongo server at the given location using the mongo java client .
37,323
private static SSLSocketFactory getSocketFactory ( File trustStore ) throws KeyStoreException , FileNotFoundException , IOException , NoSuchAlgorithmException , CertificateException , KeyManagementException { KeyStore keystore = KeyStore . getInstance ( "JKS" ) ; InputStream truststoreInputStream = null ; try { truststoreInputStream = new FileInputStream ( trustStore ) ; keystore . load ( truststoreInputStream , KEYSTORE_PW ) ; } finally { if ( truststoreInputStream != null ) { truststoreInputStream . close ( ) ; } } TrustManagerFactory trustManagerFactory = TrustManagerFactory . getInstance ( "PKIX" ) ; trustManagerFactory . init ( keystore ) ; TrustManager [ ] trustMangers = trustManagerFactory . getTrustManagers ( ) ; SSLContext sslContext = SSLContext . getInstance ( "TLS" ) ; sslContext . init ( null , trustMangers , null ) ; SSLSocketFactory sslSocketFactory = sslContext . getSocketFactory ( ) ; return sslSocketFactory ; }
Returns an SSLSocketFactory needed to connect to an SSL mongo server . The socket factory is created using the testTruststore . jks .
37,324
public static Locale converterTagLocaleFromString ( String name ) { try { Locale locale ; StringTokenizer st = new StringTokenizer ( name , "_" ) ; String language = st . nextToken ( ) ; if ( st . hasMoreTokens ( ) ) { String country = st . nextToken ( ) ; if ( st . hasMoreTokens ( ) ) { String variant = st . nextToken ( ) ; locale = new Locale ( language , country , variant ) ; } else { locale = new Locale ( language , country ) ; } } else { locale = new Locale ( language ) ; } return locale ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Locale parsing exception - " + "invalid string representation '" + name + "'" ) ; } }
Convert locale string used by converter tags to locale .
37,325
public void incrementHeadSequenceNumber ( ConcurrentSubList . Link link ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "incrementheadSequenceNumber" , new Object [ ] { link } ) ; if ( link . next == null ) { headSequenceNumber ++ ; } else { ConcurrentSubList . Link nextLink = ( ConcurrentSubList . Link ) link . next . getManagedObject ( ) ; if ( nextLink . sequenceNumber != headSequenceNumber ) headSequenceNumber ++ ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "incrementHeadSequenceNumber" , new Object [ ] { new Long ( headSequenceNumber ) } ) ; }
Increment the headSequenceNumber after removal of a link in a subList . Caller must already be synchronized on headSequenceNumberLock .
37,326
private void resetTailSequenceNumber ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "resetTailSequenceNumber" ) ; for ( int i = 0 ; i < subListTokens . length ; i ++ ) { subLists [ i ] = ( ( ConcurrentSubList ) subListTokens [ i ] . getManagedObject ( ) ) ; Token tailToken = subLists [ i ] . tail ; if ( tailToken != null ) { ConcurrentSubList . Link tail = ( ConcurrentSubList . Link ) tailToken . getManagedObject ( ) ; tailSequenceNumber = Math . max ( tailSequenceNumber , tail . sequenceNumber ) ; } } tailSequenceNumberSet = true ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "resetHeadSequenceNumber" ) ; }
Reset the tailSequenceNumber . Caller must be synchronized on tailSequenceNumberLock .
37,327
protected ConcurrentSubList . Link insert ( Token token , ConcurrentSubList . Link insertPoint , Transaction transaction ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "insert" , new Object [ ] { token , insertPoint , transaction } ) ; ConcurrentSubList . Link newLink = null ; synchronized ( transaction . internalTransaction ) { long sequenceNumber = insertPoint . sequenceNumber ; sequenceNumber -- ; ConcurrentSubList list = getSublist ( sequenceNumber ) ; tailSequenceNumberLock . lock ( ) ; try { newLink = list . addEntry ( token , transaction , sequenceNumber , this ) ; } finally { if ( tailSequenceNumberLock . isHeldByCurrentThread ( ) ) tailSequenceNumberLock . unlock ( ) ; } } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "insert" , new Object [ ] { newLink } ) ; return newLink ; }
Insert before the given link .
37,328
public void activate ( ComponentContext compcontext , Map < String , Object > properties ) { String methodName = "activate" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Activating the WebContainer bundle" ) ; } WebContainer . instance . set ( this ) ; this . context = compcontext ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Default Port [ " + DEFAULT_PORT + " ]" ) ; Tr . debug ( tc , methodName , "Default Virtual Host [ " + DEFAULT_VHOST_NAME + " ]" ) ; } WebContainerConfiguration webconfig = new WebContainerConfiguration ( DEFAULT_PORT ) ; webconfig . setDefaultVirtualHostName ( DEFAULT_VHOST_NAME ) ; this . initialize ( webconfig , properties ) ; this . classLoadingSRRef . activate ( context ) ; this . sessionHelperSRRef . activate ( context ) ; this . cacheManagerSRRef . activate ( context ) ; this . injectionEngineSRRef . activate ( context ) ; this . managedObjectServiceSRRef . activate ( context ) ; this . servletContainerInitializers . activate ( context ) ; this . transferContextServiceRef . activate ( context ) ; this . webMBeanRuntimeServiceRef . activate ( context ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Object mbeanService = context . locateService ( REFERENCE_WEB_MBEAN_RUNTIME ) ; Tr . debug ( tc , methodName , "Web MBean Runtime [ " + mbeanService + " ]" ) ; Tr . debug ( tc , methodName , "Web MBean Runtime Reference [ " + webMBeanRuntimeServiceRef . getReference ( ) + " ]" ) ; Tr . debug ( tc , methodName , "Web MBean Runtime Service [ " + webMBeanRuntimeServiceRef . getService ( ) + " ]" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Posting STARTED_EVENT" ) ; } Event event = this . eventService . createEvent ( WebContainerConstants . STARTED_EVENT ) ; this . eventService . postEvent ( event ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Posted STARTED_EVENT" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Activating the WebContainer bundle: Complete" ) ; } }
Activate the web container as a DS component .
37,329
@ FFDCIgnore ( Exception . class ) public void deactivate ( ComponentContext componentContext ) { String methodName = "deactivate" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Deactivating the WebContainer bundle" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Posting STOPPED_EVENT" ) ; } Event event = this . eventService . createEvent ( WebContainerConstants . STOPPED_EVENT ) ; this . eventService . postEvent ( event ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Posted STOPPED_EVENT" ) ; } this . classLoadingSRRef . deactivate ( componentContext ) ; this . sessionHelperSRRef . deactivate ( componentContext ) ; this . cacheManagerSRRef . deactivate ( componentContext ) ; this . injectionEngineSRRef . deactivate ( componentContext ) ; this . managedObjectServiceSRRef . deactivate ( context ) ; this . servletContainerInitializers . deactivate ( componentContext ) ; this . transferContextServiceRef . deactivate ( componentContext ) ; this . webMBeanRuntimeServiceRef . deactivate ( componentContext ) ; WebContainer . instance . compareAndSet ( this , null ) ; extensionFactories . clear ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Deactivating the WebContainer bundle: Complete" ) ; } }
Deactivate the web container as a DS component .
37,330
@ Reference ( service = ClassLoadingService . class , name = "classLoadingService" ) protected void setClassLoadingService ( ServiceReference < ClassLoadingService > ref ) { classLoadingSRRef . setReference ( ref ) ; }
DS method for setting the class loading service reference .
37,331
@ Reference ( policy = ReferencePolicy . DYNAMIC ) protected void setEncodingService ( EncodingUtils encUtils ) { encodingServiceRef . set ( encUtils ) ; }
DS method for setting the Encoding service .
37,332
@ Reference ( service = SessionHelper . class , name = "sessionHelper" ) protected void setSessionHelper ( ServiceReference < SessionHelper > ref ) { sessionHelperSRRef . setReference ( ref ) ; }
Set the reference to the session helper service .
37,333
public ModuleMetaData createModuleMetaData ( ExtendedModuleInfo moduleInfo ) throws MetaDataException { WebModuleInfo webModule = ( WebModuleInfo ) moduleInfo ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "createModuleMetaData: " + webModule . getName ( ) + " " + webModule . getContextRoot ( ) ) ; } try { com . ibm . wsspi . adaptable . module . Container webModuleContainer = webModule . getContainer ( ) ; WebAppConfiguration appConfig = webModuleContainer . adapt ( WebAppConfiguration . class ) ; String appName = appConfig . getApplicationName ( ) ; String j2eeModuleName = appConfig . getJ2EEModuleName ( ) ; WebModuleMetaDataImpl wmmd = ( WebModuleMetaDataImpl ) appConfig . getMetaData ( ) ; wmmd . setJ2EEName ( j2eeNameFactory . create ( appName , j2eeModuleName , null ) ) ; appConfig . setWebApp ( createWebApp ( moduleInfo , appConfig ) ) ; return wmmd ; } catch ( Throwable e ) { Throwable cause = e . getCause ( ) ; MetaDataException m ; if ( ( cause != null ) && ( cause instanceof MetaDataException ) ) { m = ( MetaDataException ) cause ; } else { m = new MetaDataException ( e ) ; FFDCWrapper . processException ( e , getClass ( ) . getName ( ) , "createModuleMetaData" , new Object [ ] { webModule , this } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "createModuleMetaData: " + webModule . getName ( ) + "; " + e ) ; } throw m ; } }
This will create the metadata for a web module in the web container
37,334
protected void registerMBeans ( WebModuleMetaDataImpl webModule , com . ibm . wsspi . adaptable . module . Container container ) { String methodName = "registerMBeans" ; String appName = webModule . getApplicationMetaData ( ) . getName ( ) ; String webAppName = webModule . getName ( ) ; String debugName ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debugName = appName + " " + webAppName ; } else { debugName = null ; } WebMBeanRuntime mBeanRuntime = webMBeanRuntimeServiceRef . getService ( ) ; if ( mBeanRuntime == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: No MBean Runtime" ) ; } return ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: MBean Runtime" ) ; } } String ddPath = com . ibm . ws . javaee . dd . web . WebApp . DD_NAME ; Iterator < IServletConfig > servletConfigs = webModule . getConfiguration ( ) . getServletInfos ( ) ; webModule . mBeanServiceReg = mBeanRuntime . registerModuleMBean ( appName , webAppName , container , ddPath , servletConfigs ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: Registration [ " + webModule . mBeanServiceReg + " ]" ) ; } servletConfigs = webModule . getConfiguration ( ) . getServletInfos ( ) ; while ( servletConfigs . hasNext ( ) ) { IServletConfig servletConfig = servletConfigs . next ( ) ; String servletName = servletConfig . getServletName ( ) ; WebComponentMetaDataImpl wcmdi = ( WebComponentMetaDataImpl ) servletConfig . getMetaData ( ) ; wcmdi . mBeanServiceReg = mBeanRuntime . registerServletMBean ( appName , webAppName , servletName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ] Servlet [ " + servletName + " ]: Registration [ " + wcmdi . mBeanServiceReg + " ]" ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: Completed registrations" ) ; } }
Check for the JSR77 runtime and if available use it to register module and servlet mbeans . As a side effect assign the mbean registration to the web module metadata and to the servlet metadata .
37,335
public void stopModule ( ExtendedModuleInfo moduleInfo ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "stopModule()" , ( ( WebModuleInfo ) moduleInfo ) . getName ( ) ) ; } WebModuleInfo webModule = ( WebModuleInfo ) moduleInfo ; try { DeployedModule dMod = this . deployedModuleMap . remove ( webModule ) ; if ( null == dMod ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "stopModule()" , "DeployedModule not known" ) ; } return ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "stopModule: " + webModule . getName ( ) + " " + webModule . getContextRoot ( ) ) ; } removeContextRootRequirement ( dMod ) ; removeModule ( dMod ) ; this . vhostManager . purgeHost ( dMod . getVirtualHostName ( ) ) ; WebModuleMetaData wmmd = ( WebModuleMetaData ) ( ( ExtendedModuleInfo ) webModule ) . getMetaData ( ) ; deregisterMBeans ( ( WebModuleMetaDataImpl ) wmmd ) ; WebAppConfiguration appConfig = ( WebAppConfiguration ) wmmd . getConfiguration ( ) ; for ( Iterator < IServletConfig > servletConfigs = appConfig . getServletInfos ( ) ; servletConfigs . hasNext ( ) ; ) { IServletConfig servletConfig = servletConfigs . next ( ) ; metaDataService . fireComponentMetaDataDestroyed ( servletConfig . getMetaData ( ) ) ; } metaDataService . fireComponentMetaDataDestroyed ( appConfig . getDefaultComponentMetaData ( ) ) ; metaDataService . fireComponentMetaDataDestroyed ( wmmd . getCollaboratorComponentMetaData ( ) ) ; } catch ( Throwable e ) { FFDCWrapper . processException ( e , getClass ( ) . getName ( ) , "stopModule" , new Object [ ] { webModule , this } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "stopModule: " + webModule . getName ( ) + "; " + e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "stopModule()" ) ; } }
This will stop a web module in the web container
37,336
@ Reference ( cardinality = ReferenceCardinality . MANDATORY , policy = ReferencePolicy . DYNAMIC , policyOption = ReferencePolicyOption . GREEDY ) protected void setConnContextPool ( SRTConnectionContextPool pool ) { this . connContextPool = pool ; }
Only DS should invoke this method
37,337
public void refreshEntry ( com . ibm . wsspi . cache . CacheEntry ce ) { cacheInstance . refreshEntry ( ce . cacheEntry ) ; }
This method moves the specified entry to the end of the LRU queue .
37,338
public CacheEntry getEntryDisk ( Object cacheId ) { CacheEntry cacheEntry = new CacheEntry ( cacheInstance . getEntryDisk ( cacheId ) ) ; return cacheEntry ; }
This method returns the cache entry specified by cache ID from the disk cache .
37,339
public com . ibm . wsspi . cache . CacheEntry getEntry ( Object cacheId ) { CacheEntry cacheEntry = new CacheEntry ( cacheInstance . getEntry ( cacheId ) ) ; return cacheEntry ; }
This method returns an instance of CacheEntry specified cache ID .
37,340
public static Object [ ] getEncoding ( JspInputSource inputSource ) throws IOException , JspCoreException { InputStream inStream = XMLEncodingDetector . getInputStream ( inputSource ) ; XMLEncodingDetector detector = new XMLEncodingDetector ( ) ; Object [ ] ret = detector . getEncoding ( inStream ) ; inStream . close ( ) ; return ret ; }
Autodetects the encoding of the XML document supplied by the given input stream .
37,341
private Reader createReader ( InputStream inputStream , String encoding , Boolean isBigEndian ) throws IOException , JspCoreException { if ( encoding == null ) { encoding = "UTF-8" ; } String ENCODING = encoding . toUpperCase ( Locale . ENGLISH ) ; if ( ENCODING . equals ( "UTF-8" ) ) { return new UTF8Reader ( inputStream , fBufferSize ) ; } if ( ENCODING . equals ( "US-ASCII" ) ) { return new ASCIIReader ( inputStream , fBufferSize ) ; } if ( ENCODING . equals ( "ISO-10646-UCS-4" ) ) { if ( isBigEndian != null ) { boolean isBE = isBigEndian . booleanValue ( ) ; if ( isBE ) { return new UCSReader ( inputStream , UCSReader . UCS4BE ) ; } else { return new UCSReader ( inputStream , UCSReader . UCS4LE ) ; } } else { throw new JspCoreException ( "jsp.error.xml.encodingByteOrderUnsupported" , new Object [ ] { encoding } ) ; } } if ( ENCODING . equals ( "ISO-10646-UCS-2" ) ) { if ( isBigEndian != null ) { boolean isBE = isBigEndian . booleanValue ( ) ; if ( isBE ) { return new UCSReader ( inputStream , UCSReader . UCS2BE ) ; } else { return new UCSReader ( inputStream , UCSReader . UCS2LE ) ; } } else { throw new JspCoreException ( "jsp.error.xml.encodingByteOrderUnsupported" , new Object [ ] { encoding } ) ; } } boolean validIANA = XMLChar . isValidIANAEncoding ( encoding ) ; boolean validJava = XMLChar . isValidJavaEncoding ( encoding ) ; if ( ! validIANA || ( fAllowJavaEncodings && ! validJava ) ) { encoding = "ISO-8859-1" ; throw new JspCoreException ( "jsp.error.xml.encodingDeclInvalid" , new Object [ ] { encoding } ) ; } String javaEncoding = EncodingMap . getIANA2JavaMapping ( ENCODING ) ; if ( javaEncoding == null ) { if ( fAllowJavaEncodings ) { javaEncoding = encoding ; } else { javaEncoding = "ISO8859_1" ; throw new JspCoreException ( "jsp.error.xml.encodingDeclInvalid" , new Object [ ] { encoding } ) ; } } return new InputStreamReader ( inputStream , javaEncoding ) ; }
Creates a reader capable of reading the given input stream in the specified encoding .
37,342
private Object [ ] getEncodingName ( byte [ ] b4 , int count ) { if ( count < 2 ) { return new Object [ ] { "UTF-8" , null , Boolean . FALSE } ; } int b0 = b4 [ 0 ] & 0xFF ; int b1 = b4 [ 1 ] & 0xFF ; if ( b0 == 0xFE && b1 == 0xFF ) { return new Object [ ] { "UTF-16BE" , Boolean . TRUE } ; } if ( b0 == 0xFF && b1 == 0xFE ) { return new Object [ ] { "UTF-16LE" , Boolean . FALSE } ; } if ( count < 3 ) { return new Object [ ] { "UTF-8" , null , Boolean . FALSE } ; } int b2 = b4 [ 2 ] & 0xFF ; if ( b0 == 0xEF && b1 == 0xBB && b2 == 0xBF ) { return new Object [ ] { "UTF-8" , null } ; } if ( count < 4 ) { return new Object [ ] { "UTF-8" , null } ; } int b3 = b4 [ 3 ] & 0xFF ; if ( b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C ) { return new Object [ ] { "ISO-10646-UCS-4" , new Boolean ( true ) } ; } if ( b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00 ) { return new Object [ ] { "ISO-10646-UCS-4" , new Boolean ( false ) } ; } if ( b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00 ) { return new Object [ ] { "ISO-10646-UCS-4" , null } ; } if ( b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00 ) { return new Object [ ] { "ISO-10646-UCS-4" , null } ; } if ( b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F ) { return new Object [ ] { "UTF-16BE" , new Boolean ( true ) } ; } if ( b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00 ) { return new Object [ ] { "UTF-16LE" , new Boolean ( false ) } ; } if ( b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94 ) { return new Object [ ] { "CP037" , null } ; } return new Object [ ] { "UTF-8" , null , Boolean . FALSE } ; }
Returns the IANA encoding name that is auto - detected from the bytes specified with the endian - ness of that encoding where appropriate .
37,343
final boolean load ( int offset , boolean changeEntity ) throws IOException { int length = fCurrentEntity . mayReadChunks ? ( fCurrentEntity . ch . length - offset ) : ( DEFAULT_XMLDECL_BUFFER_SIZE ) ; int count = fCurrentEntity . reader . read ( fCurrentEntity . ch , offset , length ) ; boolean entityChanged = false ; if ( count != - 1 ) { if ( count != 0 ) { fCurrentEntity . count = count + offset ; fCurrentEntity . position = offset ; } } else { fCurrentEntity . count = offset ; fCurrentEntity . position = offset ; entityChanged = true ; if ( changeEntity ) { endEntity ( ) ; if ( fCurrentEntity == null ) { throw new EOFException ( ) ; } if ( fCurrentEntity . position == fCurrentEntity . count ) { load ( 0 , false ) ; } } } return entityChanged ; }
Loads a chunk of text .
37,344
public String scanPseudoAttribute ( boolean scanningTextDecl , XMLString value ) throws IOException , JspCoreException { String name = scanName ( ) ; if ( name == null ) { throw new JspCoreException ( "jsp.error.xml.pseudoAttrNameExpected" ) ; } skipSpaces ( ) ; if ( ! skipChar ( '=' ) ) { reportFatalError ( scanningTextDecl ? "jsp.error.xml.eqRequiredInTextDecl" : "jsp.error.xml.eqRequiredInXMLDecl" , name ) ; } skipSpaces ( ) ; int quote = peekChar ( ) ; if ( quote != '\'' && quote != '"' ) { reportFatalError ( scanningTextDecl ? "jsp.error.xml.quoteRequiredInTextDecl" : "jsp.error.xml.quoteRequiredInXMLDecl" , name ) ; } scanChar ( ) ; int c = scanLiteral ( quote , value ) ; if ( c != quote ) { fStringBuffer2 . clear ( ) ; do { fStringBuffer2 . append ( value ) ; if ( c != - 1 ) { if ( c == '&' || c == '%' || c == '<' || c == ']' ) { fStringBuffer2 . append ( ( char ) scanChar ( ) ) ; } else if ( XMLChar . isHighSurrogate ( c ) ) { scanSurrogates ( fStringBuffer2 ) ; } else if ( XMLChar . isInvalid ( c ) ) { String key = scanningTextDecl ? "jsp.error.xml.invalidCharInTextDecl" : "jsp.error.xml.invalidCharInXMLDecl" ; reportFatalError ( key , Integer . toString ( c , 16 ) ) ; scanChar ( ) ; } } c = scanLiteral ( quote , value ) ; } while ( c != quote ) ; fStringBuffer2 . append ( value ) ; value . setValues ( fStringBuffer2 ) ; } if ( ! skipChar ( quote ) ) { reportFatalError ( scanningTextDecl ? "jsp.error.xml.closeQuoteMissingInTextDecl" : "jsp.error.xml.closeQuoteMissingInXMLDecl" , name ) ; } return name ; }
Scans a pseudo attribute .
37,345
private void reportFatalError ( String msgId , String arg ) throws JspCoreException { throw new JspCoreException ( msgId , new Object [ ] { arg } ) ; }
Convenience function used in all XML scanners .
37,346
@ SuppressWarnings ( "unchecked" ) public static < T > T coerceToType ( FacesContext facesContext , Object value , Class < ? extends T > desiredClass ) { if ( value == null ) { return null ; } try { ExpressionFactory expFactory = facesContext . getApplication ( ) . getExpressionFactory ( ) ; return ( T ) expFactory . coerceToType ( value , desiredClass ) ; } catch ( ELException e ) { String message = "Cannot coerce " + value . getClass ( ) . getName ( ) + " to " + desiredClass . getName ( ) ; log . log ( Level . SEVERE , message , e ) ; throw new FacesException ( message , e ) ; } }
to unified EL in JSF 1 . 2
37,347
private String getNarrowestScope ( FacesContext facesContext , String valueExpression ) { List < String > expressions = extractExpressions ( valueExpression ) ; String narrowestScope = expressions . size ( ) == 1 ? NONE : APPLICATION ; boolean scopeFound = false ; for ( String expression : expressions ) { String valueScope = getScope ( facesContext , expression ) ; if ( valueScope == null ) { continue ; } scopeFound = true ; if ( SCOPE_COMPARATOR . compare ( valueScope , narrowestScope ) < 0 ) { narrowestScope = valueScope ; } } return scopeFound ? narrowestScope : null ; }
Gets the narrowest scope to which the ValueExpression points .
37,348
private String getFirstSegment ( String expression ) { int indexDot = expression . indexOf ( '.' ) ; int indexBracket = expression . indexOf ( '[' ) ; if ( indexBracket < 0 ) { return indexDot < 0 ? expression : expression . substring ( 0 , indexDot ) ; } if ( indexDot < 0 ) { return expression . substring ( 0 , indexBracket ) ; } return expression . substring ( 0 , Math . min ( indexDot , indexBracket ) ) ; }
Extract the first expression segment that is the substring up to the first . or [
37,349
@ SuppressWarnings ( "unchecked" ) public < T > T get ( EventLocal < T > key ) { EventLocalMap < EventLocal < ? > , Object > map = getMap ( key ) ; if ( null == map ) { return key . initialValue ( ) ; } return ( T ) map . get ( key ) ; }
Query the possible value for the provided EventLocal .
37,350
public < T > void set ( EventLocal < T > key , Object value ) { EventLocalMap < EventLocal < ? > , Object > map = getMap ( key ) ; if ( null == map ) { map = new EventLocalMap < EventLocal < ? > , Object > ( ) ; if ( key . isInheritable ( ) ) { this . inheritableLocals = map ; } else { this . locals = map ; } } map . put ( key , value ) ; }
Set the value for the provided EventLocal on this event .
37,351
@ SuppressWarnings ( "unchecked" ) public < T > T remove ( EventLocal < T > key ) { EventLocalMap < EventLocal < ? > , Object > map = getMap ( key ) ; if ( null != map ) { return ( T ) map . remove ( key ) ; } return null ; }
Remove any existing value for the provided EventLocal .
37,352
@ SuppressWarnings ( "unchecked" ) public < T > T getContextData ( String name ) { T rc = null ; if ( null != this . inheritableLocals ) { rc = ( T ) this . inheritableLocals . get ( name ) ; } if ( null == rc && null != this . locals ) { rc = ( T ) this . locals . get ( name ) ; } return rc ; }
Look for the EventLocal of the given name in this particular Event instance .
37,353
private static void setSystemProperties ( ) { String loggingManager = System . getProperty ( "java.util.logging.manager" ) ; String managementBuilderInitial = System . getProperty ( "javax.management.builder.initial" ) ; if ( managementBuilderInitial == null ) System . setProperty ( "javax.management.builder.initial" , "com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServerBuilder" ) ; }
Set system properties for JVM singletons .
37,354
final void setBodyType ( JmsBodyType value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setBodyType" , value ) ; setSubtype ( value . toByte ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setBodyType" ) ; }
Set the type of the message body . This method is only used by message constructors .
37,355
private final Set < String > getNonSmokeAndMirrorsPropertyNameSet ( ) { Set < String > names = new HashSet < String > ( ) ; if ( mayHaveJmsUserProperties ( ) ) { names . addAll ( getJmsUserPropertyMap ( ) . keySet ( ) ) ; } if ( mayHaveMappedJmsSystemProperties ( ) ) { names . addAll ( getJmsSystemPropertyMap ( ) . keySet ( ) ) ; } if ( hasMQMDPropertiesSet ( ) ) { names . addAll ( getMQMDSetPropertiesMap ( ) . keySet ( ) ) ; } return names ; }
Return a Set of just the non - smoke - and - mirrors property names
37,356
public Object getJMSXGroupSeq ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getJMSXGroupSeq" ) ; Object result = null ; if ( mayHaveMappedJmsSystemProperties ( ) ) { result = getObjectProperty ( SIProperties . JMSXGroupSeq ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getJMSXGroupSeq" , result ) ; return result ; }
getJMSXGroupSeq Return the value of the JMSXGroupSeq property if it exists . We can return it as object as that is all JMS API wants . Actually it only really cares whether it exists but we ll return Object rather than changing the callng code unnecessarily .
37,357
private void processSpecialSubjects ( ConfigurationAdmin configAdmin , String roleName , Dictionary < String , Object > roleProps , Set < String > pids ) { String [ ] specialSubjectPids = ( String [ ] ) roleProps . get ( CFG_KEY_SPECIAL_SUBJECT ) ; if ( specialSubjectPids == null || specialSubjectPids . length == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "No special subjects in role " + roleName ) ; } } else { Set < String > badSpecialSubjects = new HashSet < String > ( ) ; for ( int i = 0 ; i < specialSubjectPids . length ; i ++ ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "special subject pid " + i + ": " + specialSubjectPids [ i ] ) ; } pids . add ( specialSubjectPids [ i ] ) ; Configuration specialSubjectConfig = null ; try { specialSubjectConfig = configAdmin . getConfiguration ( specialSubjectPids [ i ] , bundleLocation ) ; } catch ( IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Invalid special subject entry " + specialSubjectPids [ i ] ) ; } continue ; } if ( specialSubjectConfig == null || specialSubjectConfig . getProperties ( ) == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Null special subject element" , specialSubjectPids [ i ] ) ; } continue ; } Dictionary < String , Object > specialSubjectProps = specialSubjectConfig . getProperties ( ) ; final String type = ( String ) specialSubjectProps . get ( "type" ) ; if ( type == null || type . trim ( ) . isEmpty ( ) ) { continue ; } if ( badSpecialSubjects . contains ( type ) ) { continue ; } if ( type . trim ( ) . isEmpty ( ) ) { continue ; } if ( ! specialSubjects . add ( type ) ) { Tr . error ( tc , "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER" , getRoleName ( ) , CFG_KEY_SPECIAL_SUBJECT , type ) ; badSpecialSubjects . add ( type ) ; specialSubjects . remove ( type ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Role " + roleName + " has special subjects:" , specialSubjects ) ; } } }
Read and process all the specialSubject elements
37,358
public TxCollaboratorConfig preInvoke ( final HttpServletRequest request , final boolean isServlet23 ) throws ServletException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Calling preInvoke. Request=" + request + " | isServlet23=" + isServlet23 ) ; } try { final EmbeddableWebSphereTransactionManager tranManager = getTranMgr ( ) ; if ( tranManager != null ) { final Transaction incumbentTx = tranManager . getTransaction ( ) ; if ( incumbentTx != null ) { TransactionImpl incumbentTxImpl = null ; if ( incumbentTx instanceof TransactionImpl ) incumbentTxImpl = ( TransactionImpl ) incumbentTx ; if ( incumbentTxImpl != null && incumbentTxImpl . getTxType ( ) == UOWCoordinator . TXTYPE_NONINTEROP_GLOBAL ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "the tx is NONINTEROP_GLOBAL set it to null" ) ; } tranManager . suspend ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Global transaction was present." ) ; } checkGlobalTimeout ( ) ; final TxCollaboratorConfig retConfig = new TxCollaboratorConfig ( ) ; retConfig . setIncumbentTx ( incumbentTx ) ; return retConfig ; } } } } catch ( SystemException e ) { Tr . error ( tc , "UNEXPECTED_TRAN_ERROR" , e . toString ( ) ) ; ServletException se = new ServletException ( "Unexpected error during transaction fetching: " , e ) ; throw se ; } LocalTransactionCurrent ltCurrent = getLtCurrent ( ) ; if ( ltCurrent == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Unable to resolve LocalTransactionCurrent" ) ; } return null ; } TxCollaboratorConfig retConfig = new TxCollaboratorConfig ( ) ; LocalTransactionCoordinator ltCoord = ltCurrent . getLocalTranCoord ( ) ; if ( ltCoord != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Suspending LTC's coord: " + ltCoord ) ; } retConfig . setSuspendTx ( ltCurrent . suspend ( ) ) ; } ltCurrent . begin ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Began LTC's coord:" + ltCurrent . getLocalTranCoord ( ) ) ; } return retConfig ; }
Collaborator preInvoke .
37,359
private void resumeSuspendedLTC ( LocalTransactionCurrent ltCurrent , Object txConfig ) throws ServletException { if ( txConfig instanceof TxCollaboratorConfig ) { Object suspended = ( ( TxCollaboratorConfig ) txConfig ) . getSuspendTx ( ) ; if ( suspended instanceof LocalTransactionCoordinator ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Resuming previously suspended LTC coord:" + suspended ) ; Tr . debug ( tc , "Registering LTC callback" ) ; } try { ltCurrent . resume ( ( ( LocalTransactionCoordinator ) suspended ) ) ; } catch ( IllegalStateException ex ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "IllegalStateException" , ex ) ; } try { ltCurrent . cleanup ( ) ; } catch ( InconsistentLocalTranException iltex ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "InconsistentLocalTranException" , iltex ) ; } } catch ( RolledbackException rbe ) { ServletException se = new ServletException ( "LocalTransaction rolled-back due to setRollbackOnly" , rbe ) ; throw se ; } } } } }
Resumes the LTC that was suspended during preInvoke if one was suspended .
37,360
public SerializationObject getSerializationObject ( ) { SerializationObject object ; synchronized ( ivListOfObjects ) { if ( ivListOfObjects . isEmpty ( ) ) { object = createNewObject ( ) ; } else { object = ivListOfObjects . remove ( ivListOfObjects . size ( ) - 1 ) ; } } return object ; }
Gets the next avaialable serialization object .
37,361
public void returnSerializationObject ( SerializationObject object ) { synchronized ( ivListOfObjects ) { if ( ivListOfObjects . size ( ) < MAXIMUM_NUM_OF_OBJECTS ) { ivListOfObjects . add ( object ) ; } } }
Returns a serialization object back into the pool .
37,362
public void add ( Object dependency , ValueSet valueSet ) { if ( dependency == null ) { throw new IllegalArgumentException ( "dependency cannot be null" ) ; } if ( valueSet != null ) { dependencyToEntryTable . put ( dependency , valueSet ) ; } }
This adds a valueSet for the specified dependency .
37,363
public boolean removeEntry ( Object dependency , Object entry ) { boolean found = false ; ValueSet valueSet = ( ValueSet ) dependencyToEntryTable . get ( dependency ) ; if ( valueSet == null ) { return found ; } found = valueSet . remove ( entry ) ; if ( valueSet . size ( ) == 0 ) removeDependency ( dependency ) ; return found ; }
SKS - O
37,364
protected void modified ( String id , Map < String , Object > properties ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "modified " + id , properties ) ; } config = properties ; myProps = null ; }
DS method to modify this component .
37,365
protected ReadableLogRecord getReadableLogRecord ( long expectedSequenceNumber ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getReadableLogRecord" , new java . lang . Object [ ] { this , new Long ( expectedSequenceNumber ) } ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Creating readable log record to read from file " + _fileName ) ; final ReadableLogRecord readableLogRecord = ReadableLogRecord . read ( _fileBuffer , expectedSequenceNumber , ! _logFileHeader . wasShutdownClean ( ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getReadableLogRecord" , readableLogRecord ) ; return readableLogRecord ; }
Read a composite record from the disk . The caller supplies the expected sequence number of the record and this method confirms that this matches the next record recovered .
37,366
void fileClose ( ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "fileClose" , this ) ; if ( _fileChannel != null ) { try { if ( _outstandingWritableLogRecords . get ( ) == 0 && ! _exceptionInForce ) { force ( ) ; _logFileHeader . setCleanShutdown ( ) ; writeFileHeader ( false ) ; force ( ) ; } _file . close ( ) ; } catch ( Throwable e ) { FFDCFilter . processException ( e , "com.ibm.ws.recoverylog.spi.LogFileHandle.fileClose" , "541" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "fileClose" , "InternalLogException" ) ; throw new InternalLogException ( e ) ; } _fileBuffer = null ; _file = null ; _fileChannel = null ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "fileClose" ) ; }
Close the file managed by this LogFileHandle instance .
37,367
public WriteableLogRecord getWriteableLogRecord ( int recordLength , long sequenceNumber ) throws InternalLogException { if ( ! _headerFlushedFollowingRestart ) { writeFileHeader ( true ) ; _headerFlushedFollowingRestart = true ; } if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getWriteableLogRecord" , new Object [ ] { new Integer ( recordLength ) , new Long ( sequenceNumber ) , this } ) ; ByteBuffer viewBuffer = ( ByteBuffer ) _fileBuffer . slice ( ) . limit ( recordLength + WriteableLogRecord . HEADER_SIZE ) ; WriteableLogRecord writeableLogRecord = new WriteableLogRecord ( viewBuffer , sequenceNumber , recordLength , _fileBuffer . position ( ) ) ; _fileBuffer . position ( _fileBuffer . position ( ) + recordLength + WriteableLogRecord . HEADER_SIZE ) ; _outstandingWritableLogRecords . incrementAndGet ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getWriteableLogRecord" , writeableLogRecord ) ; return writeableLogRecord ; }
Get a new WritableLogRecord for the log file managed by this LogFileHandleInstance . The size of the record must be specified along with the record s sequence number . It is the caller s responsbility to ensure that both the sequence number is correct and that the record written using the returned WritableLogRecord is of the given length .
37,368
private void writeFileHeader ( boolean maintainPosition ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "writeFileHeader" , new java . lang . Object [ ] { this , new Boolean ( maintainPosition ) } ) ; try { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing header for log file " + _fileName ) ; _logFileHeader . write ( _fileBuffer , maintainPosition ) ; force ( ) ; } catch ( InternalLogException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader" , "706" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeFileHeader" , exc ) ; throw exc ; } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileHeader" , "712" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeFileHeader" , "InternalLogException" ) ; throw new InternalLogException ( exc ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeFileHeader" ) ; }
Writes the file header stored in _logFileHeader to the file managed by this LogFileHandle instance .
37,369
private void writeFileStatus ( boolean maintainPosition ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "writeFileStatus" , new java . lang . Object [ ] { this , new Boolean ( maintainPosition ) } ) ; if ( _logFileHeader . status ( ) == LogFileHeader . STATUS_INVALID ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeFileStatus" , "InternalLogException" ) ; throw new InternalLogException ( null ) ; } try { int currentFilePointer = 0 ; if ( maintainPosition ) { currentFilePointer = _fileBuffer . position ( ) ; } _fileBuffer . position ( STATUS_FIELD_FILE_OFFSET ) ; _fileBuffer . putInt ( _logFileHeader . status ( ) ) ; force ( ) ; if ( maintainPosition ) { _fileBuffer . position ( currentFilePointer ) ; } } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileStatus" , "797" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeFileStatus" , "WriteOperationFailedException" ) ; throw new WriteOperationFailedException ( exc ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeFileStatus" ) ; }
Updates the status field of the file managed by this LogFileHandle instance . The status field is stored in _logFileHeader .
37,370
protected LogFileHeader logFileHeader ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "logFileHeader" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "logFileHeader" , _logFileHeader ) ; return _logFileHeader ; }
Accessor for the log file header object assoicated with this LogFileHandle instance .
37,371
public byte [ ] getServiceData ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getServiceData" , this ) ; byte [ ] serviceData = null ; if ( _logFileHeader != null ) { serviceData = _logFileHeader . getServiceData ( ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getServiceData" , RLSUtils . toHexString ( serviceData , RLSUtils . MAX_DISPLAY_BYTES ) ) ; return serviceData ; }
Accessor for the service data assoicated with this LogFileHandle instance .
37,372
public int freeBytes ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "freeBytes" , this ) ; int freeBytes = 0 ; try { int currentCursorPosition = _fileBuffer . position ( ) ; int fileLength = _fileBuffer . capacity ( ) ; freeBytes = fileLength - currentCursorPosition ; if ( freeBytes < 0 ) { freeBytes = 0 ; } } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.freeBytes" , "956" , this ) ; freeBytes = 0 ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "freeBytes" , new Integer ( freeBytes ) ) ; return freeBytes ; }
Returns the number of free bytes remaining in the file associated with this LogFileHandle instance .
37,373
public String fileName ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "fileName" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "fileName" , _fileName ) ; return _fileName ; }
Returns the name of the file associated with this LogFileHandle instance
37,374
void keypointStarting ( long nextRecordSequenceNumber ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "keypointStarting" , new Object [ ] { new Long ( nextRecordSequenceNumber ) , this } ) ; _logFileHeader . keypointStarting ( nextRecordSequenceNumber ) ; try { writeFileHeader ( false ) ; } catch ( InternalLogException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting" , "1073" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointStarting" , exc ) ; throw exc ; } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointStarting" , "1079" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointStarting" , "InternalLogException" ) ; throw new InternalLogException ( exc ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointStarting" ) ; }
Informs the LogFileHandle instance that a keypoint operation is about begin into the file associated with this LogFileHandle instance . The status of the log file is updated to KEYPOINTING and written to disk .
37,375
void keypointComplete ( ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "keypointComplete" , this ) ; _logFileHeader . keypointComplete ( ) ; try { writeFileStatus ( true ) ; } catch ( InternalLogException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete" , "1117" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointComplete" , exc ) ; throw exc ; } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.keypointComplete" , "1123" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointComplete" , "InternalLogException" ) ; throw new InternalLogException ( exc ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointComplete" ) ; }
Informs the LogFileHandle instance that a keypoint operation into the file has completed . The status of the log file is updated to ACTIVE and written to disk .
37,376
void becomeInactive ( ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "becomeInactive" , this ) ; _logFileHeader . changeStatus ( LogFileHeader . STATUS_INACTIVE ) ; try { writeFileStatus ( false ) ; } catch ( InternalLogException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive" , "1161" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "becomeInactive" , exc ) ; throw exc ; } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.becomeInactive" , "1167" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "becomeInactive" , "InternalLogException" ) ; throw new InternalLogException ( exc ) ; } if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "becomeInactive" , this ) ; }
This method is invoked to inform the LogFileHandle instance that the file it manages is no longer required by the recovery log serivce . The status field stored in the header is updated to INACTIVE .
37,377
public void fileExtend ( int newFileSize ) throws LogAllocationException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "fileExtend" , new Object [ ] { new Integer ( newFileSize ) , this } ) ; final int fileLength = _fileBuffer . capacity ( ) ; if ( fileLength < newFileSize ) { try { int originalPosition = _fileBuffer . position ( ) ; Tr . event ( tc , "Expanding log file to size of " + newFileSize + " bytes." ) ; if ( _isMapped ) { _fileBuffer = _fileChannel . map ( FileChannel . MapMode . READ_WRITE , 0 , newFileSize ) ; } else { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "File is NOT mapped. Allocating new DirectByteBuffer" ) ; _fileBuffer . position ( 0 ) ; final ByteBuffer newByteBuffer = ByteBuffer . allocateDirect ( newFileSize ) ; newByteBuffer . put ( _fileBuffer ) ; newByteBuffer . position ( 0 ) ; _fileChannel . write ( newByteBuffer , 0 ) ; _fileBuffer = newByteBuffer ; } _fileBuffer . position ( originalPosition ) ; _fileSize = newFileSize ; } catch ( Exception exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.fileExtend" , "1266" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . event ( tc , "Unable to extend file " + _fileName + " to " + newFileSize + " bytes" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "fileExtend" , "LogAllocationException" ) ; throw new LogAllocationException ( exc ) ; } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "fileExtend" ) ; }
Extend the physical log file . If newFileSize is larger than the current file size the log file will extended so that it is newFileSize kilobytes long . If newFileSize is equal to or less than the current file size the current log file will be unchanged .
37,378
protected void force ( ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "force" , this ) ; try { if ( _isMapped ) { ( ( MappedByteBuffer ) _fileBuffer ) . force ( ) ; } else { writePendingToFile ( ) ; _fileChannel . force ( false ) ; } } catch ( java . io . IOException ioe ) { FFDCFilter . processException ( ioe , "com.ibm.ws.recoverylog.spi.LogFileHandle.force" , "1049" , this ) ; _exceptionInForce = true ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Unable to force file " + _fileName ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "force" , "InternalLogException" ) ; throw new InternalLogException ( ioe ) ; } catch ( InternalLogException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.force" , "1056" , this ) ; _exceptionInForce = true ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Unable to force file " + _fileName ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "force" , "InternalLogException" ) ; throw exc ; } catch ( LogIncompatibleException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogFileHandle.force" , "1096" , this ) ; _exceptionInForce = true ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Unable to force file " + _fileName ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "force" , "InternalLogException" ) ; throw new InternalLogException ( exc ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "force" ) ; }
Forces the contents of the memory - mapped view of the log file to disk . Having invoked this method the caller can be certain that any data added to the log as part of a prior log write is now stored persistently on disk .
37,379
private String normalize ( String alias ) { String regExp = alias . replaceAll ( "[\\.]" , "\\\\\\." ) ; regExp = regExp . replaceAll ( "[*]" , "\\.\\*" ) ; return regExp ; }
This method normalizes the alias into a valid regular expression
37,380
public Iterator targetMappings ( ) { Collection vHosts = vHostTable . values ( ) ; List l = new ArrayList ( ) ; l . addAll ( vHosts ) ; return l . listIterator ( ) ; }
Returns an enumeration of all the target mappings added to this mapper
37,381
public final BehindRef insert ( final AbstractItemLink insertAil ) { final long insertPosition = insertAil . getPosition ( ) ; boolean inserted = false ; BehindRef addref = null ; BehindRef lookat = _lastLinkBehind ; while ( ! inserted && ( lookat != null ) ) { AbstractItemLink lookatAil = lookat . getAIL ( ) ; if ( lookatAil != null ) { long lookatPosition = lookatAil . getPosition ( ) ; if ( insertPosition > lookatPosition ) { addref = new BehindRef ( insertAil ) ; if ( lookat . _next == null ) { _lastLinkBehind = addref ; } else { addref . _next = lookat . _next ; lookat . _next . _prev = addref ; } addref . _prev = lookat ; lookat . _next = addref ; inserted = true ; } else if ( insertPosition == lookatPosition ) { addref = lookat ; inserted = true ; } else { lookat = lookat . _prev ; } } else { BehindRef newlookat = lookat . _prev ; _remove ( lookat ) ; lookat = newlookat ; } } if ( ! inserted ) { addref = new BehindRef ( insertAil ) ; if ( _firstLinkBehind != null ) { addref . _next = _firstLinkBehind ; _firstLinkBehind . _prev = addref ; _firstLinkBehind = addref ; } else { _firstLinkBehind = addref ; _lastLinkBehind = addref ; } } return addref ; }
Inserts a reference to an AIL in the list of AILs behind the curent position of the cursor . The insertion is performed in position order . The list is composed of weak references and any which are discovered to refer to objects no longer on the heap are removed as we go .
37,382
private final void _remove ( final BehindRef removeref ) { if ( _firstLinkBehind != null ) { if ( removeref == _firstLinkBehind ) { if ( removeref == _lastLinkBehind ) { _firstLinkBehind = null ; _lastLinkBehind = null ; } else { BehindRef nextref = removeref . _next ; removeref . _next = null ; nextref . _prev = null ; _firstLinkBehind = nextref ; } } else if ( removeref == _lastLinkBehind ) { BehindRef prevref = removeref . _prev ; removeref . _prev = null ; prevref . _next = null ; _lastLinkBehind = prevref ; } else { BehindRef prevref = removeref . _prev ; BehindRef nextref = removeref . _next ; removeref . _next = null ; removeref . _prev = null ; prevref . _next = nextref ; nextref . _prev = prevref ; } } }
Removes the first AIL in the list of AILs behind the current position of the cursor . The list may empty completely as a result .
37,383
protected boolean invokeTraceRouters ( RoutedMessage routedTrace ) { boolean retMe = true ; LogRecord logRecord = routedTrace . getLogRecord ( ) ; try { if ( ! ( counterForTraceRouter . incrementCount ( ) > 2 ) ) { if ( logRecord != null ) { Level level = logRecord . getLevel ( ) ; int levelValue = level . intValue ( ) ; if ( levelValue < Level . INFO . intValue ( ) ) { String levelName = level . getName ( ) ; if ( ! ( levelName . equals ( "SystemOut" ) || levelName . equals ( "SystemErr" ) ) ) { WsTraceRouter internalTrRouter = internalTraceRouter . get ( ) ; if ( internalTrRouter != null ) { retMe &= internalTrRouter . route ( routedTrace ) ; } else if ( earlierTraces != null ) { synchronized ( this ) { if ( earlierTraces != null ) { earlierTraces . add ( routedTrace ) ; } } } } } } } } finally { counterForTraceRouter . decrementCount ( ) ; } return retMe ; }
Route only trace log records . Messages including Systemout err will not be routed to trace source to avoid duplicate entries
37,384
protected void publishTraceLogRecord ( TraceWriter detailLog , LogRecord logRecord , Object id , String formattedMsg , String formattedVerboseMsg ) { if ( formattedVerboseMsg == null ) { formattedVerboseMsg = formatter . formatVerboseMessage ( logRecord , formattedMsg , false ) ; } RoutedMessage routedTrace = new RoutedMessageImpl ( formattedMsg , formattedVerboseMsg , null , logRecord ) ; invokeTraceRouters ( routedTrace ) ; try { if ( ! ( counterForTraceSource . incrementCount ( ) > 2 ) ) { if ( logRecord != null ) { Level level = logRecord . getLevel ( ) ; int levelValue = level . intValue ( ) ; if ( levelValue < Level . INFO . intValue ( ) ) { String levelName = level . getName ( ) ; if ( ! ( levelName . equals ( "SystemOut" ) || levelName . equals ( "SystemErr" ) ) ) { if ( traceSource != null ) { traceSource . publish ( routedTrace , id ) ; } } } } } } finally { counterForTraceSource . decrementCount ( ) ; } try { if ( ! ( counterForTraceWriter . incrementCount ( ) > 1 ) ) { if ( detailLog != systemOut ) { String traceDetail = formatter . traceLogFormat ( logRecord , id , formattedMsg , formattedVerboseMsg ) ; detailLog . writeRecord ( traceDetail ) ; } } } finally { counterForTraceWriter . decrementCount ( ) ; } }
Publish a trace log record .
37,385
public void setMessageRouter ( MessageRouter msgRouter ) { externalMessageRouter . set ( msgRouter ) ; if ( msgRouter instanceof WsMessageRouter ) { setWsMessageRouter ( ( WsMessageRouter ) msgRouter ) ; } }
Inject the SPI MessageRouter .
37,386
public void unsetMessageRouter ( MessageRouter msgRouter ) { externalMessageRouter . compareAndSet ( msgRouter , null ) ; if ( msgRouter instanceof WsMessageRouter ) { unsetWsMessageRouter ( ( WsMessageRouter ) msgRouter ) ; } }
Un - inject .
37,387
protected void initializeWriters ( LogProviderConfigImpl config ) { messagesLog = FileLogHolder . createFileLogHolder ( messagesLog , newFileLogHeader ( false , config ) , config . getLogDirectory ( ) , config . getMessageFileName ( ) , config . getMaxFiles ( ) , config . getMaxFileBytes ( ) , config . getNewLogsOnStart ( ) ) ; TraceWriter oldWriter = traceLog ; String fileName = config . getTraceFileName ( ) ; if ( fileName . equals ( "stdout" ) ) { traceLog = systemOut ; LoggingFileUtils . tryToClose ( oldWriter ) ; } else { traceLog = FileLogHolder . createFileLogHolder ( oldWriter == systemOut ? null : oldWriter , newFileLogHeader ( true , config ) , config . getLogDirectory ( ) , config . getTraceFileName ( ) , config . getMaxFiles ( ) , config . getMaxFileBytes ( ) , config . getNewLogsOnStart ( ) ) ; if ( ! TraceComponent . isAnyTracingEnabled ( ) ) { ( ( FileLogHolder ) traceLog ) . releaseFile ( ) ; } } }
Initialize the log holders for messages and trace . If the TrService is configured at bootstrap time to use JSR - 47 logging the traceLog will not be created here as the LogRecord should be routed to logger rather than being formatted for the trace file .
37,388
public Object load ( String batchId ) { Object loadedArtifact ; loadedArtifact = getArtifactById ( batchId ) ; if ( loadedArtifact != null ) { if ( logger . isLoggable ( Level . FINEST ) ) { logger . finest ( "load: batchId: " + batchId + ", artifact: " + loadedArtifact + ", artifact class: " + loadedArtifact . getClass ( ) . getCanonicalName ( ) ) ; } } return loadedArtifact ; }
Use CDI to load the artifact with the given ID .
37,389
protected Bean < ? > getUniqueBeanByBeanName ( BeanManager bm , String batchId ) { Bean < ? > match = null ; Set < Bean < ? > > beans = bm . getBeans ( batchId ) ; try { match = bm . resolve ( beans ) ; } catch ( AmbiguousResolutionException e ) { return null ; } return match ; }
Use the given BeanManager to lookup a unique CDI - registered bean with bean name equal to batchId using EL matching rules .
37,390
@ FFDCIgnore ( BatchCDIAmbiguousResolutionCheckedException . class ) protected Bean < ? > getUniqueBeanForBatchXMLEntry ( BeanManager bm , String batchId ) { ClassLoader loader = getContextClassLoader ( ) ; BatchXMLMapper batchXMLMapper = new BatchXMLMapper ( loader ) ; Class < ? > clazz = batchXMLMapper . getArtifactById ( batchId ) ; if ( clazz != null ) { try { return findUniqueBeanForClass ( bm , clazz ) ; } catch ( BatchCDIAmbiguousResolutionCheckedException e ) { if ( logger . isLoggable ( Level . FINER ) ) { logger . finer ( "getBeanForBatchXML: BatchCDIAmbiguousResolutionCheckedException: " + e . getMessage ( ) ) ; } return null ; } } else { return null ; } }
Use the given BeanManager to lookup a unique CDI - registered bean with bean class equal to the batch . xml entry mapped to be the batchId parameter
37,391
@ FFDCIgnore ( { ClassNotFoundException . class , BatchCDIAmbiguousResolutionCheckedException . class } ) protected Bean < ? > getUniqueBeanForClassName ( BeanManager bm , String className ) { try { Class < ? > clazz = getContextClassLoader ( ) . loadClass ( className ) ; return findUniqueBeanForClass ( bm , clazz ) ; } catch ( BatchCDIAmbiguousResolutionCheckedException e ) { if ( logger . isLoggable ( Level . FINER ) ) { logger . finer ( "getBeanForClassName: BatchCDIAmbiguousResolutionCheckedException: " + e . getMessage ( ) ) ; } return null ; } catch ( ClassNotFoundException cnfe ) { if ( logger . isLoggable ( Level . FINER ) ) { logger . finer ( "getBeanForClassName: ClassNotFoundException for " + className + ": " + cnfe ) ; } return null ; } }
Use the given BeanManager to lookup the set of CDI - registered beans with the given class name .
37,392
private synchronized void createExecutor ( ) { if ( componentConfig == null ) { return ; } if ( threadPoolController != null ) threadPoolController . deactivate ( ) ; ThreadPoolExecutor oldPool = threadPool ; poolName = ( String ) componentConfig . get ( "name" ) ; String threadGroupName = poolName + " Thread Group" ; int coreThreads = Integer . parseInt ( String . valueOf ( componentConfig . get ( "coreThreads" ) ) ) ; int maxThreads = Integer . parseInt ( String . valueOf ( componentConfig . get ( "maxThreads" ) ) ) ; if ( maxThreads <= 0 ) { maxThreads = Integer . MAX_VALUE ; } if ( coreThreads < 0 ) { coreThreads = 2 * CpuInfo . getAvailableProcessors ( ) ; } coreThreads = Math . max ( MINIMUM_POOL_SIZE , Math . min ( coreThreads , maxThreads ) ) ; maxThreads = Math . max ( coreThreads , maxThreads ) ; BlockingQueue < Runnable > workQueue = new BoundedBuffer < Runnable > ( java . lang . Runnable . class , 1000 , 1000 ) ; RejectedExecutionHandler rejectedExecutionHandler = new ExpandPolicy ( workQueue , this ) ; threadPool = new ThreadPoolExecutor ( coreThreads , maxThreads , 0 , TimeUnit . MILLISECONDS , workQueue , threadFactory != null ? threadFactory : new ThreadFactoryImpl ( poolName , threadGroupName ) , rejectedExecutionHandler ) ; threadPoolController = new ThreadPoolController ( this , threadPool ) ; if ( oldPool != null ) { softShutdown ( oldPool ) ; } }
Create a thread pool executor with the configured attributes from this component config .
37,393
private < T > Collection < ? extends Callable < T > > wrap ( Collection < ? extends Callable < T > > tasks ) { List < Callable < T > > wrappedTasks = new ArrayList < Callable < T > > ( ) ; Iterator < ? extends Callable < T > > i = tasks . iterator ( ) ; while ( i . hasNext ( ) ) { Callable < T > c = wrap ( i . next ( ) ) ; if ( serverStopping ) wrappedTasks . add ( c ) ; else wrappedTasks . add ( new CallableWrapper < T > ( c ) ) ; } return wrappedTasks ; }
This is private so handling both interceptors and wrapping in this method for simplicity
37,394
public JsMessage next ( ) throws MessageDecodeFailedException , SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SIErrorException , SINotAuthorizedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "next" ) ; JsMessage retMsg = null ; retMsg = queue . get ( proxyQueueId ) ; if ( retMsg == null ) { convHelper . flushConsumer ( ) ; retMsg = queue . get ( proxyQueueId ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "next" , retMsg ) ; return retMsg ; }
Returns the next message for a browse .
37,395
public void close ( ) throws SIResourceException , SIConnectionLostException , SIErrorException , SIConnectionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "close" ) ; if ( ! closed ) { convHelper . closeSession ( ) ; queue . purge ( proxyQueueId ) ; owningGroup . notifyClose ( this ) ; closed = true ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "close" ) ; }
Closes the proxy queue .
37,396
public void put ( CommsByteBuffer msgBuffer , short msgBatch , boolean lastInBatch , boolean chunk ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "put" , new Object [ ] { msgBuffer , msgBatch , lastInBatch , chunk } ) ; QueueData queueData = null ; if ( chunk ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Dealing with a chunked message" ) ; byte flags = msgBuffer . get ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Flags:" , "" + flags ) ; if ( ( flags & CommsConstants . CHUNKED_MESSAGE_FIRST ) == CommsConstants . CHUNKED_MESSAGE_FIRST ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "First chunk received" ) ; queueData = new QueueData ( this , lastInBatch , chunk , msgBuffer ) ; queue . put ( queueData , msgBatch ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Middle / Last chunk received" ) ; boolean lastChunk = ( ( flags & CommsConstants . CHUNKED_MESSAGE_LAST ) == CommsConstants . CHUNKED_MESSAGE_LAST ) ; queue . appendToLastMessage ( msgBuffer , lastChunk ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Dealing with the entire message" ) ; queueData = new QueueData ( this , lastInBatch , chunk , msgBuffer ) ; queue . put ( queueData , msgBatch ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "put" ) ; }
Places a browse message on the queue .
37,397
public void setBrowserSession ( BrowserSessionProxy browserSession ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setBrowserSession" , browserSession ) ; if ( this . browserSession != null ) { SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "RESET_OF_BROWSER_SESSION_SICO1035" , null , null ) ) ; FFDCFilter . processException ( e , CLASS_NAME + ".setBrowserSession" , CommsConstants . BROWSERPQ_SETBROWSERSESS_01 , this ) ; throw e ; } if ( browserSession == null ) { SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "NULL_BROWSER_SESSION_SICO1036" , null , null ) ) ; FFDCFilter . processException ( e , CLASS_NAME + ".setBrowserSession" , CommsConstants . BROWSERPQ_SETBROWSERSESS_02 , this ) ; throw e ; } this . browserSession = browserSession ; convHelper . setSessionId ( browserSession . getProxyID ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setBrowserSession" ) ; }
Sets the browser session this proxy queue is being used in conjunction with .
37,398
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { GetField fields = in . readFields ( ) ; principal = ( String ) fields . get ( PRINCIPAL , null ) ; jwt = ( String ) fields . get ( JWT , null ) ; type = ( String ) fields . get ( TYPE , null ) ; handleClaims ( jwt ) ; }
Deserialize json web token .
37,399
private void writeObject ( ObjectOutputStream out ) throws IOException { PutField fields = out . putFields ( ) ; fields . put ( PRINCIPAL , principal ) ; fields . put ( JWT , jwt ) ; fields . put ( TYPE , type ) ; out . writeFields ( ) ; }
Serialize json web token .