idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
24,200
private boolean findInList ( String [ ] address , int index , FilterCellSlowStr cell , int endIndex ) { if ( cell . getWildcardCell ( ) != null ) { return true ; } FilterCellSlowStr nextCell = cell . findNextCell ( address [ index ] ) ; if ( nextCell != null ) { if ( index == endIndex ) { return true ; } return findInList ( address , index + 1 , nextCell , endIndex ) ; } return false ; }
Determine recursively if an address is in the address tree .
24,201
@ FFDCIgnore ( Exception . class ) private Object getObjectInstance ( Context c , Hashtable < ? , ? > envmt , String className , String bindingName , ResourceInfo resourceRefInfo , IndirectReference ref ) throws Exception { try { boolean hasJNDIScheme ; if ( bindingName . startsWith ( "java:" ) ) { Object instance = getJavaObjectInstance ( c , envmt , className , bindingName , resourceRefInfo , ref ) ; if ( instance != null ) { return instance ; } hasJNDIScheme = true ; } else { Object resource = createResource ( ref . name , className , bindingName , resourceRefInfo ) ; if ( resource == null && ! ref . defaultBinding ) { resource = createResource ( ref . name , null , bindingName , resourceRefInfo ) ; } if ( resource != null ) { return resource ; } hasJNDIScheme = JNDIHelper . hasJNDIScheme ( bindingName ) ; if ( ! hasJNDIScheme ) { Object service = getJNDIServiceObjectInstance ( className , bindingName , envmt ) ; if ( service != null ) { return service ; } } } if ( hasJNDIScheme ) { try { if ( c == null ) { c = new InitialContext ( envmt ) ; } return c . lookup ( bindingName ) ; } catch ( NoInitialContextException e ) { } catch ( NameNotFoundException e ) { } } } catch ( Exception e ) { String message = Tr . formatMessage ( tc , "INDIRECT_LOOKUP_FAILED_CWNEN1006E" , bindingName , className , e instanceof InjectionException ? e . getLocalizedMessage ( ) : e ) ; throw new InjectionException ( message , e ) ; } if ( ref . defaultBinding && javaCompDefaultEnabled ) { Object resource = createDefaultResource ( className , resourceRefInfo ) ; if ( resource != null ) { return resource ; } } String refName = InjectionScope . denormalize ( ref . name ) ; if ( ref . defaultBinding ) { throw new InjectionException ( Tr . formatMessage ( tc , "DEFAULT_BINDING_OBJECT_NOT_FOUND_CWNEN1004E" , bindingName , className , refName ) ) ; } if ( ref . bindingListenerName != null ) { throw new InjectionException ( Tr . formatMessage ( tc , "LISTENER_BINDING_OBJECT_NOT_FOUND_CWNEN1005E" , bindingName , className , refName , ref . bindingListenerName ) ) ; } throw new InjectionException ( Tr . formatMessage ( tc , "BINDING_OBJECT_NOT_FOUND_CWNEN1003E" , bindingName , className , refName ) ) ; }
Get an indirect object instance .
24,202
private Object createResource ( String refName , String className , String bindingName , ResourceInfo resourceRefInfo ) throws Exception { String nameFilter = FilterUtils . createPropertyFilter ( ResourceFactory . JNDI_NAME , bindingName ) ; String createsFilter = className == null ? null : FilterUtils . createPropertyFilter ( ResourceFactory . CREATES_OBJECT_CLASS , className ) ; String filter = createsFilter == null ? nameFilter : "(&" + nameFilter + createsFilter + ")" ; ResourceInfo resInfo = resourceRefInfo != null ? resourceRefInfo : className != null ? new ResourceEnvRefInfo ( refName , className ) : null ; return createResourceWithFilter ( filter , resInfo ) ; }
Try to obtain an object instance by creating a resource using a ResourceFactory .
24,203
private Object createDefaultResource ( String className , ResourceInfo resourceRefInfo ) throws Exception { if ( className != null ) { String javaCompDefaultFilter = "(" + com . ibm . ws . resource . ResourceFactory . JAVA_COMP_DEFAULT_NAME + "=*)" ; String createsFilter = FilterUtils . createPropertyFilter ( ResourceFactory . CREATES_OBJECT_CLASS , className ) ; String filter = "(&" + javaCompDefaultFilter + createsFilter + ")" ; return createResourceWithFilter ( filter , resourceRefInfo ) ; } return null ; }
Try to obtain an object instance by creating a resource using a ResourceFactory for a default resource .
24,204
@ FFDCIgnore ( PrivilegedActionException . class ) private Object createResourceWithFilter ( final String filter , final ResourceInfo resourceRefInfo ) throws Exception { try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws Exception { return createResourceWithFilterPrivileged ( filter , resourceRefInfo ) ; } } ) ; } catch ( PrivilegedActionException paex ) { Throwable cause = paex . getCause ( ) ; if ( cause instanceof Exception ) { throw ( Exception ) cause ; } throw new Error ( cause ) ; } }
Try to obtain an object instance by creating a resource using a ResourceFactory with the specified filter .
24,205
private Object getBindingObjectInstance ( Context c , Hashtable < ? , ? > envmt , String className , ResourceInfo resourceRefInfo , Reference bindingRef , InjectionBinding < ? > binding ) throws Exception { Object bindingObject = binding . getBindingObject ( ) ; if ( bindingObject instanceof Reference ) { Reference ref = ( Reference ) bindingObject ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ref=" + ref . getClass ( ) . getName ( ) + ", factory=" + ref . getFactoryClassName ( ) ) ; if ( ref == bindingRef ) { throw new InjectionException ( Tr . formatMessage ( tc , "INDIRECT_LOOKUP_LOOP_CWNEN1008E" ) ) ; } if ( ref instanceof ResourceFactoryReference ) { ResourceFactoryReference factoryRef = ( ResourceFactoryReference ) ref ; ResourceFactory factory = factoryRef . getResourceFactory ( ) ; return factory . createResource ( resourceRefInfo ) ; } if ( ref instanceof IndirectReference ) { IndirectReference indirectRef = ( IndirectReference ) ref ; String refBindingName = indirectRef . bindingName ; String refClassName = ref . getClassName ( ) ; if ( refClassName == null ) { refClassName = className ; } ResourceInfo refResourceRefInfo = indirectRef . resourceInfo ; if ( refResourceRefInfo == null ) { refResourceRefInfo = resourceRefInfo ; } return getObjectInstance ( c , envmt , refClassName , refBindingName , refResourceRefInfo , indirectRef ) ; } } return binding . getInjectionObject ( ) ; }
Try to obtain an object instance from an injection binding object .
24,206
public IServletConfig createConfig ( String servletName ) throws ServletException { return ( ( ( WebApp ) extensionContext ) . getWebExtensionProcessor ( ) . createConfig ( servletName ) ) ; }
A convenience method that creates a ServletConfig object . This also populates the necessary metaData which enables the Servlet associated with the returned config to correctly lookup NameSpace entries . It is highly recommended that extension processors use this method to create the config objects for the targets that the processor creates .
24,207
final protected void closeAndRemoveResultSets ( boolean closeWrapperOnly ) { for ( int i = childWrappers . size ( ) - 1 ; i > - 1 ; i -- ) { try { ( ( WSJdbcObject ) childWrappers . get ( i ) ) . close ( closeWrapperOnly ) ; } catch ( SQLException ex ) { FFDCFilter . processException ( ex , "com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.closeAndRemoveResultSets" , "277" , this ) ; Tr . warning ( tc , "ERR_CLOSING_OBJECT" , ex ) ; } } }
Close the ResultSet for this Statement if it s still around . Close even if the execute is not a query as stated in the java . sql . Statement API .
24,208
protected WSJdbcResultSet createResultSetWrapper ( ResultSet rsetImplObject ) { return rsetImplObject == null ? null : mcf . jdbcRuntime . newResultSet ( rsetImplObject , this ) ; }
Creates a wrapper for the supplied ResultSet object .
24,209
protected final void enforceStatementProperties ( ) throws SQLException { if ( requestedFetchSize != currentFetchSize ) { stmtImpl . setFetchSize ( requestedFetchSize ) ; currentFetchSize = requestedFetchSize ; } if ( dsConfig . get ( ) . syncQueryTimeoutWithTransactionTimeout && ! queryTimeoutSetByUser ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( ( ( WSJdbcConnection ) parentWrapper ) . managedConn . isGlobalTransactionActive ( ) ) { UOWManager uowmgr = UOWManagerFactory . getUOWManager ( ) ; long expireTime = uowmgr . getUOWExpiration ( ) ; long remainingTime = expireTime - System . currentTimeMillis ( ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Milliseconds remaining in transaction timeout: " + remainingTime ) ; if ( remainingTime <= 0l ) throw new SQLTimeoutException ( "Transaction timeout " + ( - remainingTime ) + " ms ago." , "25000" ) ; remainingTime = ( remainingTime + 999l ) / 1000l ; if ( queryTimeoutBeforeSync == null ) queryTimeoutBeforeSync = stmtImpl . getQueryTimeout ( ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Setting query timeout to " + remainingTime ) ; stmtImpl . setQueryTimeout ( ( int ) remainingTime ) ; haveStatementPropertiesChanged = true ; } else if ( queryTimeoutBeforeSync != null ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Restoring query timeout to " + queryTimeoutBeforeSync ) ; stmtImpl . setQueryTimeout ( queryTimeoutBeforeSync ) ; queryTimeoutBeforeSync = null ; } } }
Update statement properties before executing the statement . This method syncs the query timeout to the transaction timeout when appropriate and updates the current fetchSize according to the requested fetchSize value if needed . This method should be invoked before executing the statement .
24,210
public boolean handleAttribute ( DDParser parser , String nsURI , String localName , int index ) throws ParseException { boolean result = false ; if ( nsURI != null ) { return result ; } if ( NAME_ATTRIBUTE_NAME . equals ( localName ) ) { name = parser . parseStringAttributeValue ( index ) ; result = true ; } else if ( COMPONENT_NAME_ATTRIBUTE_NAME . equals ( localName ) ) { componentName = parser . parseStringAttributeValue ( index ) ; result = true ; } else if ( PORT_ADDRESS_ATTRIBUTE_NAME . equals ( localName ) ) { portAddress = parser . parseStringAttributeValue ( index ) ; result = true ; } else if ( WSDL_LOCATION_ATTRIBUTE_NAME . equals ( localName ) ) { wsdlLocation = parser . parseStringAttributeValue ( index ) ; result = true ; } return result ; }
parse the name and address attributes defined in the element .
24,211
void wrapAndRun ( Runnable runnable ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . entering ( CLASS_NAME , "wrapAndRun" , runnable ) ; } try { this . popContextData ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . logp ( Level . FINEST , CLASS_NAME , "wrapAndRun" , "run with context class loader: " + Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } runnable . run ( ) ; } finally { try { this . resetContextData ( ) ; } finally { if ( runnable instanceof CompleteRunnable ) { asyncContext . notifyITransferContextCompleteState ( ) ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . exiting ( CLASS_NAME , "wrapAndRun" , runnable ) ; } } } }
Execute a runnable within some context . Other objects could call popContextData and resetContextData on their own but this ensures that they are called in the right order .
24,212
public static String formatMessage ( String msgKey ) { String msg ; try { msg = JaxbToolsConstants . messages . getString ( msgKey ) ; } catch ( Exception ex ) { return msgKey ; } return msg ; }
get the localized message provided in the message files in the com . ibm . ws . jaxb . tools .
24,213
public void destroy ( ) throws ResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "destroy" ) ; } for ( Iterator iterator = _connections . iterator ( ) ; iterator . hasNext ( ) ; ) { final SibRaConnection connection = ( SibRaConnection ) iterator . next ( ) ; connection . invalidate ( ) ; } try { _coreConnection . close ( true ) ; } catch ( final SIConnectionLostException exception ) { } catch ( final SIConnectionDroppedException exception ) { } catch ( SIException exception ) { FFDCFilter . processException ( exception , "com.ibm.ws.sib.ra.impl.SibRaManagedConnection.destroy" , FFDC_PROBE_2 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceException ( NLS . getFormattedMessage ( "CONNECTION_CLOSE_CWSIV0402" , new Object [ ] { exception } , null ) , exception ) ; } catch ( SIErrorException exception ) { FFDCFilter . processException ( exception , "com.ibm.ws.sib.ra.impl.SibRaManagedConnection.destroy" , FFDC_PROBE_8 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceException ( NLS . getFormattedMessage ( "CONNECTION_CLOSE_CWSIV0402" , new Object [ ] { exception } , null ) , exception ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "destroy" ) ; } }
Destroys this managed connection . Invalidates any current connection handles and closes the core SPI connection .
24,214
public void cleanup ( ) throws ResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "cleanup" ) ; } for ( Iterator iterator = _connections . iterator ( ) ; iterator . hasNext ( ) ; ) { final SibRaConnection connection = ( SibRaConnection ) iterator . next ( ) ; connection . invalidate ( ) ; } if ( _connectionException != null ) { ResourceException exception = new ResourceException ( "Skip logging for this failing connection" ) ; if ( TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw exception ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "cleanup" ) ; } }
Cleans up this managed connection prior to returning it to the free pool . Invalidates any connection handles still associated with the managed connection as in the normal case they would all have been dissociated before cleanup was started .
24,215
public void associateConnection ( final Object connection ) throws ResourceAdapterInternalException { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "associateConnection" , connection ) ; } if ( connection instanceof SibRaConnection ) { final SibRaConnection sibRaConnection = ( SibRaConnection ) connection ; final SibRaManagedConnection oldManagedConnection = sibRaConnection . getManagedConnection ( ) ; if ( oldManagedConnection != null ) { oldManagedConnection . _connections . remove ( connection ) ; } sibRaConnection . setManagedConnection ( this ) ; _connections . add ( sibRaConnection ) ; } else { final ResourceAdapterInternalException exception = new ResourceAdapterInternalException ( NLS . getFormattedMessage ( "UNRECOGNISED_CONNECTION_CWSIV0403" , new Object [ ] { connection , SibRaConnection . class } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw exception ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "associateConnection" ) ; } }
Associates an existing connection handle with this managed connection . The connection handle may still be associated with another managed connection or may be dissociated .
24,216
public void addConnectionEventListener ( final ConnectionEventListener listener ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "addConnectionEventListener" , listener ) ; } _eventListeners . add ( listener ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "addConnectionEventListener" ) ; } }
Adds a connection event listener . Typically the connection manager will register itself using this mechanism .
24,217
public ManagedConnectionMetaData getMetaData ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getMetaData" ) ; } if ( _metaData == null ) { _metaData = new SibRaMetaData ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getMetaData" , _metaData ) ; } return _metaData ; }
Gets the meta data for this managed connection .
24,218
public void dissociateConnections ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "dissociateConnections" ) ; } for ( Iterator iterator = _connections . iterator ( ) ; iterator . hasNext ( ) ; ) { final SibRaConnection connection = ( SibRaConnection ) iterator . next ( ) ; connection . setManagedConnection ( null ) ; } _connections . clear ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "dissociateConnections" ) ; } }
Called by the connection manager to dissociate all the current connection handles from this managed connection .
24,219
SITransaction getContainerTransaction ( final ConnectionManager connectionManager ) throws ResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getContainerTransaction" , connectionManager ) ; } SITransaction currentTransaction = getCurrentTransaction ( ) ; if ( ( currentTransaction == null ) && ( connectionManager instanceof LazyEnlistableConnectionManager ) ) { ( ( LazyEnlistableConnectionManager ) connectionManager ) . lazyEnlist ( this ) ; currentTransaction = getCurrentTransaction ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getContainerTransaction" , currentTransaction ) ; } return currentTransaction ; }
Returns the current container transaction . If we don t already have a transaction and the given connection manager supports it perform a lazy enlist and then check again .
24,220
private SITransaction getCurrentTransaction ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getCurrentTransaction" ) ; } SITransaction currentTransaction = null ; if ( _localTransaction != null ) { currentTransaction = _localTransaction . getCurrentTransaction ( ) ; } if ( ( currentTransaction == null ) && ( _xaResource != null ) ) { currentTransaction = _xaResource . getCurrentTransaction ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getCurrentTransaction" , currentTransaction ) ; } return currentTransaction ; }
Returns the current transaction associated with this managed connection . If the connection manager supports lazy enlistment then this may not represent the current transaction on the thread .
24,221
void localTransactionStarted ( final SibRaConnection connection ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "localTransactionStarted" , connection ) ; } final ConnectionEvent event = new ConnectionEvent ( this , ConnectionEvent . LOCAL_TRANSACTION_STARTED ) ; event . setConnectionHandle ( connection ) ; for ( Iterator iterator = _eventListeners . iterator ( ) ; iterator . hasNext ( ) ; ) { final ConnectionEventListener listener = ( ConnectionEventListener ) iterator . next ( ) ; listener . localTransactionStarted ( event ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "localTransactionStarted" ) ; } }
Used to indicate that an application local transaction has been started . Notifies the connection event listeners .
24,222
void localTransactionRolledBack ( final SibRaConnection connection ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "localTransactionRolledBack" , connection ) ; } final ConnectionEvent event = new ConnectionEvent ( this , ConnectionEvent . LOCAL_TRANSACTION_ROLLEDBACK ) ; event . setConnectionHandle ( connection ) ; for ( Iterator iterator = _eventListeners . iterator ( ) ; iterator . hasNext ( ) ; ) { final ConnectionEventListener listener = ( ConnectionEventListener ) iterator . next ( ) ; listener . localTransactionRolledback ( event ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "localTransactionRolledBack" ) ; } }
Used to indicate that an application local transaction has been rolled back . Notifies the connection event listeners .
24,223
void connectionClosed ( final SibRaConnection connection ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "connectionClosed" , connection ) ; } final ConnectionEvent event = new ConnectionEvent ( this , ConnectionEvent . CONNECTION_CLOSED ) ; event . setConnectionHandle ( connection ) ; for ( Iterator iterator = _eventListeners . iterator ( ) ; iterator . hasNext ( ) ; ) { final ConnectionEventListener listener = ( ConnectionEventListener ) iterator . next ( ) ; listener . connectionClosed ( event ) ; } _connections . remove ( connection ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "connectionClosed" ) ; } }
Used to indicate that a connection has been closed . Notifies the connection event listeners and removes the connection from the set of open connections .
24,224
final void connectionErrorOccurred ( final Exception exception , boolean callJCAListener ) { final String methodName = "connectionErrorOccurred" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { exception , Boolean . valueOf ( callJCAListener ) } ) ; } if ( ! SibRaEngineComponent . isServerStopping ( ) ) { final ConnectionEvent event = new ConnectionEvent ( this , ConnectionEvent . CONNECTION_ERROR_OCCURRED , exception ) ; final List copy ; synchronized ( _eventListeners ) { copy = new ArrayList ( _eventListeners ) ; } if ( callJCAListener ) { for ( final Iterator iterator = copy . iterator ( ) ; iterator . hasNext ( ) ; ) { final Object object = iterator . next ( ) ; if ( object instanceof ConnectionEventListener ) { ( ( ConnectionEventListener ) object ) . connectionErrorOccurred ( event ) ; } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Notifies the connection even listeners that a connection error has occurred .
24,225
public static void main ( String [ ] args ) throws Exception { ModuleConfigParser mParser = new ModuleConfigParser ( ) ; mParser . parse ( "/com/ibm/websphere/pmi/custom/test/PmiServletModule1.xml" , true ) ; }
a test driver - it should be removed after testing
24,226
protected void activate ( ComponentContext context ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Activating" ) ; } processConfig ( context . getProperties ( ) ) ; SystemLogger . setLogService ( logService ) ; }
Activate this DS component .
24,227
protected void deactivate ( ComponentContext context , int reason ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Deactivating, reason=" + reason ) ; } this . registry . removeAll ( ) ; }
Deactivate this DS component .
24,228
protected synchronized void setVirtualHost ( VirtualHost virtualHost ) { this . virtualHost = virtualHost ; if ( ! activeContextRoots . isEmpty ( ) ) { for ( String contextRoot : activeContextRoots ) { virtualHost . addContextRoot ( contextRoot , this ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "add virtual host " + virtualHost ) ; } }
Required static reference
24,229
public AnnotationVisitor visitAnnotation ( String desc , boolean visible ) { AnnotationInfoVisitor av = visitAnnotation ( getInfo ( ) , desc , visible ) ; annotationInfos . add ( av . getAnnotationInfo ( ) ) ; return av ; }
See the class comment for details of annotation processing .
24,230
@ FFDCIgnore ( { UnknownEncoding . class , InvalidName . class } ) public void init ( ORB orb , String configName ) { this . orb = orb ; try { this . codec = CodecFactoryHelper . narrow ( orb . resolve_initial_references ( "CodecFactory" ) ) . create_codec ( CDR_1_2_ENCODING ) ; } catch ( UnknownEncoding e ) { } catch ( InvalidName e ) { } }
Initialize the socket factory instance .
24,231
public void init ( HttpInboundServiceContext context ) { this . isc = context ; this . message = context . getResponse ( ) ; this . body = null ; }
Initialize with a new wrapped message .
24,232
private TokenService getTokenServiceForType ( String tokenType ) { TokenService service = services . getService ( tokenType ) ; if ( service != null ) { return service ; } else { Tr . error ( tc , "TOKEN_SERVICE_CONFIG_ERROR_NO_SUCH_SERVICE_TYPE" , tokenType ) ; String formattedMessage = TraceNLS . getFormattedMessage ( this . getClass ( ) , TraceConstants . MESSAGE_BUNDLE , "TOKEN_SERVICE_CONFIG_ERROR_NO_SUCH_SERVICE_TYPE" , new Object [ ] { tokenType } , "CWWKS4000E: A configuration error has occurred. The requested TokenService instance of type {0} could not be found." ) ; throw new IllegalArgumentException ( formattedMessage ) ; } }
Get the TokenService object which provides for the specified tokenType .
24,233
static private StringBuilder formatLineId ( StringBuilder buffer , int value ) { char [ ] chars = new char [ 4 ] ; for ( int i = 3 ; i >= 0 ; i -- ) { chars [ i ] = ( char ) HEX_BYTES [ ( value % 16 ) & 0xF ] ; value >>= 4 ; } return buffer . append ( chars ) ; }
Format the input value as a four digit hex number padding with zeros .
24,234
public void update ( ChannelData cc ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "update" , cc ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "update" ) ; this . chfwConfig = cc ; }
Notification that the channel configuration has been updated .
24,235
public void write ( int b ) throws IOException { if ( ! ( WCCustomProperties . FINISH_RESPONSE_ON_CLOSE ) || ! outputstreamClosed ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "write" , "write + b ) ; } if ( ! _hasWritten && obs != null ) { _hasWritten = true ; if ( obsList != null ) { for ( int i = 0 ; i < obsList . size ( ) ; i ++ ) { obsList . get ( i ) . alertFirstWrite ( ) ; } } else { obs . alertFirstWrite ( ) ; } } if ( limit > - 1 ) { if ( total >= limit ) { throw new WriteBeyondContentLengthException ( ) ; } } if ( count == buf . length ) { response . setFlushMode ( false ) ; flushBytes ( ) ; response . setFlushMode ( true ) ; } buf [ count ++ ] = ( byte ) b ; total ++ ; } else { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "write" , " write not allowed, outputstreamClosed value + outputstreamClosed ) ; } }
Writes a byte . This method will block until the byte is actually written .
24,236
public void write ( byte [ ] b , int off , int len ) throws IOException { if ( ! ( WCCustomProperties . FINISH_RESPONSE_ON_CLOSE ) || ! outputstreamClosed ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "write" , "write len + len ) ; } if ( len < 0 ) { logger . logp ( Level . SEVERE , CLASS_NAME , "write" , "Illegal.Argument.Trying.to.write.chars" ) ; throw new IllegalArgumentException ( ) ; } if ( ! _hasWritten && obs != null ) { _hasWritten = true ; if ( obsList != null ) { for ( int i = 0 ; i < obsList . size ( ) ; i ++ ) { obsList . get ( i ) . alertFirstWrite ( ) ; } } else { obs . alertFirstWrite ( ) ; } } if ( limit > - 1 ) { if ( total + len > limit ) { len = limit - total ; except = new WriteBeyondContentLengthException ( ) ; } } if ( len >= buf . length ) { response . setFlushMode ( false ) ; flushBytes ( ) ; total += len ; writeOut ( b , off , len ) ; response . setFlushMode ( true ) ; check ( ) ; return ; } int avail = buf . length - count ; if ( len > avail ) { response . setFlushMode ( false ) ; flushBytes ( ) ; response . setFlushMode ( true ) ; } System . arraycopy ( b , off , buf , count , len ) ; count += len ; total += len ; check ( ) ; } else { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "write" , "write bytes not allowed, outputstreamClosed value + outputstreamClosed ) ; } }
Writes an array of bytes . This method will block until all the bytes are actually written .
24,237
private void flushBytes ( ) throws IOException { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "flushBytes" , "flushBytes" ) ; } if ( ! committed ) { if ( ! _hasFlushed && obs != null ) { _hasFlushed = true ; if ( obsList != null ) { for ( int i = 0 ; i < obsList . size ( ) ; i ++ ) { obsList . get ( i ) . alertFirstFlush ( ) ; } } else { obs . alertFirstFlush ( ) ; } } } committed = true ; if ( count > 0 ) { writeOut ( buf , 0 , count ) ; count = 0 ; } else if ( count == 0 ) { if ( response != null && response . getFlushMode ( ) ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "flushBytes" , "Count 0 still flush mode is true , forceful flush" ) ; } response . flushBufferedContent ( ) ; } else if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "flushBytes" , "flush mode is false" ) ; } } }
Flushes the output stream bytes .
24,238
public Object getObjectInstance ( Object refObj , Name name , Context nameCtx , Hashtable env ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getObjectInstance" , "" + name ) ; } ExtendedJTATransaction extJTATran = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "class name: " + ( refObj instanceof Reference ? ( ( Reference ) refObj ) . getClassName ( ) : null ) ) ; } extJTATran = refObj instanceof Reference && ( ( Reference ) refObj ) . getFactoryClassName ( ) == null ? createExtendedJTATransaction ( ) : null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getObjectInstance: " + extJTATran ) ; } return extJTATran ; }
Return the ExtendedJTATransaction object .
24,239
public static ExtendedJTATransaction getExtendedJTATransaction ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getExtendedJTATransaction" , instance ) ; } return instance ; }
Get the singleton instance of ExtendedJTATransaction
24,240
public void add ( int anInt ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "add" ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Params: int" , anInt ) ; if ( currentCursor == arraySize ) { allArrays . add ( current ) ; current = new int [ arraySize ] ; currentCursor = 0 ; } current [ currentCursor ] = anInt ; currentCursor ++ ; elements ++ ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "add" ) ; }
Adds an int to the array .
24,241
public int get ( int index ) throws NoSuchElementException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "get" ) ; int retValue = 0 ; int arrayNumber = index / arraySize ; if ( ( index + 1 ) > elements ) { throw new NoSuchElementException ( ) ; } else if ( index < 0 ) { throw new NoSuchElementException ( ) ; } else if ( allArrays . size ( ) == arrayNumber ) { retValue = current [ index - ( arrayNumber * arraySize ) ] ; } else { int [ ] tempArray = ( int [ ] ) allArrays . get ( arrayNumber ) ; retValue = tempArray [ index - ( arrayNumber * arraySize ) ] ; } if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "rc=" , retValue ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "get" ) ; return retValue ; }
Gets an int from the array .
24,242
public int length ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "length" ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "rc=" , elements ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "length" ) ; return elements ; }
Returns the number of elements in the array
24,243
private void determineChannelAccessor ( ) throws ChannelFrameworkException , ChannelFactoryException { OutboundChannelDefinition first = this . outboundChannelDefs . getFirst ( ) ; Class < ? > factoryClass = first . getOutboundFactory ( ) ; if ( factoryClass == null ) { throw new ChannelFrameworkException ( "No factory class associated with outbound channel " + first ) ; } ChannelFactory outboundFactory = framework . getChannelFactoryInternal ( factoryClass , false ) ; if ( outboundFactory == null ) { throw new ChannelFrameworkException ( "No channel factory could be found for factory class " + factoryClass ) ; } this . channelAccessor = outboundFactory . getApplicationInterface ( ) ; }
Identify the channel accessor class based on the application side outbound channel definition array .
24,244
private void determineIsSSLEnabled ( ) { int i = 0 ; for ( OutboundChannelDefinition def : this . outboundChannelDefs ) { if ( SSLChannelFactory . class . isAssignableFrom ( def . getOutboundFactory ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found SSLChannelFactory interface: " + def . getOutboundFactory ( ) ) ; } this . sslChannelIndex = i ; break ; } i ++ ; } }
Identify if one of the outbound channel definitions has a factory that implements the SSLChannelFactory .
24,245
private void determineIsLocal ( ) { int i = 0 ; for ( OutboundChannelDefinition def : this . outboundChannelDefs ) { if ( LocalChannelFactory . class . isAssignableFrom ( def . getOutboundFactory ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found LocalChannelFactory interface: " + def . getOutboundFactory ( ) ) ; } this . localChannelIndex = i ; break ; } i ++ ; } }
Identify if one of the outbound channel definitions has a factory that implements the LocalChannelFactory .
24,246
private void assignAddress ( String addressString ) throws ChannelFrameworkException , UnknownHostException { if ( addressString == null ) { throw new ChannelFrameworkException ( "No address available in properties." ) ; } if ( "*" . equals ( addressString ) ) { this . address = InetAddress . getLocalHost ( ) ; } else { this . address = InetAddress . getByName ( addressString ) ; } }
Assign the value of address based on the String parameter .
24,247
public Integer generateKey ( FacesContext facesContext ) { ExternalContext externalContext = facesContext . getExternalContext ( ) ; Object sessionObj = externalContext . getSession ( true ) ; Integer sequence = null ; synchronized ( sessionObj ) { Map < String , Object > map = externalContext . getSessionMap ( ) ; sequence = ( Integer ) map . get ( RendererUtils . SEQUENCE_PARAM ) ; if ( sequence == null || sequence . intValue ( ) == Integer . MAX_VALUE ) { sequence = Integer . valueOf ( 1 ) ; } else { sequence = Integer . valueOf ( sequence . intValue ( ) + 1 ) ; } map . put ( RendererUtils . SEQUENCE_PARAM , sequence ) ; } return sequence ; }
Take the counter from session scope and increment
24,248
private void cacheInsert ( MasterKey key , StatefulBeanO sfbean ) { CacheElement cacheElement = cache . insert ( key , sfbean ) ; sfbean . ivCacheElement = cacheElement ; sfbean . ivCacheKey = key ; if ( ! sfbean . getHome ( ) . getBeanMetaData ( ) . isPassivationCapable ( ) ) { cache . markElementEvictionIneligible ( cacheElement ) ; } }
Insert a stateful bean with the specified key into the cache . The caller must be holding the lock associated with the key .
24,249
public void atPassivate ( BeanId beanId ) throws RemoteException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "atPassivate " + beanId ) ; BeanO bean = null ; MasterKey key = new MasterKey ( beanId ) ; try { synchronized ( locks . getLock ( key ) ) { if ( ( bean = ( BeanO ) cache . findDontPinNAdjustPinCount ( key , 0 ) ) != null ) { bean . passivate ( ) ; cache . remove ( key , false ) ; bean . ivCacheKey = null ; if ( EJSPlatformHelper . isZOS ( ) || passivationPolicy . equals ( PassivationPolicy . ON_DEMAND ) ) { reaper . remove ( beanId ) ; } } } } catch ( RemoteException ex ) { FFDCFilter . processException ( ex , CLASS_NAME + ".atPassivate" , "525" , this ) ; Tr . warning ( tc , "UNABLE_TO_PASSIVATE_EJB_CNTR0005W" , new Object [ ] { bean , this , ex } ) ; throw ex ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "atPassivate" ) ; }
This method will be invoked when the server invokes one of passivate or passivateAll on the ManagedContainer interface .
24,250
@ Reference ( cardinality = ReferenceCardinality . OPTIONAL , policy = ReferencePolicy . DYNAMIC , policyOption = ReferencePolicyOption . GREEDY ) protected void setCDIBatchArtifactFactory ( CDIBatchArtifactFactory preferredArtifactFactory ) { this . cdiBatchArtifactFactory = preferredArtifactFactory ; }
DS injection .
24,251
public AnnotationValueImpl addAnnotationValue ( String name , Object value ) { AnnotationValueImpl annotationValue = new AnnotationValueImpl ( value ) ; addAnnotationValue ( name , annotationValue ) ; return annotationValue ; }
base value .
24,252
public AnnotationValueImpl addAnnotationValue ( String name , String enumClassName , String enumName ) { AnnotationValueImpl annotationValue = new AnnotationValueImpl ( enumClassName , enumName ) ; addAnnotationValue ( name , annotationValue ) ; return annotationValue ; }
the enumeration class name and the enumeration literal value .
24,253
public void log ( TraceComponent logger ) { Tr . debug ( logger , MessageFormat . format ( "Annotation [ {0} ]" , getAnnotationClassName ( ) ) ) ; for ( String valueName : this . values . keySet ( ) ) { AnnotationValueImpl nextValue = getValue ( valueName ) ; String valueEnumClassName = nextValue . getEnumClassName ( ) ; Object valueValue = nextValue . getObjectValue ( ) ; if ( valueEnumClassName != null ) { Tr . debug ( logger , MessageFormat . format ( " Value: Name [ {0} ] Enum Type [ {1} ] Value [ {2} ]" , new Object [ ] { valueName , valueEnumClassName , valueValue } ) ) ; } else { Tr . debug ( logger , MessageFormat . format ( " Value: Name [ {0} ] Value [ {1} ]" , new Object [ ] { valueName , valueValue } ) ) ; } } }
because of the global state access .
24,254
public WSJobExecution updateJobExecutionAndInstanceNotSetToServerYet ( long jobExecutionId , Date date ) throws ExecutionAssignedToServerException { return updateJobExecutionAndInstanceOnStopBeforeServerAssigned ( jobExecutionId , date ) ; }
DELETE ME - rename to better name
24,255
private void setupData ( ValidationConfig config , ClassLoader classLoader ) { if ( config != null ) { versionID = config . getVersionID ( ) ; defaultProvider = config . getDefaultProvider ( ) ; defaultProvider = defaultProvider != null ? defaultProvider . trim ( ) : defaultProvider ; messageInterpolator = config . getMessageInterpolator ( ) ; messageInterpolator = messageInterpolator != null ? messageInterpolator . trim ( ) : messageInterpolator ; traversableResolver = config . getTraversableResolver ( ) ; traversableResolver = traversableResolver != null ? traversableResolver . trim ( ) : traversableResolver ; constraintMapping = config . getConstraintMappings ( ) ; constraintValidatorFactory = config . getConstraintValidatorFactory ( ) ; constraintValidatorFactory = constraintValidatorFactory != null ? constraintValidatorFactory . trim ( ) : constraintValidatorFactory ; properties = config . getProperties ( ) ; } appClassloader = classLoader ; }
Internal method to set up the object s data
24,256
protected Class < ? > loadClass ( String className ) throws ClassNotFoundException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "loadClass" , className ) ; } Class < ? > theClass = null ; try { if ( appClassloader != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Class loader to be used " + appClassloader ) ; } theClass = Class . forName ( className , true , appClassloader ) ; } else { ClassLoader cl = getContextClassLoader ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "appClassloader is null, so try using context class loader " + cl ) ; } theClass = Class . forName ( className , true , cl ) ; } } catch ( ClassNotFoundException cnfe ) { Tr . error ( tc , BVNLSConstants . BVKEY_CLASS_NOT_FOUND , new Object [ ] { ivBVContext . getPath ( ) , className , cnfe } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to create a ValidationFactory" , cnfe ) ; } throw cnfe ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "loadClass" , theClass ) ; } return theClass ; }
Load the class on the application class loader given the class name . If the application class loader wasn t passed in it is assumed that the current TCCL is already set so that is what is used .
24,257
private void checkForConnectionInFreePool ( MCWrapper mcw ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "checkForConnectionInFreePool" ) ; } int hashMapBucket = mcw . getHashMapBucket ( ) ; if ( freePool [ hashMapBucket ] . removeMCWrapperFromList ( mcw ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Managed connection wrapper was removed from the free pool wrapper list. mcw is " + mcw ) ; } freePool [ hashMapBucket ] . cleanupAndDestroyMCWrapper ( mcw ) ; freePool [ hashMapBucket ] . removeMCWrapperFromList ( mcw , false , true , false , true ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "checkForConnectionInFreePool" ) ; } }
Check for a connection in the free pool . If a connection is found cleanup and destroy the connection and remove the mcwrapper from the free pool .
24,258
private boolean checkForActiveConnections ( int value ) { boolean activeConnections = false ; if ( value == 0 ) { mcToMCWMapWrite . lock ( ) ; try { Collection < MCWrapper > mcWrappers = mcToMCWMap . values ( ) ; Iterator < MCWrapper > mcWrapperIt = mcWrappers . iterator ( ) ; while ( mcWrapperIt . hasNext ( ) ) { MCWrapper mcw = mcWrapperIt . next ( ) ; if ( activeRequest . get ( ) > 0 ) { activeConnections = true ; break ; } else { int poolState = mcw . getPoolState ( ) ; if ( ( poolState != 1 ) && ( poolState != 9 ) ) { activeConnections = true ; break ; } } } } finally { mcToMCWMapWrite . unlock ( ) ; } } else { if ( activeRequest . get ( ) > 0 ) { activeConnections = true ; } } return activeConnections ; }
Look for active connection requests and connections in the shared and un - shared pools .
24,259
protected void startReclaimConnectionThread ( ) { if ( tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "startReclaimConnectionThread" ) ; } synchronized ( taskTimerLockObject ) { if ( ! reaperThreadStarted ) { if ( reapTime > 0 ) { if ( ( this . unusedTimeout > 0 ) || ( this . agedTimeout > 0 ) ) { final PoolManager tempPM = this ; reaperThreadStarted = true ; AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { public Void run ( ) { new TaskTimer ( tempPM ) ; return null ; } } ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Started reclaim connection thread for pool " + gConfigProps . getXpathId ( ) ) ; } } } } } if ( tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "startReclaimConnectionThread" ) ; } }
Starts the reclaim collection thread that remove unused connection based on the UnusedTimeout agedTime and the ReapTime .
24,260
private boolean needToReclaimConnections ( ) { boolean removemcw = false ; for ( int j = 0 ; j < maxFreePoolHashSize ; ++ j ) { synchronized ( freePool [ j ] . freeConnectionLockObject ) { int localtotalConnectionCount = totalConnectionCount . get ( ) ; int mcwlSize = freePool [ j ] . mcWrapperList . size ( ) ; for ( int k = 0 ; k < mcwlSize ; ++ k ) { MCWrapper mcw = ( MCWrapper ) freePool [ j ] . mcWrapperList . get ( k ) ; if ( agedTimeout != - 1 ) { if ( mcw . hasAgedTimedOut ( agedTimeoutMillis ) ) { removemcw = true ; break ; } } if ( ! removemcw && unusedTimeout != - 1 ) { if ( mcw . hasIdleTimedOut ( unusedTimeout * 1000 ) && ( localtotalConnectionCount > minConnections ) ) { removemcw = true ; break ; } } } } if ( removemcw ) { break ; } } return removemcw ; }
Do we need to reclaim connections .
24,261
protected final int computeHashCode ( Subject subject , ConnectionRequestInfo cri ) { final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "computeHashCode" ) ; } if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { StringBuffer sbuff = new StringBuffer ( ) ; sbuff . append ( "computeHashCode for Subject " ) ; if ( subject == null ) { sbuff . append ( "null" ) ; } else { SubjectToString subjectToString = new SubjectToString ( ) ; subjectToString . setSubject ( subject ) ; sbuff . append ( AccessController . doPrivileged ( subjectToString ) ) ; } if ( cri == null ) { sbuff . append ( " and CRI null" ) ; } else { sbuff . append ( " and CRI " + cri . toString ( ) ) ; } Tr . debug ( this , tc , sbuff . toString ( ) ) ; } int sHash , cHash , hashCode ; if ( subject != null ) { if ( ! gConfigProps . raSupportsReauthentication ) { SubjectHashCode subjectHashCode = new SubjectHashCode ( ) ; subjectHashCode . setSubject ( subject ) ; sHash = AccessController . doPrivileged ( subjectHashCode ) ; } else { sHash = 1 ; } } else { sHash = 1 ; } if ( cri != null ) { cHash = cri . hashCode ( ) ; } else { cHash = 1 ; } hashCode = Math . abs ( ( sHash / 2 ) + ( cHash / 2 ) ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Subject's hash code is " + sHash + " and the CRI's hash code is " + cHash ) ; Tr . debug ( this , tc , "computeHashCode, hashCode is " + hashCode ) ; } if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "computeHashCode" ) ; } return hashCode ; }
173212 - computeHashCode
24,262
public Object getMCWFromMctoMCWMap ( Object mc ) { Object mcw = null ; mcToMCWMapRead . lock ( ) ; try { mcw = mcToMCWMap . get ( mc ) ; } finally { mcToMCWMapRead . unlock ( ) ; } return mcw ; }
Get the mcw from the hash map
24,263
public void putMcToMCWMap ( ManagedConnection mc , MCWrapper mcw ) { mcToMCWMapWrite . lock ( ) ; try { mcToMCWMap . put ( mc , mcw ) ; } finally { mcToMCWMapWrite . unlock ( ) ; } }
Put the mcw in the hash map
24,264
public void removeMcToMCWMap ( Object mc ) { if ( tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "removeMcToMCWMap" ) ; } mcToMCWMapWrite . lock ( ) ; try { mcToMCWMap . remove ( mc ) ; } finally { mcToMCWMapWrite . unlock ( ) ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , mcToMCWMap . size ( ) + " connections remaining in mc to mcw table" ) ; } if ( tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "removeMcToMCWMap" ) ; } }
Remove the mcw from the hash map
24,265
public void run ( ) { final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "run" , "alarm" ) ; } if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "run: alarm, Pool contents ==> " + this . toString ( ) ) ; Tr . debug ( this , tc , "reaperThreadStarted: " , reaperThreadStarted ) ; } if ( needToReclaimConnections ( ) || needToReclaimTLSConnections ( ) ) { startReclaimConnectionThread ( ) ; } if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "run: alarm, Pool contents ==> " + this . toString ( ) ) ; Tr . debug ( this , tc , "reaperThreadStarted: " , reaperThreadStarted ) ; } synchronized ( amLockObject ) { if ( this . agedTimeout < 1 ) { if ( ( totalConnectionCount . get ( ) > minConnections ) && alarmThreadCounter . get ( ) >= 0 ) { createReaperAlarm ( ) ; } else { if ( alarmThreadCounter . get ( ) > 0 ) alarmThreadCounter . decrementAndGet ( ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Alarm thread was NOT started. Number of alarm threads is " + alarmThreadCounter . get ( ) ) ; } } else { if ( totalConnectionCount . get ( ) > 0 && alarmThreadCounter . get ( ) >= 0 ) { createReaperAlarm ( ) ; } else { if ( alarmThreadCounter . get ( ) > 0 ) alarmThreadCounter . decrementAndGet ( ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Alarm thread was NOT started. Number of alarm threads is " + alarmThreadCounter . get ( ) ) ; } } } if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "run" ) ; } }
This method can be submitted to a ScheduledExecutorService to run in the future .
24,266
private void createReaperAlarm ( ) { final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( pmQuiesced ) { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( tc , " PM has been Quiesced, so cancel old reaper alarm." ) ; if ( am != null ) am . cancel ( false ) ; return ; } if ( nonDeferredReaperAlarm ) { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Creating non-deferrable alarm for reaper" ) ; if ( am != null ) { am . cancel ( false ) ; if ( am . isDone ( ) ) { alarmThreadCounter . decrementAndGet ( ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Previous alarm thread cancelled." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . nonDeferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } } else { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "No previous alarm thread exists. Creating a new one." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . nonDeferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } } else { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Creating deferrable alarm for reaper" ) ; if ( am != null ) { am . cancel ( false ) ; if ( am . isDone ( ) ) { alarmThreadCounter . decrementAndGet ( ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Previous alarm thread cancelled." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . deferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } } else { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "No previous alarm thread exists. Creating a new one." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . deferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } } }
Creates a new alarm thread .
24,267
synchronized static TraceSpecification setTraceSpec ( String spec ) { if ( WsLogManager . isConfiguredByLoggingProperties ( ) ) { return null ; } if ( ( spec == null || spec . equals ( traceString ) ) && Tr . activeTraceSpec . isSensitiveTraceSuppressed ( ) == suppressSensitiveTrace ) { return null ; } traceString = spec ; TraceSpecification newTs = new TraceSpecification ( spec , safeLevelsIndex , suppressSensitiveTrace ) ; TraceSpecificationException tex = newTs . getExceptions ( ) ; if ( tex != null ) { do { tex . warning ( loggingConfig . get ( ) != null ) ; tex = tex . getPreviousException ( ) ; } while ( tex != null ) ; } Tr . setTraceSpec ( newTs ) ; return newTs ; }
Set the trace specification of the service to the input value .
24,268
protected Link insert ( Token newToken , Link insertPoint , Transaction transaction ) throws ObjectManagerException { final String methodName = "insert" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { newToken , insertPoint , transaction } ) ; if ( ! ( state == stateReady ) && ! ( ( state == stateAdded ) && lockedBy ( transaction ) ) ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { new Integer ( state ) , stateNames [ state ] } ) ; throw new InvalidStateException ( this , state , stateNames [ state ] ) ; } managedObjectsToAdd . clear ( ) ; managedObjectsToReplace . clear ( ) ; reservedSpaceInStore = storeSpaceForAdd ( ) ; owningToken . objectStore . reserve ( ( int ) reservedSpaceInStore , false ) ; Link newLink = new Link ( this , newToken , insertPoint . previous , insertPoint . owningToken , transaction ) ; managedObjectsToAdd . add ( newLink ) ; if ( insertPoint . previous == null ) { if ( head == null ) tail = newLink . getToken ( ) ; else { insertPoint . previous = newLink . getToken ( ) ; managedObjectsToReplace . add ( insertPoint ) ; } head = newLink . getToken ( ) ; } else { Link previousLink = ( Link ) insertPoint . previous . getManagedObject ( ) ; previousLink . next = newLink . getToken ( ) ; managedObjectsToReplace . add ( previousLink ) ; if ( insertPoint . owningToken == tail ) { tail = newLink . getToken ( ) ; } else { insertPoint . previous = newLink . getToken ( ) ; managedObjectsToReplace . add ( insertPoint ) ; } } availableHead = head ; skipToBeDeleted ( ) ; incrementSize ( ) ; managedObjectsToReplace . add ( this ) ; try { transaction . optimisticReplace ( managedObjectsToAdd , managedObjectsToReplace , null , null , + logSpaceForDelete ( ) ) ; owningToken . objectStore . reserve ( ( int ) ( storeSpaceForRemove ( ) - reservedSpaceInStore ) , false ) ; } catch ( InvalidStateException exception ) { undoAdd ( newLink ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , exception ) ; throw exception ; } catch ( LogFileFullException exception ) { undoAdd ( newLink ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , exception ) ; throw exception ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { newLink } ) ; return newLink ; }
Insert before the given link . Caller must be synchronized on list .
24,269
void undoAdd ( Link newLink ) throws ObjectManagerException { final String methodName = "undoAdd" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { newLink } ) ; if ( newLink . next == null ) { tail = newLink . previous ; } else { Link nextLink = ( Link ) newLink . next . getManagedObject ( ) ; nextLink . previous = newLink . previous ; } if ( newLink . previous == null ) { head = newLink . next ; } else { Link previousLink = ( Link ) newLink . previous . getManagedObject ( ) ; previousLink . next = newLink . next ; } availableHead = head ; skipToBeDeleted ( ) ; decrementSize ( ) ; owningToken . objectStore . reserve ( ( int ) - reservedSpaceInStore , false ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Reverse the action of addition to the list used after an add has failed to log anything . Does not perform any logging . The caller must be synchronized on List .
24,270
private synchronized void unRemove ( Link link ) throws StateErrorException , ObjectManagerException { link . setState ( Link . nextStateForRequestUnDelete ) ; availableHead = head ; skipToBeDeleted ( ) ; if ( link . state == Link . stateAdded ) { incrementAvailableSize ( ) ; owningToken . objectStore . reserve ( - ( int ) storeSpaceForRemove ( ) , false ) ; } }
Restore a link so that it is visible again in the list .
24,271
protected Link nextLink ( Link start , Transaction transaction , long transactionUnlockPoint ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "nextLink" , new Object [ ] { start , transaction , new Long ( transactionUnlockPoint ) , head , availableHead } ) ; Token nextToken = null ; Link nextLink = null ; if ( start == null ) { if ( availableHead == null ) { availableHead = head ; skipToBeDeleted ( ) ; } nextToken = availableHead ; } else if ( start . state == Link . stateRemoved || start . state == Link . stateDeleted ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "nextLink" , "returns null" + " start link is deleted" ) ; return null ; } else { nextToken = start . next ; } searchForward : while ( nextToken != null ) { nextLink = ( Link ) ( nextToken . getManagedObject ( ) ) ; if ( nextLink . state == Link . stateAdded ) if ( ! nextLink . wasLocked ( transactionUnlockPoint ) ) break searchForward ; if ( nextLink . state == Link . stateToBeAdded && transaction != null && nextLink . lockedBy ( transaction ) ) break searchForward ; nextToken = nextLink . next ; } if ( nextToken == null ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "nextLink" , "returns null" + " empty list" ) ; return null ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "nextLink" , new Object [ ] { nextLink } ) ; return nextLink ; }
Find the next link after the start link visible to a transaction before the unlockPoint .
24,272
protected Link previousLink ( Link start , Transaction transaction , long transactionUnlockPoint ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "previousLink" , new Object [ ] { start , transaction , new Long ( transactionUnlockPoint ) } ) ; Token previousToken = null ; Link previousLink = null ; if ( start == null ) { previousToken = tail ; } else if ( start . state == Link . stateRemoved || start . state == Link . stateDeleted ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "previousLink" , "returns null" + " start link is deleted" ) ; return null ; } else { previousToken = start . previous ; } searchBackward : while ( previousToken != null ) { previousLink = ( Link ) ( previousToken . getManagedObject ( ) ) ; if ( previousLink . state == Link . stateAdded ) if ( ! previousLink . wasLocked ( transactionUnlockPoint ) ) break searchBackward ; if ( previousLink . state == Link . stateToBeAdded && transaction != null && previousLink . lockedBy ( transaction ) ) break searchBackward ; previousToken = previousLink . next ; } if ( previousToken == null ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "nextLink" , "returns null" + " empty list" ) ; return null ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "previousLink" , new Object [ ] { previousLink } ) ; return previousLink ; }
Find the previous link before the start link visible to a transaction before the unlockPoint .
24,273
protected Link nextLink ( Link start ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "nextLink" , new Object [ ] { start } ) ; Token nextToken = null ; if ( start == null ) { nextToken = head ; } else { nextToken = start . next ; } Link nextLink = null ; if ( nextToken != null ) nextLink = ( Link ) ( nextToken . getManagedObject ( ) ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "nextLink" , new Object [ ] { nextLink } ) ; return nextLink ; }
Find the next link after the start link even if it is part of a transaction . A dirty scan .
24,274
protected Link previousLink ( Link start ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "previousLink" , new Object [ ] { start } ) ; Token previousToken = null ; if ( start == null ) { previousToken = head ; } else { previousToken = start . next ; } Link previousLink = null ; if ( previousToken != null ) previousLink = ( Link ) ( previousToken . getManagedObject ( ) ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "previousLink" , new Object [ ] { previousLink } ) ; return previousLink ; }
Find the previous link before the start link even if it is part of a transaction . A dirty scan .
24,275
protected Link firstAvailableLink ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "firstAvailableLink" ) ; if ( availableHead == null ) { availableHead = head ; skipToBeDeleted ( ) ; } Link nextLink = null ; if ( availableHead != null ) nextLink = ( Link ) availableHead . getManagedObject ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "firstAvailableLink" , "returns nextLink=" + nextLink + "(Link)" ) ; return nextLink ; }
Find the first available link after the start of the list . This search might return a link locked by a transaction toBeAdded .
24,276
protected void skipToBeDeleted ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "skipToBeDeleted" ) ; Token nextToken = availableHead ; skipToBeDeleted : while ( nextToken != null ) { Link nextLink = ( Link ) ( nextToken . getManagedObject ( ) ) ; if ( nextLink . state != Link . stateToBeDeleted && nextLink . state != Link . stateMustBeDeleted ) break skipToBeDeleted ; nextToken = nextLink . next ; } availableHead = nextToken ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "skipToBeDeleted" ) ; }
Move the availableHead past any ToBeDeleted links . Caller must be synchronized on LinkedList .
24,277
public synchronized boolean validate ( java . io . PrintStream printStream ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "validate" , new Object [ ] { printStream } ) ; boolean valid = true ; Link tailLink = null ; if ( tail != null ) { tailLink = ( Link ) tail . getManagedObject ( ) ; if ( tailLink . next != null ) { printStream . println ( "tail link.next=" + tailLink . next + " not null" ) ; valid = false ; } } long numberOfLinks = 0 ; Token nextToken = head ; Link nextLink = null ; while ( nextToken != null ) { numberOfLinks ++ ; nextLink = ( Link ) ( nextToken . getManagedObject ( ) ) ; nextToken = nextLink . next ; } if ( numberOfLinks != size ) { printStream . println ( "counted=" + numberOfLinks + " not equal to size=" + size ) ; valid = false ; } if ( nextLink != tailLink ) { printStream . println ( "final link=" + nextLink + "not equal tail=" + tailLink ) ; valid = false ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "validate" , new Object [ ] { new Boolean ( valid ) } ) ; return valid ; }
Check that the head leads to the tail in both the forwards and backwards directions . Check that the number of messages in between matches the size .
24,278
void reserveSpaceInStore ( ObjectManagerByteArrayOutputStream byteArrayOutputStream ) throws ObjectManagerException { if ( owningToken . getObjectStore ( ) . getObjectManagerState ( ) . getObjectManagerStateState ( ) == ObjectManagerState . stateReplayingLog ) super . reserveSpaceInStore ( byteArrayOutputStream ) ; else { int currentSerializedSize = byteArrayOutputStream . getCount ( ) + owningToken . objectStore . getAddSpaceOverhead ( ) ; if ( currentSerializedSize > latestSerializedSize ) { latestSerializedSizeDelta = currentSerializedSize - latestSerializedSize ; reservedSpaceInStore = reservedSpaceInStore - latestSerializedSizeDelta ; latestSerializedSize = currentSerializedSize ; } } }
Modifiy the behaviour of the ManagedObject ObjectStore space reservation by taking storage from the previously allocated reservedSpaceInStore rather than the store itself this avoids the possibility of seeing an ObjectStoreFull exception here .
24,279
public static boolean versionSatisfiesMinimum ( int [ ] minimumVersion , int [ ] queryVersion ) { if ( minimumVersion . length == queryVersion . length ) { for ( int i = 0 ; i < minimumVersion . length ; i ++ ) { if ( queryVersion [ i ] < minimumVersion [ i ] ) { return false ; } else if ( queryVersion [ i ] == minimumVersion [ i ] ) { continue ; } else if ( queryVersion [ i ] > minimumVersion [ i ] ) { return true ; } } return true ; } return false ; }
Evaluate whether queryVersion is considered to be greater or equal than minimumVersion .
24,280
public BaseDestinationHandler getDestinationHandler ( ) { if ( tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getDestinationHandler" ) ; SibTr . exit ( tc , "getDestinationHandler" , destinationHandler ) ; } return destinationHandler ; }
Return the destinationHandler that the protocol itemstream is associated with
24,281
public boolean authorize ( AuthenticationResult authResult , WebRequest webRequest , String uriName ) { HttpServletRequest req = webRequest . getHttpServletRequest ( ) ; boolean isAuthorized = jaccServiceRef . getService ( ) . isAuthorized ( getApplicationName ( ) , getModuleName ( ) , uriName , req . getMethod ( ) , req , authResult . getSubject ( ) ) ; WebReply reply = isAuthorized ? new PermitReply ( ) : DENY_AUTHZ_FAILED ; if ( isAuthorized ) { AuditAuthenticationResult auditAuthResult = new AuditAuthenticationResult ( AuditAuthResult . SUCCESS , authResult . getSubject ( ) , AuditEvent . CRED_TYPE_BASIC , null , AuditEvent . OUTCOME_SUCCESS ) ; Audit . audit ( Audit . EventID . SECURITY_AUTHZ_02 , webRequest , authResult , uriName , AuditConstants . WEB_CONTAINER , Integer . valueOf ( reply . getStatusCode ( ) ) ) ; } else { AuditAuthenticationResult auditAuthResult = new AuditAuthenticationResult ( AuditAuthResult . FAILURE , authResult . getSubject ( ) , AuditEvent . CRED_TYPE_BASIC , null , AuditEvent . OUTCOME_FAILURE ) ; Audit . audit ( Audit . EventID . SECURITY_AUTHZ_02 , webRequest , authResult , uriName , AuditConstants . WEB_CONTAINER , Integer . valueOf ( reply . getStatusCode ( ) ) ) ; } if ( ! isAuthorized ) { String authUserName = authResult . getUserName ( ) ; String authRealm = authResult . getRealm ( ) ; String appName = webRequest . getApplicationName ( ) ; if ( authRealm != null && authUserName != null ) { Tr . audit ( tc , "SEC_JACC_AUTHZ_FAILED" , authUserName . concat ( ":" ) . concat ( authRealm ) , appName , uriName ) ; } else { authUserName = authResult . getSubject ( ) . getPrincipals ( WSPrincipal . class ) . iterator ( ) . next ( ) . getName ( ) ; Tr . audit ( tc , "SEC_JACC_AUTHZ_FAILED" , authUserName , appName , uriName ) ; } } return isAuthorized ; }
Call the JACC authorization service to determine if the subject is authorized
24,282
public boolean addSync ( ) throws ResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "addSync" ) ; } UOWCoordinator uowCoord = mcWrapper . getUOWCoordinator ( ) ; if ( uowCoord == null ) { String pmiName = mcWrapper . gConfigProps . cfName ; Object [ ] parms = new Object [ ] { "addSync" , pmiName } ; Tr . error ( tc , "NO_VALID_TRANSACTION_CONTEXT_J2CA0040" , parms ) ; throw new ResourceException ( "INTERNAL ERROR: No valid transaction context present" ) ; } try { boolean shareable = mcWrapper . getConnectionManager ( ) . shareable ( ) ; if ( ! shareable && ! J2CUtilityClass . isContainerAtBoundary ( mcWrapper . pm . connectorSvc . transactionManager ) ) { ( ( LocalTransactionCoordinator ) uowCoord ) . enlistSynchronization ( new RRSNoTransactionWrapper ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "addSync" , "returning without registering." ) ; } return false ; } else { ( ( LocalTransactionCoordinator ) uowCoord ) . enlistSynchronization ( this ) ; mcWrapper . markRRSLocalTransactionWrapperInUse ( ) ; registeredForSync = true ; } } catch ( ResourceException e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.RRSLocalTransactionWrapper.addSync" , "594" , this ) ; Object [ ] parms = new Object [ ] { "addSync" , e , "Exception" } ; Tr . error ( tc , "REGISTER_WITH_SYNCHRONIZATION_EXCP_J2CA0026" , parms ) ; throw e ; } catch ( Exception e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.RRSLocalTransactionWrapper.addSync" , "605" , this ) ; Object [ ] parms = new Object [ ] { "addSync" , e , "Exception" } ; Tr . error ( tc , "REGISTER_WITH_SYNCHRONIZATION_EXCP_J2CA0026" , parms ) ; ResourceException re = new ResourceException ( "addSync: caught Exception" ) ; re . initCause ( e ) ; throw re ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "addSync" , registeredForSync ) ; } return registeredForSync ; }
Register the RRSLocalTransactionWrapper as a sync object with the Transaction Manager for the current transaction .
24,283
private boolean shouldInterpretEmptyStringSubmittedValuesAsNullClearInput ( FacesContext context ) { ExternalContext ec = context . getExternalContext ( ) ; String param = ec . getInitParameter ( EMPTY_VALUES_AS_NULL_CLEAR_INPUT_PARAM_NAME ) ; Boolean interpretEmptyStringAsNullClearInput = "true" . equalsIgnoreCase ( param ) ; return interpretEmptyStringAsNullClearInput ; }
Get the value of context parameter org . apache . myfaces . INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL_CLEAR_INPUT from the web . xml
24,284
@ JSFProperty ( defaultValue = "true" , tagExcluded = true ) public boolean isValid ( ) { Object value = getStateHelper ( ) . get ( PropertyKeys . valid ) ; if ( value != null ) { return ( Boolean ) value ; } return true ; }
Specifies whether the component s value is currently valid ie whether the validators attached to this component have allowed it .
24,285
@ SuppressWarnings ( "unchecked" ) private Map < String , List < Object [ ] > > _getDebugInfoMap ( ) { Map < String , Object > requestMap = getFacesContext ( ) . getExternalContext ( ) . getRequestMap ( ) ; Map < String , List < Object [ ] > > debugInfo = ( Map < String , List < Object [ ] > > ) requestMap . get ( DEBUG_INFO_KEY + getClientId ( ) ) ; if ( debugInfo == null ) { debugInfo = new HashMap < String , List < Object [ ] > > ( ) ; requestMap . put ( DEBUG_INFO_KEY + getClientId ( ) , debugInfo ) ; } return debugInfo ; }
Returns the debug - info Map for this component .
24,286
private List < Object [ ] > _getFieldDebugInfos ( final String field ) { Map < String , List < Object [ ] > > debugInfo = _getDebugInfoMap ( ) ; List < Object [ ] > fieldDebugInfo = debugInfo . get ( field ) ; if ( fieldDebugInfo == null ) { fieldDebugInfo = new ArrayList < Object [ ] > ( ) ; debugInfo . put ( field , fieldDebugInfo ) ; } return fieldDebugInfo ; }
Returns the field s debug - infos from the component s debug - info Map .
24,287
private void _createFieldDebugInfo ( FacesContext facesContext , final String field , Object oldValue , Object newValue , final int skipStackTaceElements ) { if ( oldValue == null && newValue == null ) { return ; } if ( facesContext . getViewRoot ( ) == null ) { return ; } if ( getParent ( ) == null || ! isInView ( ) ) { return ; } if ( oldValue != null && oldValue . getClass ( ) . isArray ( ) && Object [ ] . class . isAssignableFrom ( oldValue . getClass ( ) ) ) { oldValue = Arrays . deepToString ( ( Object [ ] ) oldValue ) ; } if ( newValue != null && newValue . getClass ( ) . isArray ( ) && Object [ ] . class . isAssignableFrom ( newValue . getClass ( ) ) ) { newValue = Arrays . deepToString ( ( Object [ ] ) newValue ) ; } Throwable throwableHelper = new Throwable ( ) ; StackTraceElement [ ] stackTraceElements = throwableHelper . getStackTrace ( ) ; List < StackTraceElement > debugStackTraceElements = new LinkedList < StackTraceElement > ( ) ; for ( int i = skipStackTaceElements + 1 ; i < stackTraceElements . length ; i ++ ) { debugStackTraceElements . add ( stackTraceElements [ i ] ) ; if ( FacesServlet . class . getCanonicalName ( ) . equals ( stackTraceElements [ i ] . getClassName ( ) ) ) { break ; } } Object [ ] debugInfo = new Object [ 4 ] ; debugInfo [ 0 ] = facesContext . getCurrentPhaseId ( ) ; debugInfo [ 1 ] = oldValue ; debugInfo [ 2 ] = newValue ; debugInfo [ 3 ] = debugStackTraceElements ; _getFieldDebugInfos ( field ) . add ( debugInfo ) ; }
Creates the field debug - info for the given field which changed from oldValue to newValue .
24,288
@ FFDCIgnore ( IllegalStateException . class ) public URL getBundleEntry ( Bundle bundleToTest , String pathAndName ) { try { URL bundleEntry = bundleToTest . getEntry ( pathAndName ) ; if ( bundleEntry == null ) { bundleEntry = bundleToTest . getEntry ( pathAndName + "/" ) ; } return bundleEntry ; } catch ( IllegalStateException ise ) { return null ; } }
This method will return a bundle entry URL for the supplied path it will test for both a normal entry and a directory entry for it .
24,289
public boolean isRemoteQueueHighLimit ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isRemoteQueueHighLimit" ) ; boolean limited = false ; if ( _destHighMsgs != - 1 ) { limited = ( getTotalMsgCount ( ) >= _remoteQueueHighLimit ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isRemoteQueueHighLimit" , Boolean . valueOf ( limited ) ) ; return limited ; }
See defect 281311 Behaves like the isQHighLimit method call but allows an extra chunk of space for messages that have come in remotely . This is to avoid a deadlock situation .
24,290
public long countAvailablePublications ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "countAvailablePublications" ) ; int subs = destinationHandler . getSubscriptionIndex ( ) . getTotalSubscriptions ( ) ; long pubs = - 1 ; try { pubs = getStatistics ( ) . getAvailableItemCount ( ) - subs - 1 ; } catch ( MessageStoreException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.store.itemstreams.PubSubMessageItemStream.countAvailablePublications" , "1:465:1.74" , this ) ; SibTr . exception ( tc , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "countAvailablePublications" , Long . valueOf ( pubs ) ) ; return pubs ; }
Count the available publications .
24,291
public boolean removeAllItemsWithNoRefCount ( Transaction tran ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeAllItemsWithNoRefCount" , tran ) ; Item item = null ; boolean deletedItems = false ; try { deleteMessageslock . lockInterruptibly ( ) ; while ( null != ( item = findFirstMatchingItem ( new DeliveryDelayDeleteFilter ( ) ) ) ) { try { if ( item . getReferenceCount ( ) == 0 ) { item . remove ( tran , NO_LOCK_ID ) ; deletedItems = true ; } } catch ( NotInMessageStore e ) { SibTr . exception ( tc , e ) ; } } } catch ( InterruptedException e ) { SibTr . exception ( tc , e ) ; } catch ( MessageStoreException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.store.itemstreams.PubSubMessageItemStream.removeAllItemsWithNoRefCount" , "1:840:1.74" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeAllItemsWithNoRefCount" , "SIResourceException" ) ; throw new SIResourceException ( e ) ; } finally { deleteMessageslock . unlock ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeAllItemsWithNoRefCount" , Boolean . valueOf ( deletedItems ) ) ; return deletedItems ; }
Remove all the message items
24,292
private void createTables ( PersistenceServiceUnit persistenceServiceUnit ) throws Exception { LocalTransactionCurrent localTranCurrent = this . localTranCurrent ; LocalTransactionCoordinator suspendedLTC = localTranCurrent . suspend ( ) ; EmbeddableWebSphereTransactionManager tranMgr = this . tranMgr ; Transaction suspendedTran = suspendedLTC == null ? tranMgr . suspend ( ) : null ; boolean psuIsPUSI = ( persistenceServiceUnit instanceof PersistenceServiceUnitImpl ) ? true : false ; synchronized ( persistenceServiceUnit ) { try { if ( psuIsPUSI ) { ( ( PersistenceServiceUnitImpl ) persistenceServiceUnit ) . setTransactionManager ( tranMgr ) ; } persistenceServiceUnit . createTables ( ) ; } finally { if ( psuIsPUSI ) { ( ( PersistenceServiceUnitImpl ) persistenceServiceUnit ) . setTransactionManager ( null ) ; } if ( suspendedTran != null ) tranMgr . resume ( suspendedTran ) ; else if ( suspendedLTC != null ) localTranCurrent . resume ( suspendedLTC ) ; } } }
Automatic table creation .
24,293
private String getDatabaseProductName ( WSDataSource dataSource ) throws Exception { String dbProductName = dataSource . getDatabaseProductName ( ) ; if ( dbProductName == null ) { LocalTransactionCurrent localTranCurrent = this . localTranCurrent ; LocalTransactionCoordinator suspendedLTC = localTranCurrent . suspend ( ) ; EmbeddableWebSphereTransactionManager tranMgr = this . tranMgr ; Transaction suspendedTran = suspendedLTC == null ? tranMgr . suspend ( ) : null ; boolean tranStarted = false ; try { tranMgr . begin ( ) ; tranStarted = true ; Connection con = dataSource . getConnection ( ) ; try { dbProductName = con . getMetaData ( ) . getDatabaseProductName ( ) ; } finally { con . close ( ) ; } } finally { try { if ( tranStarted ) tranMgr . commit ( ) ; } finally { if ( suspendedTran != null ) tranMgr . resume ( suspendedTran ) ; else if ( suspendedLTC != null ) localTranCurrent . resume ( suspendedLTC ) ; } } } return dbProductName ; }
Obtain the database product name from the database to which the data source connects .
24,294
@ Reference ( service = AuthData . class , cardinality = ReferenceCardinality . OPTIONAL , policy = ReferencePolicy . STATIC , target = "(id=unbound)" , policyOption = ReferencePolicyOption . GREEDY ) protected void setAuthData ( ServiceReference < AuthData > ref ) { authDataRef = ref ; }
Declarative Services method for setting the service reference for the default auth data
24,295
@ Reference ( cardinality = ReferenceCardinality . OPTIONAL , policy = ReferencePolicy . STATIC , policyOption = ReferencePolicyOption . GREEDY , target = "(id=unbound)" ) protected void setNonJTADataSourceFactory ( ResourceFactory svc ) { nonJTADataSourceFactory = svc ; }
Declarative Services method for setting the resource factory for the non - transactional data source .
24,296
private ThreadContextProvider findConflictingProvider ( ThreadContextProvider provider , ClassLoader classloader ) { String conflictingType = provider . getThreadContextType ( ) ; for ( ThreadContextProvider p : ServiceLoader . load ( ThreadContextProvider . class , classloader ) ) { if ( conflictingType . equals ( p . getThreadContextType ( ) ) && ! provider . equals ( p ) ) return p ; } if ( ThreadContext . APPLICATION . equals ( conflictingType ) ) return cmProvider . applicationContextProvider ; if ( ThreadContext . CDI . equals ( conflictingType ) ) return cmProvider . cdiContextProvider ; if ( ThreadContext . SECURITY . equals ( conflictingType ) ) return cmProvider . securityContextProvider ; if ( ThreadContext . TRANSACTION . equals ( conflictingType ) ) return cmProvider . transactionContextProvider ; if ( WLMContextProvider . CLASSIFICATION . equals ( conflictingType ) ) return cmProvider . wlmContextProvider ; throw new IllegalStateException ( conflictingType ) ; }
Finds and returns the first thread context provider that provides the same thread context type as the specified provider .
24,297
< T > T getDefault ( String mpConfigPropName , T defaultValue ) { MPConfigAccessor accessor = cmProvider . mpConfigAccessor ; if ( accessor != null ) { Object mpConfig = mpConfigRef . get ( ) ; if ( mpConfig == Boolean . FALSE ) if ( ! mpConfigRef . compareAndSet ( Boolean . FALSE , mpConfig = accessor . getConfig ( ) ) ) mpConfig = mpConfigRef . get ( ) ; if ( mpConfig != null ) defaultValue = accessor . get ( mpConfig , mpConfigPropName , defaultValue ) ; } return defaultValue ; }
Obtain a default value from MicroProfile Config if available .
24,298
private static Long getUpdatedStamp ( String absPath , File file ) { String methodName = "getUpdatedStamp" ; boolean doDebug = tc . isDebugEnabled ( ) ; Long currentStamp = Long . valueOf ( file . lastModified ( ) ) ; Long newStamp ; String newStampReason = null ; synchronized ( expansionStamps ) { Long priorStamp = expansionStamps . put ( absPath , currentStamp ) ; if ( priorStamp == null ) { newStamp = currentStamp ; if ( doDebug ) { newStampReason = "First extraction; stamp [ " + currentStamp + " ]" ; } } else if ( currentStamp . longValue ( ) != priorStamp . longValue ( ) ) { newStamp = currentStamp ; if ( doDebug ) { newStampReason = "Additional extraction; old stamp [ " + priorStamp + " ] new stamp [ " + currentStamp + " ]" ; } } else { newStamp = null ; if ( doDebug ) { newStampReason = "No extraction; stamp [ " + currentStamp + " ]" ; } } } if ( doDebug ) { Tr . debug ( tc , methodName + ": " + newStampReason ) ; } return newStamp ; }
Tell if a file should be expanded by answering the updated time stamp of the file .
24,299
public static PackageIndex < Integer > createPackageIndex ( String resourceName ) { PackageIndex < Integer > packageIndex = new PackageIndex < Integer > ( ) ; BufferedReader br = null ; try { br = getLibertyTraceListReader ( resourceName ) ; addFiltersAndValuesToIndex ( br , packageIndex ) ; } catch ( IOException e ) { System . err . println ( "Unable to load " + resourceName ) ; } finally { tryToCloseReader ( br ) ; } packageIndex . compact ( ) ; return packageIndex ; }
Create the package index from the contents of the resource .