idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
24,100
protected final void unlockMessages ( final List messageList , boolean incrementDeliveryCount ) throws ResourceException { final String methodName = "unlockMessages" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messageList ) ; } if ( messageList . size ( ) > 0 ) { List listOfSIBusMessages = new ArrayList ( ) ; try { for ( int i = 0 ; i < messageList . size ( ) ; i ++ ) { listOfSIBusMessages . add ( ( ( DispatchableMessage ) messageList . get ( i ) ) . getMessage ( ) ) ; } _session . unlockSet ( getMessageHandles ( listOfSIBusMessages ) , incrementDeliveryCount ) ; } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:1200:1.73" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "UNLOCK_EXCEPTION_CWSIV0601" ) , new Object [ ] { exception , listOfSIBusMessages } , null ) , exception ) ; } catch ( final SIErrorException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:1212:1.73" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "UNLOCK_EXCEPTION_CWSIV0601" ) , new Object [ ] { exception , listOfSIBusMessages } , null ) , exception ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Unlocks a list of messages .
24,101
protected final SIBusMessage readAndDeleteMessage ( SIMessageHandle handle , SITransaction transaction ) throws ResourceException , SIMessageNotLockedException { final String methodName = "deleteMessage" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { handle , transaction } ) ; } SIBusMessage message = null ; if ( _session instanceof BifurcatedConsumerSession ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "We have a bifucated consumer session so attempting to perform readAndDelete" ) ; } SIBusMessage [ ] messageList = ( ( BifurcatedConsumerSession ) _session ) . readAndDeleteSet ( new SIMessageHandle [ ] { handle } , transaction ) ; if ( messageList . length != 1 ) { throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "MESSAGE_LIST_INCORRECT_CWSIV0607" ) , new Object [ ] { "" + messageList . length , messageList , handle , transaction } , null ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "Getting the message from the message list" ) ; } message = messageList [ 0 ] ; } catch ( SIMessageNotLockedException exception ) { throw exception ; } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:1292:1.73" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "DELETE_EXCEPTION_CWSIV0608" ) , new Object [ ] { exception , handle , transaction } , null ) , exception ) ; } catch ( final SIErrorException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:1303:1.73" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "DELETE_EXCEPTION_CWSIV0608" ) , new Object [ ] { exception , handle , transaction } , null ) , exception ) ; } } else { throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "INVALID_SESSION_CWSIV0606" ) , new Object [ ] { _session , handle , transaction , BifurcatedConsumerSession . class . getName ( ) } , null ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , message ) ; } return message ; }
Read and deletes the message under the given transaction .
24,102
protected final void deleteMessage ( SIBusMessage message , SITransaction transaction ) throws ResourceException { final String methodName = "deleteMessage" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { message , transaction } ) ; } deleteMessages ( new SIMessageHandle [ ] { message . getMessageHandle ( ) } , transaction ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Deletes the given message under the given transaction .
24,103
protected static final SIMessageHandle [ ] getMessageHandles ( final List messageList ) { final String methodName = "getMessageIds" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( TRACE , methodName , messageList ) ; } final SIMessageHandle [ ] msgHandles = new SIMessageHandle [ messageList . size ( ) ] ; for ( int i = 0 ; i < messageList . size ( ) ; i ++ ) { SIBusMessage message = ( SIBusMessage ) messageList . get ( i ) ; msgHandles [ i ] = message . getMessageHandle ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName , msgHandles ) ; } return msgHandles ; }
Returns an array of message handles for the given list of messages .
24,104
protected void increaseRetryCount ( final SIMessageHandle msgHandle ) { final String methodName = "increaseRetryCount" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } try { SIUncoordinatedTransaction localTran = _connection . createUncoordinatedTransaction ( ) ; deleteMessages ( new SIMessageHandle [ ] { msgHandle } , localTran ) ; localTran . rollback ( ) ; } catch ( Exception exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:1547:1.73" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
This method is used as a workaround to increase the retry count on a message . The better solution is to allow us to unlock a message passing in a parameter which states if we wish to increase the retry count or not
24,105
public void performRecovery ( ObjectManagerState objectManagerState ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "performRecovery" , objectManagerState ) ; ObjectManagerState recoveredObjectManagerState = ( ObjectManagerState ) ManagedObject . restoreFromSerializedBytes ( objectManagerStateBytes , objectManagerState ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isDebugEnabled ( ) ) trace . debug ( this , cclass , "recoveredObjectManagerState=" + recoveredObjectManagerState + "(ObjectManagerState)" ) ; objectManagerStateToken . setManagedObject ( recoveredObjectManagerState ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "performRecovery" ) ; }
Called to perform any recovery action during a warm start of the ObjectManager .
24,106
public boolean isLinkCellule ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isLinkCellule" ) ; boolean rc = ( this instanceof LinkCellule ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isLinkCellule" , Boolean . valueOf ( rc ) ) ; return rc ; }
Test the current Cellule object to see if it is a LinkCellule
24,107
public boolean isMessagingEngine ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isMessagingEngine" ) ; boolean rc = ( this instanceof MessagingEngine ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isMessagingEngine" , Boolean . valueOf ( rc ) ) ; return rc ; }
Test the current Cellule object to see if it is a MessagingEngine
24,108
public static < T > void verify ( Vertex < T > vertex ) throws CyclicDependencyException { List < Vertex < T > > vertices = new ArrayList < Vertex < T > > ( ) ; addDependencies ( vertex , vertices ) ; verify ( vertices ) ; }
Verify that a vertex and its set of dependencies have no cycles .
24,109
private static < T > void addDependencies ( final Vertex < T > vertex , final List < Vertex < T > > vertices ) { if ( ! vertices . contains ( vertex ) ) { vertices . add ( vertex ) ; for ( Vertex < T > v : vertex . getDependencies ( ) ) { addDependencies ( v , vertices ) ; } } }
Recursively add a vertex and all of its dependencies to a list of vertices
24,110
public static < T > void verify ( List < Vertex < T > > vertices ) throws CyclicDependencyException { resetVertices ( vertices ) ; Iterator < Vertex < T > > it = vertices . iterator ( ) ; while ( it . hasNext ( ) ) { Vertex < T > v = it . next ( ) ; Iterator < Vertex < T > > dit = v . getDependencies ( ) . iterator ( ) ; while ( dit . hasNext ( ) ) { Vertex < T > dv = dit . next ( ) ; if ( ! vertices . contains ( dv ) ) { throw new IllegalStateException ( "A dependent vertex (" + dv . getName ( ) + ") of " + "vertex (" + v . getName ( ) + ") was not included in the vertices list." ) ; } } v . resolveOrder ( ) ; } }
Verify a set of vertices and all their dependencies have no cycles . All Vertices in the graph must exist in the list .
24,111
public static < T > void topologicalSort ( final List < Vertex < T > > vertices ) throws CyclicDependencyException { verify ( vertices ) ; Collections . sort ( vertices ) ; }
Sort a set of vertices so that no dependency is before its vertex . If we have a vertex named Parent and one named Child that is listed as a dependency of Parent we want to ensure that Child always comes after Parent . As long as there are no cycles in the list we can sort any number of vertices that may or may not be related . Both Parent and Child must exist in the vertices list but Child will also be referenced as a dependency of Parent .
24,112
public static < T > void resetVertices ( List < Vertex < T > > vertices ) { Iterator < Vertex < T > > it = vertices . iterator ( ) ; while ( it . hasNext ( ) ) { it . next ( ) . reset ( ) ; } }
Resets all the vertices so that the visitation flags and indegrees are reset to their start values .
24,113
public List < String > getSupportedProperties ( String inEntityTypes , List < String > propNames ) throws EntityTypeNotSupportedException { List < String > prop = null ; Set < String > s = null ; if ( propNames != null && propNames . size ( ) > 0 ) { if ( inEntityTypes == null ) { return propNames ; } prop = new ArrayList < String > ( ) ; if ( inEntityTypes . equals ( SchemaConstants . DO_ENTITY ) ) { s = new HashSet < String > ( ) ; List < LdapEntity > ldapEntities = getAllLdapEntities ( inEntityTypes ) ; List < String > tmpProp = null ; for ( int i = 0 ; i < ldapEntities . size ( ) ; i ++ ) { tmpProp = getSupportedProperties ( ldapEntities . get ( i ) , propNames ) ; s . addAll ( tmpProp ) ; } prop . addAll ( s ) ; } else { LdapEntity ldapEntity = getLdapEntity ( inEntityTypes ) ; if ( ldapEntity == null ) { throw new EntityTypeNotSupportedException ( WIMMessageKey . ENTITY_TYPE_NOT_SUPPORTED , Tr . formatMessage ( tc , WIMMessageKey . ENTITY_TYPE_NOT_SUPPORTED , WIMMessageHelper . generateMsgParms ( inEntityTypes ) ) ) ; } prop = getSupportedProperties ( ldapEntity , propNames ) ; } } return prop ; }
Return the sub - list of properties for the given entity supported by this repository from a given list of properties .
24,114
public List < LdapEntity > getAllLdapEntities ( String qualifiedType ) { List < LdapEntity > entityTypes = new ArrayList < LdapEntity > ( ) ; if ( qualifiedType != null ) { for ( int i = 0 ; i < iLdapEntityTypeList . size ( ) ; i ++ ) { String entityType = iLdapEntityTypeList . get ( i ) ; if ( entityType != null && entityType . equals ( qualifiedType ) ) { entityTypes . add ( iLdapEntities . get ( i ) ) ; } } if ( entityTypes . size ( ) != 0 ) { return entityTypes ; } else { for ( int j = 0 ; j < iLdapEntityTypeList . size ( ) ; j ++ ) { String entityType = iLdapEntityTypeList . get ( j ) ; if ( qualifiedType . equalsIgnoreCase ( entityType ) || ( Entity . getSubEntityTypes ( qualifiedType ) != null && Entity . getSubEntityTypes ( qualifiedType ) . contains ( entityType ) ) ) { entityTypes . add ( iLdapEntities . get ( j ) ) ; } } if ( entityTypes . size ( ) != 0 ) return entityTypes ; } } return entityTypes ; }
The method returns the list of VMM entity types based on the qualifiedType read from the data graph . The qualifiedType is first compared with the defined VMM entity types . If a match is not found it then determines if qualifiedType is a parent entity of defined entity types .
24,115
public String getGroupMemberFilter ( String groupMemberDN ) { groupMemberDN = escapeSpecialCharacters ( groupMemberDN ) ; Object [ ] args = { groupMemberDN } ; return new MessageFormat ( iGrpMbrFilter ) . format ( args ) ; }
Gets the LDAP filter expression for search groups a member belongs to .
24,116
private static void _searchFromURL ( Set < URL > result , String prefix , String suffix , URL url ) throws IOException { boolean done = false ; InputStream is = _getInputStream ( url ) ; if ( is != null ) { try { ZipInputStream zis ; if ( is instanceof ZipInputStream ) { zis = ( ZipInputStream ) is ; } else { zis = new ZipInputStream ( is ) ; } try { ZipEntry entry = zis . getNextEntry ( ) ; done = entry != null ; while ( entry != null ) { String entryName = entry . getName ( ) ; if ( entryName . endsWith ( suffix ) ) { result . add ( new URL ( url . toExternalForm ( ) + entryName ) ) ; } entry = zis . getNextEntry ( ) ; } } finally { zis . close ( ) ; } } catch ( Exception ignore ) { } } if ( ! done && prefix . length ( ) > 0 ) { String urlString = url . toExternalForm ( ) + "/" ; String [ ] split = prefix . split ( "/" ) ; prefix = _join ( split , true ) ; String end = _join ( split , false ) ; urlString = urlString . substring ( 0 , urlString . lastIndexOf ( end ) ) ; if ( isExcludedPrefix ( urlString ) ) { return ; } url = new URL ( urlString ) ; _searchFromURL ( result , prefix , suffix , url ) ; } }
Search from URL . Fall back on prefix tokens if not able to read from original url param .
24,117
private static String _join ( String [ ] tokens , boolean excludeLast ) { StringBuilder join = new StringBuilder ( ) ; int length = tokens . length - ( excludeLast ? 1 : 0 ) ; for ( int i = 0 ; i < length ; i ++ ) { join . append ( tokens [ i ] ) . append ( "/" ) ; } return join . toString ( ) ; }
Join tokens exlude last if param equals true .
24,118
private static JarFile _getAlternativeJarFile ( URL url ) throws IOException { String urlFile = url . getFile ( ) ; int wlIndex = urlFile . indexOf ( "!/" ) ; int oc4jIndex = urlFile . indexOf ( '!' ) ; int separatorIndex = wlIndex == - 1 && oc4jIndex == - 1 ? - 1 : wlIndex < oc4jIndex ? wlIndex : oc4jIndex ; if ( separatorIndex != - 1 ) { String jarFileUrl = urlFile . substring ( 0 , separatorIndex ) ; if ( jarFileUrl . startsWith ( "file:" ) ) { jarFileUrl = jarFileUrl . substring ( "file:" . length ( ) ) ; } jarFileUrl = decodeFilesystemUrl ( jarFileUrl ) ; if ( isExcludedPrefix ( jarFileUrl ) || isExcludedSuffix ( jarFileUrl ) ) { return null ; } return new JarFile ( jarFileUrl ) ; } return null ; }
For URLs to JARs that do not use JarURLConnection - allowed by the servlet spec - attempt to produce a JarFile object all the same . Known servlet engines that function like this include Weblogic and OC4J . This is not a full solution since an unpacked WAR or EAR will not have JAR files as such .
24,119
protected void initializeNewEngineComponent ( JsEngineComponent engineComponent ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "initializeNewEngineComponent" , engineComponent ) ; } synchronized ( stateChangeLock ) { if ( _state != STATE_UNINITIALIZED && _state != STATE_DESTROYED ) { engineComponent . initialize ( this ) ; engineComponent . setConfig ( this ) ; } if ( _state == STATE_STARTING || _state == STATE_STARTED ) { int mode = JsConstants . ME_START_DEFAULT ; if ( _mainImpl . isServerInRecoveryMode ( ) == true ) { mode += JsConstants . ME_START_RECOVERY ; } engineComponent . start ( mode ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "initializeNewEngineComponent" ) ; } }
Move state of new component to current engine state
24,120
protected void destroyOldEngineComponent ( ComponentList component ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "destroyOldEngineComponent" , component ) ; } boolean removed = jmeComponents . remove ( component ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "destroyOldEngineComponent, component removed from jmeComponents?" , removed ) ; } JsEngineComponent engineComponent = component . getRef ( ) ; if ( _state == STATE_STARTING || _state == STATE_STARTED || _state == STATE_STOPPING || _state == STATE_STOPPING_MEMBER || _state == STATE_FAILED ) { engineComponent . stop ( JsConstants . ME_STOP_IMMEDIATE ) ; } if ( _state != STATE_UNINITIALIZED && _state != STATE_DESTROYED ) { engineComponent . destroy ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "destroyOldEngineComponent" ) ; } }
Destroy an engine component that is to be deleted
24,121
public static void printFullStackTrace ( PrintWriter out , ServletException e ) { Throwable th = null ; while ( e != null ) { th = e . getRootCause ( ) ; if ( th == null ) { th = e ; break ; } else e = th instanceof ServletException ? ( ServletException ) th : null ; } try { if ( th instanceof ServletErrorReport ) out . println ( "<HR width=\"100%\">\n" + th . getMessage ( ) + "<BR>" ) ; else out . println ( "<HR width=\"100%\">\n" + encodeChars ( th . getMessage ( ) ) + "<BR>" ) ; StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; th . printStackTrace ( pw ) ; pw . flush ( ) ; String traceOut ; if ( th instanceof ServletErrorReport ) traceOut = sw . toString ( ) ; else traceOut = encodeChars ( sw . toString ( ) ) ; StringTokenizer st = new StringTokenizer ( traceOut , "\n" ) ; while ( st . hasMoreTokens ( ) ) { out . println ( st . nextToken ( ) ) ; out . println ( "<BR>&nbsp;&nbsp;&nbsp;&nbsp;" ) ; } out . println ( "<BR>" ) ; } catch ( EmptyStackException ex ) { com . ibm . wsspi . webcontainer . util . FFDCWrapper . processException ( ex , "com.ibm.ws.webcontainer.servlet.DefaultErrorReporter.printFullStackTrace" , "158" ) ; } }
method rewritten for defect 105840
24,122
public static String encodeChars ( String iString ) { if ( iString == null ) return "" ; int strLen = iString . length ( ) , i ; if ( strLen < 1 ) return iString ; StringBuffer retString = new StringBuffer ( strLen * 2 ) ; for ( i = 0 ; i < strLen ; i ++ ) { switch ( iString . charAt ( i ) ) { case '<' : retString . append ( "&lt;" ) ; break ; case '>' : retString . append ( "&gt;" ) ; break ; case '&' : retString . append ( "&amp;" ) ; break ; case '\"' : retString . append ( "&quot;" ) ; break ; case '+' : retString . append ( "&#43;" ) ; break ; case '(' : retString . append ( "&#40;" ) ; break ; case ')' : retString . append ( "&#41;" ) ; break ; case '\'' : retString . append ( "&#39;" ) ; break ; case '%' : retString . append ( "&#37;" ) ; break ; case ';' : retString . append ( "&#59;" ) ; break ; default : retString . append ( iString . charAt ( i ) ) ; break ; } } return retString . toString ( ) ; }
96236 - this method was added for defect 96236
24,123
SocketIOChannel getConnection ( TCPConnectRequestContext connectContext , TCPConnLink tcpConnLink , SimpleSync blocking ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getConnection for local: " + connectContext . getLocalAddress ( ) + ", remote: " + connectContext . getRemoteAddress ( ) + ", timeout: " + connectContext . getConnectTimeout ( ) ) ; } SocketIOChannel ioSocket = create ( connectContext . getLocalAddress ( ) , tcpConnLink ) ; tcpConnLink . setSocketIOChannel ( ioSocket ) ; boolean isConnected = ioSocket . connect ( connectContext . getRemoteAddress ( ) ) ; if ( isConnected ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "obtained connection without queuing to selector" ) ; } tcpConnLink . setCallCompleteLocal ( true ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getConnection" ) ; } return ioSocket ; } ConnectInfo ci = new ConnectInfo ( connectContext , tcpConnLink , ioSocket ) ; ci . timeout = connectContext . getConnectTimeout ( ) ; if ( blocking != null ) { ci . setSyncObject ( blocking ) ; } ci . setFinish ( ) ; workQueueMgr . queueConnectForSelector ( ci ) ; if ( blocking != null ) { boolean connectDone = false ; while ( ! connectDone ) { blocking . simpleWait ( ) ; connectDone = workQueueMgr . attemptConnectWork ( ci ) ; } if ( ci . getAction ( ) == ConnectInfo . FINISH_COMPLETE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getConnection" ) ; } return ioSocket ; } if ( ci . getError ( ) == null ) { InetSocketAddress iaRemote = ci . remoteAddress ; InetSocketAddress iaLocal = ci . localAddress ; ci . setError ( new IOException ( "Connection could not be established. local=" + iaLocal + " remote=" + iaRemote ) ) ; } throw ci . getError ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getConnection" ) ; } return null ; }
Get a connection .
24,124
private SocketIOChannel create ( InetSocketAddress localAddress , TCPConnLink tcpConnLink ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "create" ) ; } SocketIOChannel ioSocket = tcpChannel . createOutboundSocketIOChannel ( ) ; Socket socket = ioSocket . getSocket ( ) ; TCPChannelConfiguration tcpConfig = this . tcpChannel . getConfig ( ) ; socket . setReuseAddress ( tcpConfig . getSoReuseAddress ( ) ) ; if ( ( tcpConfig . getReceiveBufferSize ( ) >= RECEIVE_BUFFER_SIZE_MIN ) && ( tcpConfig . getReceiveBufferSize ( ) <= RECEIVE_BUFFER_SIZE_MAX ) ) { socket . setReceiveBufferSize ( tcpConfig . getReceiveBufferSize ( ) ) ; } if ( ( tcpConfig . getSendBufferSize ( ) >= SEND_BUFFER_SIZE_MIN ) && ( tcpConfig . getSendBufferSize ( ) <= SEND_BUFFER_SIZE_MAX ) ) { socket . setSendBufferSize ( tcpConfig . getSendBufferSize ( ) ) ; } if ( localAddress != null ) { try { socket . bind ( localAddress ) ; InetAddress ia = localAddress . getAddress ( ) ; if ( ia != null ) { ConnectionDescriptor cd = tcpConnLink . getVirtualConnection ( ) . getConnectionDescriptor ( ) ; if ( cd != null ) { cd . setAddrs ( null , ia ) ; } else { ConnectionDescriptorImpl cdi = new ConnectionDescriptorImpl ( null , ia ) ; tcpConnLink . getVirtualConnection ( ) . setConnectionDescriptor ( cdi ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "bound connection: " + tcpConnLink . getVirtualConnection ( ) . getConnectionDescriptor ( ) ) ; } } } catch ( IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Bind error making outbound connection " + ioe ) ; } if ( socket != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Socket closed on bind exception." ) ; } socket . close ( ) ; } FFDCFilter . processException ( ioe , getClass ( ) . getName ( ) , "create" , this ) ; throw ioe ; } } if ( tcpConfig . getSoLinger ( ) >= 0 ) { socket . setSoLinger ( true , tcpConfig . getSoLinger ( ) ) ; } else { socket . setSoLinger ( false , 0 ) ; } socket . setKeepAlive ( tcpConfig . getKeepAlive ( ) ) ; socket . setTcpNoDelay ( tcpConfig . getTcpNoDelay ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Socket created, local port: " + socket . getLocalPort ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "create" ) ; } return ioSocket ; }
Do the real work of creating and configuring the SocketIOChannel .
24,125
private void removeServiceListeners ( String id ) { final ServiceListener [ ] listeners = serviceListeners . remove ( id ) ; if ( listeners != null ) for ( ServiceListener listener : listeners ) if ( listener != null ) { lock . readLock ( ) . lock ( ) ; try { if ( bundleContext != null ) bundleContext . removeServiceListener ( listener ) ; } finally { lock . readLock ( ) . unlock ( ) ; } } }
Unregister listeners for configurations processed by the metatype provider
24,126
public void stopModule ( ExtendedModuleInfo moduleInfo ) { ConnectorModuleMetaDataImpl metadataImpl = ( ConnectorModuleMetaDataImpl ) moduleInfo . getMetaData ( ) ; String id = metadataImpl . getIdentifier ( ) ; metaDataService . fireComponentMetaDataDestroyed ( metadataImpl . getComponentMetaDatas ( ) [ 0 ] ) ; removeServiceListeners ( id ) ; CountDownLatch bcLatch = BootstrapContextImpl . latches . get ( id ) ; ConnectorModuleMetatype cmmt = moduleMetatype . remove ( id . toUpperCase ( ) ) ; if ( cmmt != null ) try { cmmt . removeMetatype ( ) ; } catch ( Throwable x ) { } for ( boolean stopped = bcLatch == null || FrameworkState . isStopping ( ) ; ! stopped ; ) try { stopped = bcLatch . await ( 1 , TimeUnit . SECONDS ) || FrameworkState . isStopping ( ) ; } catch ( InterruptedException e ) { e . getCause ( ) ; } }
Removes all generated metatype for the resource adapter and returns once services provided by the resource adapter are deactivated
24,127
public synchronized void add ( GenericKeys key ) { KeyBucket bucket = makeBucket ( key . getName ( ) . charAt ( 0 ) ) ; if ( null != bucket ) { bucket . add ( key ) ; } }
Add a new enumerated object to the matcher .
24,128
public GenericKeys match ( String name , int start , int length ) { if ( null == name || 0 == name . length ( ) || start < 0 || length > name . length ( ) ) { return null ; } KeyBucket bucket = getBucket ( name . charAt ( start ) ) ; if ( null != bucket ) { return bucket . match ( name , start , length ) ; } return null ; }
Compare the input value against the stored list of objects and return a match if found .
24,129
public Thread newThread ( final Runnable runnable ) { int threadId = createdThreadCount . incrementAndGet ( ) ; final String name = executorName + "-thread-" + threadId ; return AccessController . doPrivileged ( new PrivilegedAction < Thread > ( ) { public Thread run ( ) { final Thread thread ; if ( TRACE_ENABLED_AT_STARTUP ) { thread = new LibertyThread ( threadGroup , runnable , name ) ; } else { thread = new Thread ( threadGroup , runnable , name ) ; } thread . setDaemon ( true ) ; thread . setPriority ( Thread . NORM_PRIORITY ) ; thread . setContextClassLoader ( contextClassLoader ) ; return thread ; } } ) ; }
Create a new thread .
24,130
public void debug ( Object message , Throwable exception ) { log ( Level . FINE , String . valueOf ( message ) , exception ) ; }
Log a message and exception with debug log level .
24,131
public void error ( Object message ) { log ( Level . SEVERE , String . valueOf ( message ) , null ) ; }
Log a message with error log level .
24,132
public void error ( Object message , Throwable exception ) { log ( Level . SEVERE , String . valueOf ( message ) , exception ) ; }
Log a message and exception with error log level .
24,133
public void info ( Object message , Throwable exception ) { log ( Level . INFO , String . valueOf ( message ) , exception ) ; }
Log a message and exception with info log level .
24,134
public void trace ( Object message ) { log ( Level . FINEST , String . valueOf ( message ) , null ) ; }
Log a message with trace log level .
24,135
public void trace ( Object message , Throwable exception ) { log ( Level . FINEST , String . valueOf ( message ) , exception ) ; }
Log a message and exception with trace log level .
24,136
public void warn ( Object message , Throwable exception ) { log ( Level . WARNING , String . valueOf ( message ) , exception ) ; }
Log a message and exception with warn log level .
24,137
private Map < String , String > getConfigVariables ( ) { return AccessController . doPrivileged ( new PrivilegedAction < Map < String , String > > ( ) { public Map < String , String > run ( ) { return configVariables . getUserDefinedVariables ( ) ; } } ) ; }
Get the Config variables in a doPrivileged block .
24,138
public static InputStream getUrlAsStream ( URL url , String acceptValue ) throws IOException { HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; connection . setRequestMethod ( "GET" ) ; if ( acceptValue != null && ! acceptValue . trim ( ) . isEmpty ( ) ) { connection . setRequestProperty ( "Accept" , acceptValue ) ; } final int responseCode = connection . getResponseCode ( ) ; if ( responseCode == HttpURLConnection . HTTP_OK ) { return connection . getInputStream ( ) ; } else { if ( isEventEnabled ( tc ) ) { Tr . event ( tc , "Did not find resource at " + url + ". ResponseCode: " + responseCode ) ; } } return null ; }
Get the resource at the specified URL as an InputStream
24,139
public static String mapToString ( Map < String , ? > map ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "{\n" ) ; for ( String key : map . keySet ( ) ) { if ( map . get ( key ) != null ) { sb . append ( key + ": " + map . get ( key ) + "\n " ) ; } else { continue ; } } sb . append ( "}" ) ; return sb . toString ( ) ; }
Print map to string
24,140
void force ( ) throws ObjectManagerException { final String methodName = "force" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName ) ; try { storeChannel . force ( false ) ; } catch ( java . io . IOException exception ) { ObjectManager . ffdc . processException ( this , cclass , methodName , exception , "1:923:1.39" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; objectManagerState . requestShutdown ( ) ; throw new PermanentIOException ( this , exception ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Force updates to disk .
24,141
private void encodeTextBody ( StringBuffer result , JsJmsTextMessage msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "encodeTextBody" ) ; try { String body = msg . getText ( ) ; if ( body != null ) { result . append ( '~' ) ; URLEncode ( result , body ) ; } } catch ( UnsupportedEncodingException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageEncoderImpl.encodeTextBody" , "193" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "encodeTextBody" ) ; }
Encode a text message body
24,142
private void encodeBytesBody ( StringBuffer result , JsJmsBytesMessage msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "encodeBytesBody" ) ; byte [ ] body = msg . getBytes ( ) ; if ( body != null ) { result . append ( '~' ) ; HexString . binToHex ( body , 0 , body . length , result ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "encodeBytesBody" ) ; }
Encode a bytes message body
24,143
private void encodeObjectBody ( StringBuffer result , JsJmsObjectMessage msg ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "encodeObjectBody" ) ; try { byte [ ] body = msg . getSerializedObject ( ) ; if ( body != null ) { result . append ( '~' ) ; HexString . binToHex ( body , 0 , body . length , result ) ; } } catch ( ObjectFailedToSerializeException ofse ) { FFDCFilter . processException ( ofse , "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageEncoderImpl.encodeObjectBody" , "225" ) ; throw new MessageEncodeFailedException ( ofse ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "encodeObjectBody" ) ; }
Encode an object message body
24,144
private void encodeStreamBody ( StringBuffer result , JsJmsStreamMessage msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "encodeStreamBody" ) ; try { List < Object > body = ( ( JsJmsStreamMessageImpl ) msg ) . getBodyList ( ) ; if ( body . size ( ) > 0 ) { result . append ( '~' ) ; for ( int i = 0 ; i < body . size ( ) ; i ++ ) { encodeObject ( result , body . get ( i ) ) ; if ( i < body . size ( ) - 1 ) result . append ( '&' ) ; } } } catch ( UnsupportedEncodingException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageEncoderImpl.encodeStreamBody" , "245" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "encodeStreamBody" ) ; }
Encode a stream message body
24,145
private void encodeMapBody ( StringBuffer result , JsJmsMapMessage msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "encodeMapBody" ) ; try { Map < String , Object > body = ( ( JsJmsMapMessageImpl ) msg ) . getBodyMap ( ) ; if ( body . size ( ) > 0 ) { result . append ( '~' ) ; Set < Map . Entry < String , Object > > entries = body . entrySet ( ) ; boolean first = true ; for ( Iterator < Map . Entry < String , Object > > i = entries . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry < String , Object > entry = i . next ( ) ; encodePair ( result , entry . getKey ( ) , entry . getValue ( ) , first ) ; first = false ; } } } catch ( UnsupportedEncodingException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageEncoderImpl.encodeMapBody" , "269" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "encodeMapBody" ) ; }
Encode a map message
24,146
private void encodePair ( StringBuffer result , String name , Object value , boolean first ) { if ( ! first ) result . append ( '&' ) ; URLEncode ( result , name ) ; result . append ( '=' ) ; encodeObject ( result , value ) ; }
Encode a name = value pair
24,147
private void encodeObject ( StringBuffer result , Object value ) { if ( value != null ) { if ( value instanceof byte [ ] ) { result . append ( "[]" ) ; HexString . binToHex ( ( byte [ ] ) value , 0 , ( ( byte [ ] ) value ) . length , result ) ; } else URLEncode ( result , value . toString ( ) ) ; } }
Encode an arbitrary value
24,148
public void registerPort ( TCPPort endPoint ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "registerPort: " + endPoint . getServerSocket ( ) ) ; } synchronized ( this ) { EndPointActionInfo work = new EndPointActionInfo ( REGISTER_ENDPOINT , endPoint , workSync ) ; if ( ( ! dedicatedAcceptThread ) && ( ! waitToAccept ) ) { if ( sharedAccept == null ) { sharedAccept = new NBAcceptChannelSelector ( waitToAccept ) ; sharedThread = new Thread ( sharedAccept ) ; sharedThread . setName ( "Shared TCPChannel NonBlocking Accept Thread" ) ; sharedThread . setDaemon ( true ) ; sharedThread . start ( ) ; } synchronized ( workSync ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Passing register to selector; " + endPoint . getServerSocket ( ) ) ; } try { sharedAccept . addWork ( work ) ; workSync . wait ( ) ; } catch ( InterruptedException x ) { } } endPointToAccept . put ( endPoint , sharedAccept ) ; } else { NBAcceptChannelSelector dedicatedAccept = new NBAcceptChannelSelector ( waitToAccept ) ; Thread dedicatedThread = new Thread ( dedicatedAccept ) ; dedicatedThread . setName ( "Dedicated TCPChannel NonBlocking Accept Thread:" + endPoint . getListenPort ( ) ) ; dedicatedThread . setDaemon ( true ) ; dedicatedThread . start ( ) ; synchronized ( workSync ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Passing register to dedicated selector; " + endPoint . getServerSocket ( ) ) ; } try { dedicatedAccept . addWork ( work ) ; workSync . wait ( ) ; } catch ( InterruptedException x ) { } } endPointToAccept . put ( endPoint , dedicatedAccept ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "registerPort" ) ; } }
Register an end point with this request processor . This creates a listener socket for the end point and puts it into the selector so that connections are accepted .
24,149
public void removePort ( TCPPort endPoint ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "removePort: " + endPoint . getServerSocket ( ) ) ; } synchronized ( this ) { NBAcceptChannelSelector accept = endPointToAccept . get ( endPoint ) ; if ( accept != null ) { if ( 3100 <= accept . numExceptions ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Ignoring removePort call on fatal selector/system.exit path" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removePort" ) ; } return ; } EndPointActionInfo work = new EndPointActionInfo ( REMOVE_ENDPOINT , endPoint , workSync ) ; synchronized ( workSync ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Passing remove to selector; " + endPoint . getServerSocket ( ) ) ; } accept . addWork ( work ) ; try { workSync . wait ( ) ; } catch ( InterruptedException x ) { } } if ( accept == sharedAccept && accept . getUsageCount ( ) <= 0 ) { sharedAccept = null ; } } else { IllegalArgumentException iae = new IllegalArgumentException ( "TCP Port to be removed is not registered." ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Throwing IllegalArgumentException" ) ; } FFDCFilter . processException ( iae , CLASS_NAME + ".removePort" , "387" , this ) ; throw iae ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removePort" ) ; } }
Removes an end point from the set of end points that we are accepting connections on . This has the effect of removing the server socket from the selector and closing it .
24,150
@ SuppressWarnings ( "unchecked" ) private boolean isClassTrivial ( ClassTraceInfo info ) { AnnotationNode trivialAnnotation = getAnnotation ( TRIVIAL_TYPE . getDescriptor ( ) , info . classNode . visibleAnnotations ) ; if ( trivialAnnotation != null ) { return true ; } return false ; }
Determine if the class is &quot ; trivial&quot ; .
24,151
@ SuppressWarnings ( "unchecked" ) private boolean isMethodAlreadyInjectedAnnotationPresent ( MethodNode methodNode ) { AnnotationNode injectedTraceAnnotation = getAnnotation ( INJECTED_TRACE_TYPE . getDescriptor ( ) , methodNode . visibleAnnotations ) ; AnnotationNode manualTraceAnnotation = getAnnotation ( MANUAL_TRACE_TYPE . getDescriptor ( ) , methodNode . visibleAnnotations ) ; if ( manualTraceAnnotation != null ) return true ; if ( injectedTraceAnnotation != null ) { InjectedTraceAnnotationVisitor itav = new InjectedTraceAnnotationVisitor ( ) ; injectedTraceAnnotation . accept ( itav ) ; List < String > methodAdapters = itav . getMethodAdapters ( ) ; if ( methodAdapters . contains ( LibertyTracingMethodAdapter . class . getName ( ) ) ) { return true ; } if ( methodAdapters . contains ( WebSphereTrTracingMethodAdapter . class . getName ( ) ) ) { return true ; } if ( methodAdapters . contains ( JSR47TracingMethodAdapter . class . getName ( ) ) ) { return true ; } } return false ; }
Check if the specified method has already been annotated as processed by the trace injection framework .
24,152
public void processArguments ( String [ ] args ) throws IOException { List < File > classFiles = new ArrayList < File > ( ) ; List < File > jarFiles = new ArrayList < File > ( ) ; String [ ] fileArgs = null ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equalsIgnoreCase ( "--debug" ) || args [ i ] . equals ( "-d" ) ) { setDebug ( true ) ; } else if ( args [ i ] . equalsIgnoreCase ( "--config" ) ) { File configFile = new File ( args [ ++ i ] ) ; System . out . println ( "Config file not currently supported" + configFile ) ; } else if ( args [ i ] . equalsIgnoreCase ( "--ffdc" ) ) { addFfdc = true ; } else if ( args [ i ] . equalsIgnoreCase ( "--static" ) ) { injectStatic = true ; } else if ( args [ i ] . equalsIgnoreCase ( "--liberty" ) ) { defaultTraceType = TraceType . LIBERTY ; } else if ( args [ i ] . equalsIgnoreCase ( "--tr" ) ) { defaultTraceType = TraceType . TR ; } else if ( args [ i ] . equalsIgnoreCase ( "--java-logging" ) ) { defaultTraceType = TraceType . JAVA_LOGGING ; } else { fileArgs = new String [ args . length - i ] ; System . arraycopy ( args , i , fileArgs , 0 , fileArgs . length ) ; break ; } } if ( fileArgs == null || fileArgs . length == 0 ) { throw new IllegalArgumentException ( "No file specified" ) ; } for ( int i = 0 ; i < fileArgs . length ; i ++ ) { File f = new File ( fileArgs [ i ] ) ; if ( ! f . exists ( ) ) { throw new IllegalArgumentException ( "File \"" + f + "\" does not exist" ) ; } else if ( f . isDirectory ( ) ) { classFiles . addAll ( getClassFiles ( f , null ) ) ; jarFiles . addAll ( getJarFiles ( f , null ) ) ; } else if ( f . getName ( ) . endsWith ( ".class" ) ) { classFiles . add ( f ) ; } else if ( f . getName ( ) . endsWith ( ".jar" ) ) { jarFiles . add ( f ) ; } else if ( f . getName ( ) . endsWith ( ".zip" ) ) { jarFiles . add ( f ) ; } else { System . err . println ( f + " is an unexpected file type; ignoring" ) ; } } setClassFiles ( classFiles ) ; setJarFiles ( jarFiles ) ; }
Process the command line arguments for the tool
24,153
public long identity ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "identity" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "identity" , new Long ( _identity ) ) ; return _identity ; }
Returns the identity of this recoverable unit .
24,154
protected void payloadAdded ( int unwrittenPayloadSize , int totalPayloadSize ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "payloadAdded" , new Object [ ] { this , new Integer ( unwrittenPayloadSize ) , new Integer ( totalPayloadSize ) } ) ; _payloadAdded = true ; int unwrittenRecLogAdjustment = unwrittenPayloadSize ; int totalRecLogAdjustment = totalPayloadSize ; if ( _unwrittenDataSize == 0 ) { unwrittenRecLogAdjustment += _totalHeaderSize ; } if ( _totalDataSize == 0 ) { totalRecLogAdjustment += _totalHeaderSize ; } _unwrittenDataSize += unwrittenPayloadSize ; _totalDataSize += totalPayloadSize ; _recLog . payloadAdded ( unwrittenRecLogAdjustment , totalRecLogAdjustment ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unwrittenDataSize = " + _unwrittenDataSize + " totalDataSize = " + _totalDataSize ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "payloadAdded" ) ; }
Informs the recoverable unit that data has been added to one of its recoverable unit sections . The recoverable unit must use the supplied information to track the amount of active data that it holds . This information must be passed to its parent recovery log in order that it may track the amount of active data in the entire recovery log .
24,155
protected void payloadWritten ( int payloadSize ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "payloadWritten" , new Object [ ] { this , new Integer ( payloadSize ) } ) ; _unwrittenDataSize -= payloadSize ; if ( _unwrittenDataSize == 0 ) { _recLog . payloadWritten ( payloadSize + _totalHeaderSize ) ; } else { _recLog . payloadWritten ( payloadSize ) ; } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unwrittenDataSize = " + _unwrittenDataSize + " totalDataSize = " + _totalDataSize ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "payloadWritten" ) ; }
Informs the recoverable unit that previously unwritten data has been written to disk by one of its recoverable unit sections and no longer needs to be tracked in the unwritten data field . The recovery log must use the supplied information to track the amount of unwritten active data it holds . This information must be passed to its parent recovery log in order that it may track the amount of unwritten data in the entire recovery log .
24,156
protected void payloadDeleted ( int totalPayloadSize , int unwrittenPayloadSize ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "payloadDeleted" , new Object [ ] { this , new Integer ( totalPayloadSize ) , new Integer ( unwrittenPayloadSize ) } ) ; _totalDataSize -= totalPayloadSize ; _unwrittenDataSize -= unwrittenPayloadSize ; if ( _unwrittenDataSize == 0 && ( unwrittenPayloadSize != 0 ) ) { unwrittenPayloadSize += _totalHeaderSize ; } if ( _totalDataSize == 0 ) { totalPayloadSize += _totalHeaderSize ; } _recLog . payloadDeleted ( totalPayloadSize , unwrittenPayloadSize ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unwrittenDataSize = " + _unwrittenDataSize + " totalDataSize = " + _totalDataSize ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "payloadDeleted" ) ; }
Informs the recoverable unit that data has been removed from one of its recoverable unit sections . At present this method is only invoked as a result of the SingleDataItem class removing existing payload before adding back additional payload for its replacement data data .
24,157
public static String createLookupKey ( String realm , String userid ) { String key = null ; if ( realm != null && userid != null ) { key = realm + KEY_SEPARATOR + userid ; } return key ; }
Creates a key to be used with the AuthCacheService . The parameters must not be null otherwise a null key is returned .
24,158
public void close ( ) { Thread responseThread = null ; synchronized ( this ) { if ( ! closed ) { closed = true ; notifyAll ( ) ; if ( listenForCommands ) { listenForCommands = false ; if ( listeningThread != null ) { listeningThread . interrupt ( ) ; } } Utils . tryToClose ( serverSocketChannel ) ; commandFile . delete ( ) ; responseThread = this . responseThread . getAndSet ( null ) ; } } if ( responseThread != null ) { try { responseThread . join ( ) ; } catch ( InterruptedException ex ) { } } }
Finish any outstanding asynchronous responses and close the server socket to prevent new command requests .
24,159
@ FFDCIgnore ( { IOException . class } ) private boolean acceptAndExecuteCommand ( ) { boolean socketValid = false ; try { SocketChannel sc = serverSocketChannel . accept ( ) ; socketValid = true ; if ( sc != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "accepted socket" , sc ) ; } try { String uuidAndCommand = read ( sc ) ; ServerCommandID commandID = new ServerCommandID ( uuidAndCommand ) ; String command = commandID . getOperation ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "read UUID and command" , command ) ; } if ( ! commandID . validate ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "invalid UUID" , uuidAndCommand ) ; } } else { String authID ; File authFile ; do { authID = Integer . toString ( nextCommandAuthID ++ ) ; authFile = new File ( commandAuthDir , authID ) ; } while ( authFile . exists ( ) ) ; authFile . createNewFile ( ) ; write ( sc , authID ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "wrote authorization challenge" , authID , authFile ) ; } String authIDResponse = read ( sc ) ; if ( ! authIDResponse . equals ( authID ) || authFile . exists ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "authorization failed" ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "authorization succeeded" ) ; } sc = executeCommand ( sc , command ) ; } } } finally { Utils . tryToClose ( sc ) ; } } } catch ( IOException ex ) { } catch ( Throwable t ) { } return socketValid ; }
Read and execute a command from the server socket
24,160
private synchronized void asyncResponse ( String command , SocketChannel sc ) { if ( closed ) { Utils . tryToClose ( sc ) ; } else { Thread thread = new Thread ( new ResponseThread ( command , sc ) , "kernel-" + command + "-command-response" ) ; Thread oldThread = responseThread . getAndSet ( thread ) ; if ( oldThread != null ) { oldThread . interrupt ( ) ; } thread . start ( ) ; } }
Creates a single thread to wait for the command to complete then respond .
24,161
private void writeResponse ( SocketChannel sc , int rc ) throws IOException { synchronized ( responseLock ) { write ( sc , serverUUID + DELIM + rc ) ; } }
Write a response on a socket channel with response code .
24,162
SICoreConnection createCoreConnection ( final String userName , final String password ) throws ResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "createCoreConnection" , new Object [ ] { userName , "*****" } ) ; } SICoreConnectionFactory coreConnectionFactory = null ; if ( ! UTEHelperFactory . jmsTestEnvironmentEnabled ) { try { coreConnectionFactory = SICoreConnectionFactorySelector . getSICoreConnectionFactory ( FactoryType . TRM_CONNECTION ) ; } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".createManagedConnection" , FFDC_PROBE_5 , this ) ; throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1064" , new Object [ ] { exception , "getSICoreConnectionFactory" } , null ) , exception ) ; } } else { coreConnectionFactory = UTEHelperFactory . getHelperInstance ( ) . setupJmsTestEnvironment ( ) ; } if ( coreConnectionFactory == null ) { throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "SICORECONNECTION_ERROR_CWSJR1066" ) , new Object [ ] { "createManagedConnection" } , null ) ) ; } final SICoreConnection coreConnection ; try { final Map trmProperties = _managedConnectionFactory . getTrmProperties ( ) ; coreConnection = coreConnectionFactory . createConnection ( userName , password , trmProperties ) ; } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".createManagedConnection (Subject, ConnectionRequestInfo)" , FFDC_PROBE_6 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1065" , new Object [ ] { exception , "createManagedConnection" } , null ) , exception ) ; } catch ( final SIErrorException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".createManagedConnection (Subject, ConnectionRequestInfo)" , FFDC_PROBE_7 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1065" , new Object [ ] { exception , "createManagedConnection" } , null ) , exception ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "createCoreConnection" , coreConnection ) ; } return coreConnection ; }
Creates a core connection
24,163
public int getConsumerCount ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getConsumerCount" ) ; int consumerCount ; synchronized ( consumerPoints ) { consumerCount = consumerPoints . size ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getConsumerCount" , Integer . valueOf ( consumerCount ) ) ; return consumerCount ; }
No - op
24,164
public static FacesServletMapping createPrefixMapping ( String path ) { FacesServletMapping mapping = new FacesServletMapping ( ) ; mapping . setPrefix ( path ) ; return mapping ; }
Creates a new FacesServletMapping object using prefix mapping .
24,165
public static FacesServletMapping createExtensionMapping ( String extension ) { FacesServletMapping mapping = new FacesServletMapping ( ) ; mapping . setExtension ( extension ) ; return mapping ; }
Creates a new FacesServletMapping object using extension mapping .
24,166
public static String getSSOCookieName ( ) throws Exception { WebAppSecurityConfig config = WebSecurityHelperImpl . getWebAppSecurityConfig ( ) ; if ( config != null ) { return config . getSSOCookieName ( ) ; } return null ; }
Extracts the SSO cookie name for use on downstream web invocations . Return null when the service is not started or activated .
24,167
public Class < ? > loadSystemClass ( final String name ) throws ClassNotFoundException { if ( System . getSecurityManager ( ) == null ) { ClassLoader systemClassLoader = ClassLoader . getSystemClassLoader ( ) ; return ( systemClassLoader != null ) ? systemClassLoader . loadClass ( name ) : bootClassLoader . loadClass ( name ) ; } try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < Class < ? > > ( ) { public Class < ? > run ( ) throws Exception { ClassLoader systemClassLoader = ClassLoader . getSystemClassLoader ( ) ; return ( systemClassLoader != null ) ? systemClassLoader . loadClass ( name ) : bootClassLoader . loadClass ( name ) ; } } , controlContext ) ; } catch ( PrivilegedActionException e ) { if ( e . getException ( ) instanceof ClassNotFoundException ) throw ( ClassNotFoundException ) e . getException ( ) ; throw ( RuntimeException ) e . getException ( ) ; } }
Returns a Class . Tries to load a class from the System ClassLoader or if that doesn t exist tries the boot ClassLoader
24,168
public static final String asString ( WsByteBuffer [ ] list ) { byte [ ] data = asByteArray ( list ) ; return ( null != data ) ? new String ( data ) : null ; }
Convert an array of buffers to a String .
24,169
public static final String asString ( WsByteBuffer [ ] list , int [ ] positions , int [ ] limits ) { byte [ ] data = asByteArray ( list , positions , limits ) ; return ( null != data ) ? new String ( data ) : null ; }
Convert an array of buffers to a string using the input starting positions and ending limits .
24,170
public static final String asString ( WsByteBuffer buff ) { byte [ ] data = asByteArray ( buff ) ; return ( null != data ) ? new String ( data ) : null ; }
Convert a buffer to a String .
24,171
public static final String asString ( WsByteBuffer buff , int position , int limit ) { byte [ ] data = asByteArray ( buff , position , limit ) ; return ( null != data ) ? new String ( data ) : null ; }
Convert a buffer to a string using the input starting position and ending limit .
24,172
public static final StringBuffer asStringBuffer ( WsByteBuffer [ ] list ) { StringBuffer sb = new StringBuffer ( ) ; String data = asString ( list ) ; if ( null != data ) { sb . append ( data ) ; } return sb ; }
Convert a list of buffers to a StringBuffer . Null or empty data will result in an empty StringBuffer .
24,173
public static final int asInt ( WsByteBuffer buff , int position , int limit ) { return asInt ( asByteArray ( buff , position , limit ) ) ; }
Convert a buffer to an int using the starting position and ending limit .
24,174
public static final int asInt ( WsByteBuffer [ ] list , int [ ] positions , int [ ] limits ) { return asInt ( asByteArray ( list , positions , limits ) ) ; }
Convert a list of buffers to an int using the starting positions and ending limits .
24,175
public static final int asInt ( byte [ ] data ) { if ( null == data ) { return - 1 ; } int start = 0 ; for ( ; start < data . length ; start ++ ) { if ( ' ' != data [ start ] || '\t' == data [ start ] ) { break ; } } int i = data . length - 1 ; for ( ; start <= i ; i -- ) { if ( ' ' != data [ i ] && '\t' != data [ i ] ) { break ; } } if ( i <= start ) { return - 1 ; } int intVal = 0 ; int mark = 1 ; int digit ; for ( ; start <= i ; i -- ) { digit = data [ i ] - '0' ; if ( 0 > digit || 9 < digit ) { if ( '-' != data [ i ] ) { throw new NumberFormatException ( "Invalid digit: " + data [ i ] ) ; } break ; } intVal += digit * mark ; mark *= 10 ; } if ( start < i ) { throw new NumberFormatException ( "Invalid data" ) ; } if ( start == i && data [ i ] == '-' ) { intVal = - intVal ; } return intVal ; }
Convert a byte array to an int trimming any whitespace . Null input will return a - 1 . Invalid numbers will throw a NumberFormatException .
24,176
public static void releaseBufferArray ( WsByteBuffer [ ] list ) { if ( null == list ) { return ; } for ( int i = 0 ; i < list . length ; i ++ ) { if ( null != list [ i ] ) { list [ i ] . release ( ) ; list [ i ] = null ; } } }
Helper function to release the buffers stored in a list . It will null out the buffer references in the list as it releases them .
24,177
public static final int lengthOf ( WsByteBuffer [ ] list ) { if ( null == list ) { return 0 ; } int length = 0 ; for ( int i = 0 ; i < list . length && null != list [ i ] ; i ++ ) { length += list [ i ] . remaining ( ) ; } return length ; }
Calculate the total length of actual content in the buffers in the input list . This will stop on the first null buffer or the end of the list .
24,178
public static void flip ( WsByteBuffer [ ] list ) { if ( list != null ) { for ( int i = 0 ; i < list . length ; i ++ ) { if ( list [ i ] != null ) { list [ i ] . flip ( ) ; } } } }
Flip all non null buffers in the array .
24,179
public static final int getTotalCapacity ( WsByteBuffer [ ] list ) { if ( null == list ) { return 0 ; } int cap = 0 ; for ( int i = 0 ; i < list . length ; i ++ ) { if ( list [ i ] != null ) { cap += list [ i ] . capacity ( ) ; } } return cap ; }
Find out the total capacity in an array of buffers . A null or empty list will return 0 .
24,180
public static void clearBufferArray ( WsByteBuffer [ ] list ) { if ( list != null ) { for ( int i = 0 ; i < list . length ; ++ i ) { if ( list [ i ] != null ) list [ i ] . clear ( ) ; } } }
Clear each buffer in an array of them .
24,181
public static WsByteBuffer [ ] expandBufferArray ( WsByteBuffer [ ] list , WsByteBuffer buffer ) { if ( null == buffer ) return list ; int len = ( null != list ? list . length : 0 ) ; WsByteBuffer [ ] bb = new WsByteBuffer [ len + 1 ] ; if ( 0 < len ) { System . arraycopy ( list , 0 , bb , 0 , len ) ; } bb [ len ] = buffer ; return bb ; }
Expand an existing list of buffers to include one new buffer if that buffer is null then the list is returned as - is .
24,182
public void setSecurityNameProp ( String securityName ) { if ( securityName != null ) entity . getIdentifier ( ) . set ( securityNameProp , securityName ) ; }
Sets the securityNameProperty . This is useful when creating a new object and wanting to populate its attributes . Mainly because you need 1 attribute before you can retrieve others .
24,183
public String getSecurityName ( boolean setAttr ) throws Exception { String securityName = null ; if ( entity . getIdentifier ( ) . isSet ( securityNameProp ) ) { securityName = ( String ) entity . getIdentifier ( ) . get ( securityNameProp ) ; } if ( securityName == null && ! entity . getIdentifier ( ) . isSet ( uniqueIdProp ) ) { throw new WIMApplicationException ( WIMMessageKey . REQUIRED_IDENTIFIERS_MISSING , Tr . formatMessage ( tc , WIMMessageKey . REQUIRED_IDENTIFIERS_MISSING ) ) ; } else if ( securityName == null ) { String uniqueId = ( String ) entity . getIdentifier ( ) . get ( uniqueIdProp ) ; securityName = getSecurityNameForEntity ( uniqueId ) ; } if ( setAttr ) { entity . getIdentifier ( ) . set ( securityNameProp , securityName ) ; } return securityName ; }
Returns the securityName of a user or a group .
24,184
public String getUniqueId ( boolean setAttr ) throws Exception { String uniqueName = null ; String uniqueId = null ; if ( entity . getIdentifier ( ) . isSet ( uniqueIdProp ) ) { uniqueId = ( String ) entity . getIdentifier ( ) . get ( uniqueIdProp ) ; return uniqueId ; } uniqueName = ( String ) entity . getIdentifier ( ) . get ( securityNameProp ) ; if ( ( uniqueId == null ) && ( uniqueName == null ) ) { throw new WIMApplicationException ( WIMMessageKey . REQUIRED_IDENTIFIERS_MISSING , Tr . formatMessage ( tc , WIMMessageKey . REQUIRED_IDENTIFIERS_MISSING ) ) ; } uniqueId = getUniqueIdForEntity ( uniqueName ) ; if ( setAttr ) { entity . getIdentifier ( ) . set ( uniqueIdProp , uniqueId ) ; } return uniqueId ; }
Returns the uniqueId of a user or a group .
24,185
@ SuppressWarnings ( "unchecked" ) public String getDisplayName ( boolean setAttr ) throws Exception { String displayName = null ; String securityName = getSecurityName ( false ) ; displayName = getDisplayNameForEntity ( securityName ) ; if ( ! ( ( displayName == null ) || ( displayName . trim ( ) . length ( ) == 0 ) ) && setAttr ) ( ( List < String > ) entity . get ( URBridgeConstants . DISPLAY_NAME ) ) . add ( displayName ) ; return displayName ; }
Returns the displayName of a user or a group .
24,186
public Object beginContext ( ComponentMetaData cmd ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { if ( cmd != null ) Tr . debug ( tc , "begin context " + cmd . getJ2EEName ( ) ) ; else Tr . debug ( tc , "NULL was passed." ) ; } if ( cmd == null ) { Tr . error ( tc , "WSVR0603E" ) ; throw new IllegalArgumentException ( Tr . formatMessage ( tc , "WSVR0603E" ) ) ; } return threadContext . beginContext ( cmd ) ; }
Begin the context for the ComponentMetaData provided .
24,187
public Object endContext ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { ComponentMetaData cmd = getComponentMetaData ( ) ; Tr . debug ( tc , "end context " + ( cmd == null ? null : cmd . getJ2EEName ( ) ) ) ; } return threadContext . endContext ( ) ; }
End the context for the current ComponentMetaData
24,188
public static EmbeddableWebSphereTransactionManager getTransactionManager ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getTransactionManager" ) ; if ( _tranManager == null ) { loadEmbeddableTranManager ( tmImplFactoryKey ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getTransactionManager" , _tranManager ) ; return ( EmbeddableWebSphereTransactionManager ) _tranManager ; }
This method returns the underlying implementation of the TransactionManager . Use of this object replaces use of the old JTSXA instance and static methods .
24,189
public static ExtendedTransactionManager getClientTransactionManager ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getClientTransactionManager" ) ; if ( _tranManager == null ) { loadEmbeddableTranManager ( clientTMKey ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getClientTransactionManager" , _tranManager ) ; return _tranManager ; }
Must only be called in a client
24,190
public Integer convertJSFeedbackToMQ ( Integer fb ) { Integer result = null ; if ( SIApiConstants . REPORT_COA . equals ( fb ) ) { result = Integer . valueOf ( ApiJmsConstants . MQFB_COA ) ; } else if ( SIApiConstants . REPORT_COD . equals ( fb ) ) { result = Integer . valueOf ( ApiJmsConstants . MQFB_COD ) ; } else if ( SIApiConstants . REPORT_EXPIRY . equals ( fb ) ) { result = Integer . valueOf ( ApiJmsConstants . MQFB_EXPIRATION ) ; } else if ( SIApiConstants . REPORT_PAN . equals ( fb ) ) { result = Integer . valueOf ( ApiJmsConstants . MQFB_PAN ) ; } else if ( SIApiConstants . REPORT_NAN . equals ( fb ) ) { result = Integer . valueOf ( ApiJmsConstants . MQFB_NAN ) ; } else { result = fb ; } return result ; }
Convert from Jetstream feedback values to MQ values .
24,191
private void readObject ( java . io . ObjectInputStream in ) throws IOException , ClassNotFoundException { GetField fields = in . readFields ( ) ; beginDefaultContext = fields . get ( BEGIN_DEFAULT , true ) ; }
Reads and deserializes from the input stream .
24,192
private boolean isIEBrowser ( byte [ ] agent ) { int end = agent . length - 4 ; for ( int i = 0 ; i < end ; ) { if ( 'M' == agent [ i ] ) { if ( 'S' == agent [ ++ i ] && 'I' == agent [ ++ i ] && 'E' == agent [ ++ i ] ) { return true ; } } else { i ++ ; } } return false ; }
Check the user - agent input header to see if it contains the IE browser marker .
24,193
protected List < WsByteBuffer > compress ( List < WsByteBuffer > list , WsByteBuffer buffer ) { if ( null == buffer ) { return null ; } int dataSize = buffer . remaining ( ) ; if ( 0 == dataSize ) { return list ; } byte [ ] input = null ; int initOffset = 0 ; if ( buffer . hasArray ( ) ) { input = buffer . array ( ) ; initOffset = buffer . arrayOffset ( ) + buffer . position ( ) ; buffer . position ( buffer . limit ( ) ) ; } else { input = new byte [ dataSize ] ; buffer . get ( input ) ; } this . deflater . setInput ( input , initOffset , dataSize ) ; int offset = 0 ; while ( ! this . deflater . needsInput ( ) ) { int len = this . deflater . deflate ( this . buf , offset , this . buf . length - offset ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Compressed amount=" + len + " read=" + this . deflater . getBytesRead ( ) + " written=" + this . deflater . getBytesWritten ( ) ) ; } if ( 0 == len ) { break ; } offset += len ; if ( offset == this . buf . length ) { list . add ( makeBuffer ( offset ) ) ; offset = 0 ; } } if ( 0 < offset ) { list . add ( makeBuffer ( offset ) ) ; } return list ; }
Compress the given input buffer onto the output list .
24,194
public String updateHost ( final String newHost ) { validateHostName ( newHost ) ; String oldHost = this . host ; this . host = newHost ; if ( ! oldHost . equals ( newHost ) ) { sendNotification ( new AttributeChangeNotification ( this , sequenceNum . incrementAndGet ( ) , System . currentTimeMillis ( ) , this . toString ( ) + " host value changed" , "Host" , "java.lang.String" , oldHost , newHost ) ) ; } return oldHost ; }
Update the host value for this end point . Will emit an AttributeChangeNotification if the value changed .
24,195
public int updatePort ( final int newPort ) { int oldPort = this . port ; this . port = newPort ; if ( oldPort != newPort ) { sendNotification ( new AttributeChangeNotification ( this , sequenceNum . incrementAndGet ( ) , System . currentTimeMillis ( ) , this . toString ( ) + " port value changed" , "Port" , "java.lang.Integer" , oldPort , newPort ) ) ; } return oldPort ; }
Update the port value for this end point . Will emit an AttributeChangeNotification if the value changed .
24,196
public void add ( OutboundConnection outboundConnection , EndPointDescriptor descriptor ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "add" , new Object [ ] { outboundConnection , descriptor } ) ; if ( connectionCloseTimeout == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "close timeout == 0, closing immediately" ) ; outboundConnection . physicalClose ( true ) ; } else { LinkedList < Object [ ] > connectionList = null ; Object [ ] listEntry = null ; synchronized ( this ) { connectionList = descriptorToConnectionListMap . get ( descriptor ) ; if ( connectionList == null ) { connectionList = new LinkedList < Object [ ] > ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "pool does not contain other connections for this endpoint, adding new list: " + connectionList ) ; descriptorToConnectionListMap . put ( descriptor , connectionList ) ; } else if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( this , tc , "connections already present in list: " + connectionList + " are" , connectionList . toArray ( ) ) ; } AlarmValid alarmValid = new AlarmValid ( ) ; listEntry = new Object [ ] { outboundConnection , alarmValid } ; connectionList . addLast ( listEntry ) ; } AlarmManager alarmManager = Framework . getInstance ( ) . getAlarmManager ( ) ; alarmManager . createDeferrable ( connectionCloseTimeout , this , new Object [ ] { connectionList , listEntry } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "add" ) ; }
Adds an outbound connection into the idle connection pool . This connection will remain in the pool until either it is removed via the remove method or remains idle long enough to be closed .
24,197
public synchronized OutboundConnection remove ( EndPointDescriptor descriptor ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "remove" , descriptor ) ; final LinkedList connectionList = descriptorToConnectionListMap . get ( descriptor ) ; OutboundConnection connection = null ; if ( ( connectionList != null ) && ( connectionList . size ( ) > 0 ) ) { Object [ ] connEntry = ( Object [ ] ) connectionList . removeFirst ( ) ; connection = ( OutboundConnection ) connEntry [ 0 ] ; ( ( AlarmValid ) connEntry [ 1 ] ) . invalidate ( ) ; final LinkLevelState lls = ( LinkLevelState ) connection . getAttachment ( ) ; if ( lls != null ) lls . reset ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "remove" , connection ) ; return connection ; }
Attempts to remove a connection from the pool . If a connection is available for the specified endpoint descriptor it is removed from the pool and returned . If no suitable connection is present a value of null is returened .
24,198
public void alarm ( Object alarmContext ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "alarm" , alarmContext ) ; boolean alarmValid = false ; boolean presentInConnectionList = false ; Object [ ] listEntry = null ; synchronized ( this ) { Object [ ] contextArray = ( Object [ ] ) alarmContext ; LinkedList connectionList = ( LinkedList ) contextArray [ 0 ] ; listEntry = ( Object [ ] ) contextArray [ 1 ] ; alarmValid = ( ( AlarmValid ) listEntry [ 1 ] ) . isValid ( ) ; if ( alarmValid ) presentInConnectionList = connectionList . remove ( listEntry ) ; } if ( presentInConnectionList ) { OutboundConnection connection = ( OutboundConnection ) listEntry [ 0 ] ; connection . physicalClose ( true ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "alarm" ) ; }
AlarmListener fired when a connection may have been idle for too long . This listener is registered with the alarm manager every time a connection is added to the pool . When fired it determines if the connection has remained idle and if so closes it .
24,199
private Dictionary < String , Object > getDefaultProperties ( String resourceAdapter , String interfaceName ) throws ConfigEvaluatorException , ResourceException { Bundle bundle = JMSResourceDefinitionHelper . getBundle ( bundleContext , resourceAdapter ) ; if ( bundle != null ) { MetaTypeInformation metaTypeInformation = metaTypeServiceRef . getService ( ) . getMetaTypeInformation ( bundle ) ; String [ ] factoryPids = metaTypeInformation . getFactoryPids ( ) ; for ( String factoryPid : factoryPids ) { ObjectClassDefinition ocd = metaTypeInformation . getObjectClassDefinition ( factoryPid , null ) ; ocd . getAttributeDefinitions ( 0 ) ; Dictionary < String , Object > defaultProps = wsConfigurationHelperRef . getService ( ) . getMetaTypeDefaultProperties ( factoryPid ) ; if ( defaultProps . get ( MANAGED_CONNECTION_FACTORY_CLASS ) != null ) { for ( String createsClass : ( String [ ] ) defaultProps . get ( CREATES_OBJECTCLASS ) ) { if ( createsClass . equals ( interfaceName ) ) return defaultProps ; } } } } ResourceException x = new ResourceException ( ) ; throw x ; }
Get Properties only those have default value