idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
25,800
public static String [ ] extractList ( String input , char delimiter ) { int end = input . indexOf ( delimiter ) ; if ( - 1 == end ) { return new String [ ] { input . trim ( ) } ; } List < String > output = new LinkedList < String > ( ) ; int start = 0 ; do { output . add ( input . substring ( start , end ) . trim ( ) ) ; start = end + 1 ; end = input . indexOf ( delimiter , start ) ; } while ( - 1 != end ) ; if ( start < input . length ( ) ) { output . add ( input . substring ( start ) . trim ( ) ) ; } return output . toArray ( new String [ output . size ( ) ] ) ; }
Convert the input string to a list of strings based on the provided delimiter .
25,801
public static String extractKey ( String input ) { int index = input . indexOf ( '=' ) ; if ( - 1 == index ) { return input . trim ( ) ; } return input . substring ( 0 , index ) . trim ( ) ; }
Extract the key of a key = value pair contained withint the provided string . If no equals sign is found then the input is returned with white space trimmed .
25,802
public static String extractValue ( String input ) { int index = input . indexOf ( '=' ) + 1 ; if ( 0 == index || index >= input . length ( ) ) { return "" ; } return input . substring ( index ) . trim ( ) ; }
Extract the value of a key = value pair contained within the provided string . If no value exists then an empty string is returned .
25,803
private static synchronized Map < String , List < String > > load ( Map < String , Object > config , boolean start , boolean restart ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Loading CHFW config from " + config ) ; } Map < String , Map < String , String [ ] > > parsed = extractConfig ( config ) ; if ( restart ) { unloadChains ( parsed . get ( "chains" ) . keySet ( ) . iterator ( ) ) ; } List < String > createdFactories = loadFactories ( parsed . get ( "factories" ) ) ; List < String > createdEndpoints = loadEndPoints ( parsed . get ( "endpoints" ) ) ; List < String > createdChannels = loadChannels ( parsed . get ( "channels" ) ) ; List < String > createdChains = loadChains ( parsed . get ( "chains" ) , start , restart ) ; List < String > createdGroups = loadGroups ( parsed . get ( "groups" ) , start , restart ) ; Map < String , List < String > > rc = new HashMap < String , List < String > > ( ) ; rc . put ( "factory" , createdFactories ) ; rc . put ( "channel" , createdChannels ) ; rc . put ( "chain" , createdChains ) ; rc . put ( "group" , createdGroups ) ; rc . put ( "endpoint" , createdEndpoints ) ; return rc ; }
Load and possibly start the provided configuration information .
25,804
public static synchronized Map < String , List < String > > loadConfig ( Map < String , Object > config ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; boolean usingDelayed = false ; if ( null == config ) { if ( delayedConfig . isEmpty ( ) ) { return null ; } if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "loadConfig using delayed config information" ) ; } config = delayedConfig ; delayedConfig = new HashMap < String , Object > ( ) ; usingDelayed = true ; } Map < String , List < String > > rc = load ( config , false , true ) ; if ( usingDelayed && ! delayedStarts . isEmpty ( ) ) { start ( rc , false , false ) ; } return rc ; }
Using the provided configuration create or update channels chains and groups within the channel framework .
25,805
public static void stopChains ( List < String > chains , long timeout , final Runnable runOnStop ) { if ( null == chains || chains . isEmpty ( ) ) { return ; } final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; final ChannelFramework cf = ChannelFrameworkFactory . getChannelFramework ( ) ; final long quiesceTimeout = ( - 1L == timeout ) ? cf . getDefaultChainQuiesceTimeout ( ) : timeout ; final UtilsChainListener listener = new UtilsChainListener ( ) ; for ( String chain : chains ) { ChainData cd = cf . getChain ( chain ) ; if ( null == cd ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Skipping unknown chain; " + chain ) ; } continue ; } if ( FlowType . OUTBOUND . equals ( cd . getType ( ) ) || ! cf . isChainRunning ( cd ) ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Skipping chain; " + chain ) ; } continue ; } try { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Stopping chain: " + chain ) ; } if ( quiesceTimeout > 0 ) { listener . watchChain ( cd ) ; } cf . stopChain ( cd , quiesceTimeout ) ; } catch ( Throwable t ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error stopping chain: " + t ) ; } } } if ( runOnStop != null ) { ExecutorService executorService = CHFWBundle . getExecutorService ( ) ; if ( null != executorService ) { Runnable runner = new Runnable ( ) { public void run ( ) { listener . waitOnChains ( quiesceTimeout ) ; runOnStop . run ( ) ; } } ; executorService . execute ( runner ) ; return ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Waiting for chains to stop" ) ; } listener . waitOnChains ( quiesceTimeout ) ; }
Utility method that stops any of the chains created by the configuration that might still be running . The provided timeout is used to quiesce any active connections on the chains .
25,806
private static List < String > loadFactories ( Map < String , String [ ] > factories ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; final ChannelFramework cf = ChannelFrameworkFactory . getChannelFramework ( ) ; List < String > createdFactories = new ArrayList < String > ( factories . size ( ) ) ; String key , value ; for ( Entry < String , String [ ] > entry : factories . entrySet ( ) ) { Class < ? > factoryType = cf . lookupFactory ( entry . getKey ( ) ) ; if ( null == factoryType ) { if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Delay; missing factory type " + entry . getKey ( ) ) ; } delayedConfig . put ( FACTORY_PREFIX + entry . getKey ( ) , entry . getValue ( ) ) ; createdFactories . add ( entry . getKey ( ) ) ; continue ; } String [ ] props = entry . getValue ( ) ; for ( int i = 0 ; i < props . length ; i ++ ) { key = extractKey ( props [ i ] ) ; value = extractValue ( props [ i ] ) ; if ( null != key && null != value ) { try { cf . updateChannelFactoryProperty ( factoryType , key , value ) ; } catch ( ChannelFactoryException e ) { FFDCFilter . processException ( e , "ChannelUtils.loadFactories" , "update" , new Object [ ] { entry , cf } ) ; if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to update factory prop; " + factoryType + " " + key + "=" + value ) ; } } } } try { cf . getChannelFactory ( factoryType ) ; createdFactories . add ( entry . getKey ( ) ) ; } catch ( ChannelFactoryException e ) { } } return createdFactories ; }
Load channel factories in the framework based on the provided factory configurations .
25,807
private static EndPointInfo defineEndPoint ( EndPointMgr epm , String name , String [ ] config ) { String host = null ; String port = null ; for ( int i = 0 ; i < config . length ; i ++ ) { String key = ChannelUtils . extractKey ( config [ i ] ) ; if ( "host" . equalsIgnoreCase ( key ) ) { host = ChannelUtils . extractValue ( config [ i ] ) ; } else if ( "port" . equalsIgnoreCase ( key ) ) { port = ChannelUtils . extractValue ( config [ i ] ) ; } } return epm . defineEndPoint ( name , host , Integer . parseInt ( port ) ) ; }
Define a new endpoint definition using the input name and list of properties .
25,808
private static List < String > loadEndPoints ( Map < String , String [ ] > endpoints ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; final EndPointMgr epm = EndPointMgrImpl . getRef ( ) ; List < String > createdEndpoints = new ArrayList < String > ( endpoints . size ( ) ) ; for ( Entry < String , String [ ] > entry : endpoints . entrySet ( ) ) { try { EndPointInfo ep = defineEndPoint ( epm , entry . getKey ( ) , entry . getValue ( ) ) ; createdEndpoints . add ( ep . getName ( ) ) ; } catch ( IllegalArgumentException e ) { FFDCFilter . processException ( e , "ChannelUtils.loadEndPoints" , "create" , new Object [ ] { epm , entry } ) ; if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to load endpoint: " + e ) ; } } } return createdEndpoints ; }
Load chain endpoints based on the provided configuration .
25,809
private static void fireMissingEvent ( ) { if ( delayCheckSignaled ) { return ; } ScheduledEventService scheduler = CHFWBundle . getScheduleService ( ) ; if ( null != scheduler ) { delayCheckSignaled = true ; ChannelFrameworkImpl cf = ( ChannelFrameworkImpl ) ChannelFrameworkFactory . getChannelFramework ( ) ; scheduler . schedule ( CHFWEventHandler . EVENT_CHECK_MISSING , cf . getMissingConfigDelay ( ) , TimeUnit . MILLISECONDS ) ; } }
Fire the missing config delayed event .
25,810
private static void unloadChains ( Iterator < String > chains ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; final ChannelFramework cf = ChannelFrameworkFactory . getChannelFramework ( ) ; List < String > runningChains = new LinkedList < String > ( ) ; while ( chains . hasNext ( ) ) { ChainData cd = cf . getChain ( chains . next ( ) ) ; if ( null != cd && FlowType . INBOUND . equals ( cd . getType ( ) ) ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unloading chain; " + cd . getName ( ) ) ; } try { if ( cf . isChainRunning ( cd ) ) { runningChains . add ( cd . getName ( ) ) ; } else { cf . destroyChain ( cd ) ; cf . removeChain ( cd ) ; } } catch ( Exception e ) { FFDCFilter . processException ( e , "ChannelUtils" , "unloadChains" , new Object [ ] { cd , cf } ) ; if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to remove chain; " + cd . getName ( ) ) ; } } } } stopChains ( runningChains , - 1L , null ) ; for ( String name : runningChains ) { ChainData cd = cf . getChain ( name ) ; if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unloading stopped chain; " + name ) ; } try { cf . destroyChain ( cd ) ; cf . removeChain ( cd ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "ChannelUtils" , "unloadChains" , new Object [ ] { cd , cf } ) ; if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to remove chain; " + name ) ; } } } }
Stop and unload any of the provided chain names that might exist and be currently running .
25,811
private static List < String > loadGroups ( Map < String , String [ ] > groups , boolean start , boolean restart ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; final ChannelFramework cf = ChannelFrameworkFactory . getChannelFramework ( ) ; List < String > createdGroups = new ArrayList < String > ( groups . size ( ) ) ; for ( Entry < String , String [ ] > entry : groups . entrySet ( ) ) { String group = entry . getKey ( ) ; List < String > chains = new ArrayList < String > ( entry . getValue ( ) . length ) ; List < String > delayed = new LinkedList < String > ( ) ; for ( String chain : entry . getValue ( ) ) { if ( null != cf . getChain ( chain ) ) { chains . add ( chain ) ; } else { delayed . add ( chain ) ; } } if ( ! delayed . isEmpty ( ) ) { if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Delay; group missing chains; " + group ) ; } if ( start ) { delayedStarts . put ( group , Boolean . valueOf ( restart ) ) ; } delayedConfig . put ( GROUP_PREFIX + group , delayed . toArray ( new String [ delayed . size ( ) ] ) ) ; createdGroups . add ( group ) ; } if ( 0 == chains . size ( ) ) { if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Group has no current chains; " + group ) ; } continue ; } try { ChainGroupData cgd = cf . getChainGroup ( group ) ; if ( null == cgd ) { cgd = cf . addChainGroup ( group , chains . toArray ( new String [ chains . size ( ) ] ) ) ; } else { for ( String newchain : chains ) { cf . addChainToGroup ( group , newchain ) ; } } createdGroups . add ( group ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "ChannelUtils.loadGroups" , "add" , new Object [ ] { entry , cf } ) ; if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to configure group " + group + "; " + e ) ; } } } return createdGroups ; }
Load chain groups in the framework based on the provided group configurations .
25,812
public static synchronized void checkMissingConfig ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Checking for missing config" ) ; } if ( delayedConfig . isEmpty ( ) ) { return ; } delayCheckSignaled = false ; final ChannelFramework cf = ChannelFrameworkFactory . getChannelFramework ( ) ; Map < String , Map < String , String [ ] > > parsed = extractConfig ( delayedConfig ) ; for ( Entry < String , String [ ] > entry : parsed . get ( "channels" ) . entrySet ( ) ) { for ( String prop : entry . getValue ( ) ) { if ( "type" . equals ( extractKey ( prop ) ) ) { String factory = extractValue ( prop ) ; if ( null == cf . lookupFactory ( factory ) ) { if ( tc . isWarningEnabled ( ) ) { Tr . warning ( tc , "missing.factory" , factory ) ; } } } } } }
Check and report on any missing configuration .
25,813
public Object getObjectInstance ( Object obj , Name name , Context nameCtx , Hashtable < ? , ? > environment ) throws Exception { AmbiguousEJBReferenceException ambiguousEx ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getObjectInstance : " + obj ) ; if ( ! ( obj instanceof Reference ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + "Reference object not provided : " + obj ) ; return null ; } Reference ref = ( Reference ) obj ; if ( ! ref . getFactoryClassName ( ) . equals ( CLASS_NAME ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + "Incorrect factory for Reference : " + obj ) ; return null ; } RefAddr addr = ref . get ( ADDR_TYPE ) ; if ( addr == null ) { NamingException nex = new NamingException ( "The address for this Reference is empty (null)" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + nex ) ; throw nex ; } String message = ( String ) addr . getContent ( ) ; ambiguousEx = new AmbiguousEJBReferenceException ( message ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + ambiguousEx . getMessage ( ) ) ; throw ambiguousEx ; }
The method is part of the java . naming . spi . ObjectFactory interface and is invoked by javax . naming . spi . NamingManager to process a Reference object .
25,814
private LocalThreadObjectPool getThreadLocalObjectPool ( ) { if ( threadPoolSize <= 0 ) { return null ; } LocalThreadObjectPool localPool = null ; if ( threadLocals != null ) { localPool = threadLocals . get ( ) ; if ( localPool == null ) { localPool = new LocalThreadObjectPool ( threadPoolSize , null , destroyer ) ; threadLocals . set ( localPool ) ; localPool . setCleanUpOld ( cleanUpOld ) ; } } return localPool ; }
get a local thread specific pool . To be used for threads that frequently access this pool system .
25,815
public void removeFromInUse ( Object o ) { if ( null == o ) { throw new NullPointerException ( ) ; } if ( inUseTracking ) { inUseTable . remove ( o ) ; } }
remove the object from the inUse before normal release processing would remove it . To be used in when some other code knows that leaving it in the InUse table would create false - positive leak detection hits .
25,816
public void purgeThreadLocal ( ) { if ( null != threadLocals ) { LocalThreadObjectPool pool = threadLocals . get ( ) ; if ( null != pool ) { Object [ ] data = pool . purge ( ) ; if ( 0 < data . length ) { mainPool . putBatch ( data ) ; } } } }
This is used to purge the ThreadLocal level information back to the main group when the thread is being killed off .
25,817
public void batchUpdate ( HashMap invalidateIdEvents , HashMap invalidateTemplateEvents , ArrayList pushEntryEvents , ArrayList aliasEntryEvents ) { notificationService . batchUpdate ( invalidateIdEvents , invalidateTemplateEvents , pushEntryEvents , aliasEntryEvents , cacheUnit ) ; }
This allows the BatchUpdateDaemon to send its batch update events to all CacheUnits .
25,818
private boolean isOsgiApp ( IServletContext isc ) { Object bundleCtxAttr = isc . getAttribute ( BUNDLE_CONTEXT_KEY ) ; Tr . debug ( tc , "Servet context attr for key = " + BUNDLE_CONTEXT_KEY + ", = " + bundleCtxAttr ) ; if ( bundleCtxAttr != null ) { return true ; } else { return false ; } }
Will look into this in the future hopefully .
25,819
private String getBindingName ( ResourceInfo resourceInfo ) { String destBindingName = null ; String link = resourceInfo . getLink ( ) ; if ( link == null ) { destBindingName = getBindingName ( resourceInfo . getName ( ) ) ; } else { destBindingName = InjectionEngineAccessor . getMessageDestinationLinkInstance ( ) . findDestinationByName ( resourceInfo . getApplication ( ) , resourceInfo . getModule ( ) , link ) ; if ( destBindingName == null ) { Link mdLink = Link . parseMessageDestinationLink ( resourceInfo . getModule ( ) , link ) ; destBindingName = mdLink . name ; } } return destBindingName ; }
When a message - destination - link is available look up the binding from message destination link map . If that binding is not available default to the link name .
25,820
public static String getBindingName ( String name ) { if ( name . startsWith ( "java:" ) ) { int begin = "java:" . length ( ) ; int index = name . indexOf ( '/' , begin ) ; if ( index != - 1 ) { begin = index + 1 ; } if ( begin + "env/" . length ( ) <= name . length ( ) && name . regionMatches ( begin , "env/" , 0 , "env/" . length ( ) ) ) { begin += "env/" . length ( ) ; } return name . substring ( begin ) ; } return name ; }
Determine the binding name that will be used for a reference name . This implements basically the same algorithm as default bindings in traditional WAS .
25,821
public void reset ( ) { this . location = 0 ; this . first_created = 0 ; this . expiration = - 1 ; this . validatorExpiration = - 1 ; this . tableid = 0 ; this . key = null ; this . value = null ; this . next = 0 ; this . previous = 0 ; this . valuelen = - 1 ; this . hash = 0 ; this . index = 0 ; this . size = - 1 ; this . serializedKey = null ; this . serializedCacheValue = null ; this . cacheValueSize = 0 ; this . cacheValueHashcode = 0 ; this . bAliasId = false ; this . bValidHashcode = true ; }
resets this HashtableEntry for reuse
25,822
static void rcvCreateUCTransaction ( CommsByteBuffer request , Conversation conversation , int requestNumber , boolean allocatedFromBufferPool , boolean partOfExchange ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "rcvCreateUCTransaction" , new Object [ ] { request , conversation , "" + requestNumber , "" + allocatedFromBufferPool } ) ; ConversationState convState = ( ConversationState ) conversation . getAttachment ( ) ; short connectionObjectId = request . getShort ( ) ; int clientTransactionId = request . getInt ( ) ; boolean allowSubordinates = true ; if ( conversation . getHandshakeProperties ( ) . getFapLevel ( ) >= JFapChannelConstants . FAP_VERSION_5 ) { allowSubordinates = ( request . get ( ) & 0x01 ) == 0x01 ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "SICoreConnection Id:" , connectionObjectId ) ; SibTr . debug ( tc , "Client transaction Id:" , clientTransactionId ) ; } CATConnection catConn = ( CATConnection ) convState . getObject ( connectionObjectId ) ; SICoreConnection connection = catConn . getSICoreConnection ( ) ; ServerLinkLevelState linkState = ( ServerLinkLevelState ) conversation . getLinkLevelAttachment ( ) ; SIUncoordinatedTransaction ucTran = null ; try { ucTran = connection . createUncoordinatedTransaction ( allowSubordinates ) ; } catch ( SIException e ) { if ( ! convState . hasMETerminated ( ) ) { FFDCFilter . processException ( e , CLASS_NAME + ".rcvCreateUCTransaction" , CommsConstants . STATICCATTRANSACTION_CREATE_01 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Failed to create the transaction" , e ) ; linkState . getTransactionTable ( ) . addLocalTran ( clientTransactionId , conversation . getId ( ) , IdToTransactionTable . INVALID_TRANSACTION ) ; linkState . getTransactionTable ( ) . markAsRollbackOnly ( clientTransactionId , e ) ; } if ( ucTran != null ) { linkState . getTransactionTable ( ) . addLocalTran ( clientTransactionId , conversation . getId ( ) , ucTran ) ; } request . release ( allocatedFromBufferPool ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "rcvCreateUCTransaction" ) ; }
Create an SIUncoordinatedTransaction .
25,823
static void rcvCommitTransaction ( CommsByteBuffer request , Conversation conversation , int requestNumber , boolean allocatedFromBufferPool , boolean partOfExchange ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "rcvCommitTransaction" , new Object [ ] { request , conversation , "" + requestNumber , "" + allocatedFromBufferPool } ) ; short connectionObjectId = request . getShort ( ) ; int clientTransactionId = request . getInt ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "SICoreConnection Id:" , connectionObjectId ) ; SibTr . debug ( tc , "Client transaction Id:" , clientTransactionId ) ; } try { ServerLinkLevelState linkState = ( ServerLinkLevelState ) conversation . getLinkLevelAttachment ( ) ; SITransaction tran = linkState . getTransactionTable ( ) . get ( clientTransactionId ) ; boolean tranIsRollbackOnly = ( tran == IdToTransactionTable . INVALID_TRANSACTION ) || linkState . getTransactionTable ( ) . isLocalTransactionRollbackOnly ( clientTransactionId ) ; if ( tranIsRollbackOnly ) { Throwable t = linkState . getTransactionTable ( ) . getExceptionForRollbackOnlyLocalTransaction ( clientTransactionId ) ; linkState . getTransactionTable ( ) . removeLocalTransaction ( clientTransactionId ) ; SIUncoordinatedTransaction siTran = ( SIUncoordinatedTransaction ) tran ; if ( siTran != null && siTran != IdToTransactionTable . INVALID_TRANSACTION ) siTran . rollback ( ) ; SIRollbackException r = new SIRollbackException ( nls . getFormattedMessage ( "TRANSACTION_MARKED_AS_ERROR_SICO2008" , new Object [ ] { t } , null ) , t ) ; StaticCATHelper . sendExceptionToClient ( r , null , conversation , requestNumber ) ; } else { linkState . getTransactionTable ( ) . removeLocalTransaction ( clientTransactionId ) ; SIUncoordinatedTransaction siTran = ( SIUncoordinatedTransaction ) tran ; siTran . commit ( ) ; try { conversation . send ( poolManager . allocate ( ) , JFapChannelConstants . SEG_COMMIT_TRANSACTION_R , requestNumber , JFapChannelConstants . PRIORITY_MEDIUM , true , ThrottlingPolicy . BLOCK_THREAD , null ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".rcvCommitTransaction" , CommsConstants . STATICCATTRANSACTION_COMMIT_01 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , e . getMessage ( ) , e ) ; SibTr . error ( tc , "COMMUNICATION_ERROR_SICO2026" , e ) ; } } } catch ( SIException e ) { if ( ! ( ( ConversationState ) conversation . getAttachment ( ) ) . hasMETerminated ( ) ) { FFDCFilter . processException ( e , CLASS_NAME + ".rcvCommitTransaction" , CommsConstants . STATICCATTRANSACTION_COMMIT_02 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , e . getMessage ( ) , e ) ; StaticCATHelper . sendExceptionToClient ( e , CommsConstants . STATICCATTRANSACTION_COMMIT_02 , conversation , requestNumber ) ; } request . release ( allocatedFromBufferPool ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "rcvCommitTransaction" ) ; }
Commit the transaction provided by the client .
25,824
static void rcvRollbackTransaction ( CommsByteBuffer request , Conversation conversation , int requestNumber , boolean allocatedFromBufferPool , boolean partOfExchange ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "rcvRollbackTransaction" , new Object [ ] { request , conversation , "" + requestNumber , "" + allocatedFromBufferPool } ) ; short connectionObjectId = request . getShort ( ) ; int clientTransactionId = request . getInt ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "SICoreConnection Id:" , connectionObjectId ) ; SibTr . debug ( tc , "Client transaction Id:" , clientTransactionId ) ; } try { ServerLinkLevelState linkState = ( ServerLinkLevelState ) conversation . getLinkLevelAttachment ( ) ; SITransaction tran = linkState . getTransactionTable ( ) . get ( clientTransactionId ) ; if ( tran == IdToTransactionTable . INVALID_TRANSACTION ) { Throwable e = linkState . getTransactionTable ( ) . getExceptionForRollbackOnlyLocalTransaction ( clientTransactionId ) ; linkState . getTransactionTable ( ) . removeLocalTransaction ( clientTransactionId ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Looks like the transaction failed to create" , e ) ; } else { linkState . getTransactionTable ( ) . removeLocalTransaction ( clientTransactionId ) ; SIUncoordinatedTransaction siTran = ( SIUncoordinatedTransaction ) tran ; siTran . rollback ( ) ; } try { conversation . send ( poolManager . allocate ( ) , JFapChannelConstants . SEG_ROLLBACK_TRANSACTION_R , requestNumber , JFapChannelConstants . PRIORITY_MEDIUM , true , ThrottlingPolicy . BLOCK_THREAD , null ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".rcvRollbackTransaction" , CommsConstants . STATICCATTRANSACTION_ROLLBACK_01 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , e . getMessage ( ) , e ) ; SibTr . error ( tc , "COMMUNICATION_ERROR_SICO2026" , e ) ; } } catch ( SIException e ) { if ( ! ( ( ConversationState ) conversation . getAttachment ( ) ) . hasMETerminated ( ) ) { FFDCFilter . processException ( e , CLASS_NAME + ".rcvRollbackTransaction" , CommsConstants . STATICCATTRANSACTION_ROLLBACK_02 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , e . getMessage ( ) , e ) ; StaticCATHelper . sendExceptionToClient ( e , CommsConstants . STATICCATTRANSACTION_ROLLBACK_02 , conversation , requestNumber ) ; } request . release ( allocatedFromBufferPool ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "rcvRollbackTransaction" ) ; }
Rollback the transaction provided by the client .
25,825
public String toPayloadString ( ) { String digits = "0123456789ABCDEF" ; StringBuilder retval = new StringBuilder ( "DataSlice@" ) ; retval . append ( hashCode ( ) ) ; retval . append ( "[" ) ; for ( int i = _offset ; i < ( _offset + _length ) ; i ++ ) { retval . append ( digits . charAt ( ( _bytes [ i ] >> 4 ) & 0xf ) ) ; retval . append ( digits . charAt ( _bytes [ i ] & 0xf ) ) ; } retval . append ( "]" ) ; return retval . toString ( ) ; }
This method will output the contents of the slice designated by the provided offset and length .
25,826
public static String getClearHiddenCommandFormParamsFunctionName ( String formName ) { final char separatorChar = FacesContext . getCurrentInstance ( ) . getNamingContainerSeparatorChar ( ) ; if ( formName == null ) { return "'" + HtmlRendererUtils . CLEAR_HIDDEN_FIELD_FN_NAME + "_'+formName.replace(/-/g, '\\$" + separatorChar + "').replace(/" + separatorChar + "/g,'_')" ; } return JavascriptUtils . getValidJavascriptNameAsInRI ( HtmlRendererUtils . CLEAR_HIDDEN_FIELD_FN_NAME + "_" + formName . replace ( separatorChar , '_' ) ) ; }
Prefixes the given String with clear_ and removes special characters
25,827
public void eventPostCommitRemove ( Transaction tran ) throws SevereMessageStoreException { super . eventPostCommitRemove ( tran ) ; if ( stream != null ) stream . removeFromIndex ( this ) ; }
from its parent s stream s index .
25,828
public List < DataSlice > getPersistentData ( ) { List < DataSlice > slices = new ArrayList < DataSlice > ( 1 ) ; slices . add ( new DataSlice ( schema . toByteArray ( ) ) ) ; return slices ; }
The serialized form is wrapped in a DataSlice and returned in a single - entry List . SIB0112b . mfp . 1
25,829
public void restore ( List < DataSlice > slices ) { schema = JMFRegistry . instance . createJMFSchema ( slices . get ( 0 ) . getBytes ( ) ) ; }
Restore this item from serialized form
25,830
synchronized protected void addMessagingEngine ( final JsMessagingEngine messagingEngine ) throws ResourceException { final String methodName = "addMessagingEngine" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } if ( isListenerRequired ( messagingEngine ) ) { createListener ( messagingEngine ) ; SibTr . info ( TRACE , "NEW_CONSUMER_CWSIV0764" , new Object [ ] { _endpointConfiguration . getBusName ( ) , messagingEngine . getName ( ) , _endpointConfiguration . getDestination ( ) . getDestinationName ( ) } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
If the messaging engine is one of the required set or there are no required messaging engines and there are no other connections then create a listener .
25,831
private boolean isListenerRequired ( final JsMessagingEngine messagingEngine ) throws ResourceException { final String methodName = "isListenerRequired" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } boolean listenerRequired = false ; final Set requiredMessagingEngines = getRequiredMessagingEngines ( messagingEngine ) ; if ( requiredMessagingEngines . size ( ) > 0 ) { if ( requiredMessagingEngines . contains ( messagingEngine . getUuid ( ) . toString ( ) ) ) { listenerRequired = true ; } } else { if ( _connections . size ( ) == 0 ) { listenerRequired = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , Boolean . valueOf ( listenerRequired ) ) ; } return listenerRequired ; }
Determines if a listener is required for the given messaging engine .
25,832
private static String validateDestination ( final JsMessagingEngine messagingEngine , final String busName , final String destinationName , final DestinationType destinationType ) throws NotSupportedException , ResourceAdapterInternalException { final String methodName = "validateDestination" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( TRACE , methodName , new Object [ ] { messagingEngine , busName , destinationName , destinationType } ) ; } final String resolvedBusName = ( ( ( busName == null ) || "" . equals ( busName ) ) ? messagingEngine . getBusName ( ) : busName ) ; final String uuid ; try { final BaseDestinationDefinition destinationDefinition = messagingEngine . getSIBDestination ( busName , destinationName ) ; if ( destinationDefinition . isForeign ( ) ) { throw new NotSupportedException ( NLS . getFormattedMessage ( ( "FOREIGN_DESTINATION_CWSIV0754" ) , new Object [ ] { destinationName , resolvedBusName } , null ) ) ; } if ( destinationDefinition . isLocal ( ) ) { final DestinationDefinition localDefinition = ( DestinationDefinition ) destinationDefinition ; if ( destinationType . equals ( localDefinition . getDestinationType ( ) ) ) { uuid = destinationDefinition . getUUID ( ) . toString ( ) ; } else { throw new NotSupportedException ( NLS . getFormattedMessage ( ( "INCORRECT_TYPE_CWSIV0755" ) , new Object [ ] { destinationName , resolvedBusName , destinationType , localDefinition . getDestinationType ( ) } , null ) ) ; } } else if ( destinationDefinition . isAlias ( ) ) { final DestinationAliasDefinition aliasDefinition = ( DestinationAliasDefinition ) destinationDefinition ; uuid = validateDestination ( messagingEngine , aliasDefinition . getTargetBus ( ) , aliasDefinition . getTargetName ( ) , destinationType ) ; } else { throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "UNKNOWN_TYPE_CWSIV0756" ) , new Object [ ] { destinationName , resolvedBusName } , null ) ) ; } } catch ( final SIBExceptionDestinationNotFound exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_1 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( TRACE , exception ) ; } throw new NotSupportedException ( NLS . getFormattedMessage ( ( "NOT_FOUND_CWSIV0757" ) , new Object [ ] { destinationName , resolvedBusName } , null ) , exception ) ; } catch ( final SIBExceptionBase exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_2 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( TRACE , exception ) ; } throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "UNEXPECTED_EXCEPTION_CWSIV0758" ) , new Object [ ] { destinationName , resolvedBusName , exception } , null ) , exception ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName , uuid ) ; } return uuid ; }
Validates the given destination information with administration .
25,833
private Set getRequiredMessagingEngines ( final JsMessagingEngine messagingEngine ) throws NotSupportedException , ResourceAdapterInternalException { final String methodName = "getRequiredMessagingEngines" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } final Set < String > requiredMessagingEngines = new HashSet < String > ( ) ; final JsMessagingEngine [ ] localMessagingEngines = SibRaEngineComponent . getMessagingEngines ( _endpointConfiguration . getBusName ( ) ) ; final String destinationUuid = validateDestination ( messagingEngine , _endpointConfiguration . getDestination ( ) . getBusName ( ) , _endpointConfiguration . getDestination ( ) . getDestinationName ( ) , _endpointConfiguration . getDestinationType ( ) ) ; if ( DestinationType . TOPICSPACE == _endpointConfiguration . getDestinationType ( ) ) { if ( _endpointConfiguration . isDurableSubscription ( ) ) { _remoteDestination = true ; for ( int i = 0 ; i < localMessagingEngines . length ; i ++ ) { if ( localMessagingEngines [ i ] . getName ( ) . equals ( _endpointConfiguration . getDurableSubscriptionHome ( ) ) ) { requiredMessagingEngines . add ( localMessagingEngines [ i ] . getUuid ( ) . toString ( ) ) ; _remoteDestination = false ; break ; } } } else { _remoteDestination = false ; } } else { final Set destinationLocalisations ; try { destinationLocalisations = messagingEngine . getSIBDestinationLocalitySet ( _endpointConfiguration . getDestination ( ) . getBusName ( ) , destinationUuid ) ; } catch ( final SIBExceptionBase exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_3 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "DESTINATION_LOCALITY_CWSIV0753" ) , new Object [ ] { exception , destinationUuid } , null ) , exception ) ; } _remoteDestination = true ; for ( int i = 0 ; i < localMessagingEngines . length ; i ++ ) { final String meUuid = localMessagingEngines [ i ] . getUuid ( ) . toString ( ) ; if ( destinationLocalisations . contains ( meUuid ) ) { requiredMessagingEngines . add ( meUuid ) ; _remoteDestination = false ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName , requiredMessagingEngines ) ; } return requiredMessagingEngines ; }
Determines which of the local messaging engines the resource adapter should try and obtain connections to .
25,834
private void createListener ( final JsMessagingEngine messagingEngine ) throws ResourceException { final String methodName = "createListener" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } final SibRaMessagingEngineConnection connection = getConnection ( messagingEngine ) ; createListener ( connection ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Creates a listener to the configured destination on the given messaging engine .
25,835
public synchronized void messagingEngineStopping ( final JsMessagingEngine messagingEngine , final int mode ) { final String methodName = "messagingEngineStopping" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { messagingEngine , mode } ) ; } super . messagingEngineStopping ( messagingEngine , mode ) ; try { final Set requiredMessagingEngines = getRequiredMessagingEngines ( messagingEngine ) ; final JsMessagingEngine [ ] activeMessagingEngines = SibRaEngineComponent . getActiveMessagingEngines ( _endpointConfiguration . getBusName ( ) ) ; if ( ( requiredMessagingEngines . size ( ) == 0 ) && ( _connections . size ( ) == 0 ) ) { if ( activeMessagingEngines . length > 0 ) { final int randomIndex = _random . nextInt ( activeMessagingEngines . length ) ; createListener ( activeMessagingEngines [ randomIndex ] ) ; } else { SibTr . info ( TRACE , "LAST_ME_CWSIV0768" , new Object [ ] { messagingEngine . getName ( ) , messagingEngine . getBus ( ) , this } ) ; } } } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_4 , this ) ; SibTr . error ( TRACE , "MESSAGING_ENGINE_STOPPING_CWSIV0765" , new Object [ ] { exception , messagingEngine . getName ( ) , messagingEngine . getBusName ( ) } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Overrides the parent method so that if the messaging engine that is stopping was the any one messaging engine to which a connection had been made if there are still active messaging engines then connect to one of those instead .
25,836
public synchronized void messagingEngineInitializing ( final JsMessagingEngine messagingEngine ) { final String methodName = "messagingEngineInitializing" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } if ( _remoteMessagingEngine && messagingEngine . getBusName ( ) . equals ( _endpointConfiguration . getBusName ( ) ) ) { SibTr . info ( TRACE , "ME_INITIALIZING_CWSIV0778" , new Object [ ] { messagingEngine . getName ( ) , _endpointConfiguration . getBusName ( ) , this } ) ; _remoteMessagingEngine = false ; if ( _remoteConnection != null ) { _remoteConnection . close ( ) ; } _timer . cancel ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Notifies the listener that the given messaging engine is initializing .
25,837
public void messagingEngineDestroyed ( final JsMessagingEngine messagingEngine ) { final String methodName = "messagingEngineDestroyed" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } final JsMessagingEngine [ ] localMessagingEngines = SibRaEngineComponent . getMessagingEngines ( _endpointConfiguration . getBusName ( ) ) ; if ( 0 == localMessagingEngines . length ) { SibTr . info ( TRACE , "ME_DESTROYED_CWSIV0779" , new Object [ ] { messagingEngine . getName ( ) , _endpointConfiguration . getBusName ( ) , this } ) ; _remoteDestination = true ; synchronized ( this ) { _remoteMessagingEngine = true ; } createRemoteListenerDeactivateOnException ( true ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Notifies the listener that the given messaging engine is being destroyed .
25,838
synchronized void messagingEngineTerminated ( final SibRaMessagingEngineConnection connection ) { final String methodName = "messagingEngineTerminated" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , connection ) ; } if ( connection . equals ( _remoteConnection ) ) { SibTr . warning ( TRACE , "ME_TERMINATED_CWSIV0780" , new Object [ ] { connection . getConnection ( ) . getMeName ( ) , _endpointConfiguration . getBusName ( ) , this } ) ; _remoteConnection . close ( ) ; _remoteConnection = null ; scheduleCreateRemoteListener ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Indicates that the messaging engine for the given connection has terminated .
25,839
private void scheduleCreateRemoteListener ( ) { final String methodName = "scheduleCreateRemoteListener" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } _timer . schedule ( new TimerTask ( ) { public void run ( ) { createRemoteListenerDeactivateOnException ( false ) ; synchronized ( SibRaStaticDestinationEndpointActivation . this ) { if ( _remoteConnection != null ) { SibTr . info ( TRACE , "CONNECTED_CWSIV0777" , new Object [ ] { _remoteConnection . getConnection ( ) . getMeName ( ) , _endpointConfiguration . getDestination ( ) . getDestinationName ( ) , _endpointConfiguration . getBusName ( ) , SibRaStaticDestinationEndpointActivation . this } ) ; } } } } , RETRY_INTERVAL ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Schedules the creation of a remote listener to take place after the retry interval .
25,840
private Message createMessageProxy ( Message msgObject ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createMessageProxy" , msgObject ) ; Message retObj ; try { retObj = ( Message ) Proxy . newProxyInstance ( msgObject . getClass ( ) . getClassLoader ( ) , msgObject . getClass ( ) . getInterfaces ( ) , new MessageProxyInvocationHandler ( msgObject ) ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Exception caught while trying to createMessageProxy " , e ) ; retObj = msgObject ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createMessageProxy" , retObj ) ; return retObj ; }
This method creates proxy for the given message object . This is used only in Async Send .. Hence this method is called only by client environments .
25,841
void checkNotClosed ( ) throws JMSException { int currentState ; synchronized ( stateLock ) { currentState = state ; } if ( currentState == CLOSED ) { throw ( javax . jms . IllegalStateException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "SESSION_CLOSED_CWSIA0049" , null , tc ) ; } }
This method is called at the beginning of every method that should not work if the Session has been closed . It prevents further execution by throwing a JMSException with a suitable I m closed message .
25,842
Map getPassThruProps ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getPassThruProps" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getPassThruProps" , passThruProps ) ; return passThruProps ; }
Return the passThruProps for this Session .
25,843
Object getAsyncDeliveryLock ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getAsyncDeliveryLock" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getAsyncDeliveryLock" , asyncDeliveryLock ) ; return asyncDeliveryLock ; }
Returns the asyncDeliveryLock for this Session .
25,844
Connection getConnection ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getConnection" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getConnection" , connection ) ; return connection ; }
This method is used by the JmsMsgConsumerImpl . Consumer constructor to obtain a reference to the exception listener target .
25,845
SICoreConnection getCoreConnection ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getCoreConnection" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getCoreConnection" , coreConnection ) ; return coreConnection ; }
Returns the coreConnection for this Connection
25,846
JmsMsgProducer instantiateProducer ( Destination jmsDestination ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "instantiateProducer" , jmsDestination ) ; JmsMsgProducer messageProducer = new JmsMsgProducerImpl ( jmsDestination , coreConnection , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "instantiateProducer" , messageProducer ) ; return messageProducer ; }
This method is overriden by subclasses in order to instantiate an instance of the MsgProducer class . This means that the QueueSession . createSender method can delegate straight to Session . createProducer and still get back an instance of a QueueSender rather than a vanilla MessageProducer .
25,847
JmsMsgConsumer instantiateConsumer ( ConsumerProperties consumerProperties ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "instantiateConsumer" , consumerProperties ) ; JmsMsgConsumer messageConsumer = new JmsMsgConsumerImpl ( coreConnection , this , consumerProperties ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "instantiateConsumer" , messageConsumer ) ; return messageConsumer ; }
This method is overriden by subclasses in order to instantiate an instance of the MsgConsumer class . This means that the QueueSession . createReceiver method can delegate straight to Session . createConsumer and still get back an instance of a QueueReceiver rather than a vanilla MessageConsumer .
25,848
public int getProducerCount ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getProducerCount" ) ; int producerCount = producers . size ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getProducerCount" , producerCount ) ; return producerCount ; }
Return a count of the number of Producers currently open on this Session .
25,849
public int getConsumerCount ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getConsumerCount" ) ; int consumerCount = syncConsumers . size ( ) ; consumerCount += asyncConsumers . size ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getConsumerCount" , consumerCount ) ; return consumerCount ; }
Return a count of the number of Consumers currently open on this Session .
25,850
void removeProducer ( JmsMsgProducerImpl producer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeProducer" , producer ) ; producers . remove ( producer ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeProducer" ) ; }
This method is called by a JmsMsgProducer in order to remove itself from the list of Producers held by the Session .
25,851
void removeConsumer ( JmsMsgConsumerImpl consumer ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeConsumer" , consumer ) ; if ( ( acknowledgeMode == Session . DUPS_OK_ACKNOWLEDGE ) && ( uncommittedReceiveCount > 0 ) ) { commitTransaction ( ) ; } syncConsumers . remove ( consumer ) ; asyncConsumers . remove ( consumer ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeConsumer" ) ; }
This method is called by a JmsMsgConsumer in order to remove itself from the list of consumers held by the Session .
25,852
void removeBrowser ( JmsQueueBrowserImpl browser ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeBrowser" , browser ) ; browsers . remove ( browser ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeBrowser" ) ; }
This method is called by a JmsQueueBrowser in order to remove itself from the list of Browsers held by the Session .
25,853
void notifyMessagePreConsume ( SITransaction transaction ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "notifyMessagePreConsume" , transaction ) ; if ( ! ( transaction instanceof SIXAResource ) ) { uncommittedReceiveCount ++ ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) && ( uncommittedReceiveCount % 100 == 0 ) ) { SibTr . debug ( this , tc , "session " + this + " uncommittedReceiveCount : " + uncommittedReceiveCount ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "notifyMessagePreConsume" ) ; }
This method should be called when a message has been received by JMS consumer code but not yet delivered to user code .
25,854
void notifyMessagePostConsume ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "notifyMessagePostConsume" ) ; if ( ( acknowledgeMode == Session . DUPS_OK_ACKNOWLEDGE ) && ( uncommittedReceiveCount >= dupsCommitThreshold ) ) { commitTransaction ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "notifyMessagePostConsume" ) ; }
This method should be called when a previously received message has been delivered by JMS consumer code to user code .
25,855
int getAndResetCommitCount ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getAndResetCommitCount" ) ; int currentUncommittedReceiveCount = uncommittedReceiveCount ; uncommittedReceiveCount = 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getAndResetCommitCount" , currentUncommittedReceiveCount ) ; return currentUncommittedReceiveCount ; }
This method exists for the sole purpose of querying whether an application onMessage called recover under an auto_ack session . It returns the current value of the commit count and then zeros the value .
25,856
private SIDestinationAddress createTemporaryDestination ( Distribution destType , String prefix ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createTemporaryDestination" , new Object [ ] { destType , prefix } ) ; SIDestinationAddress da = null ; try { da = getCoreConnection ( ) . createTemporaryDestination ( destType , prefix ) ; } catch ( SIInvalidDestinationPrefixException siidpe ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "INVALID_VALUE_CWSIA0048" , new Object [ ] { "TempDestPrefix" , prefix } , siidpe , null , this , tc ) ; } catch ( SIConnectionLostException sice ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0053" , new Object [ ] { sice , "JmsSessionImpl.createTemporaryDestination (#2)" } , sice , null , this , tc ) ; } catch ( SINotAuthorizedException sinae ) { String userID = "<unknown>" ; try { userID = coreConnection . getResolvedUserid ( ) ; } catch ( SIException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "failed to get resovledUserId: " + e ) ; } throw ( JMSSecurityException ) JmsErrorUtils . newThrowable ( JMSSecurityException . class , "AUTHORIZATION_FAILED_CWSIA0057" , new Object [ ] { userID } , sinae , null , this , tc ) ; } catch ( SIConnectionUnavailableException sioce ) { throw ( javax . jms . IllegalStateException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "CONNECTION_CLOSED_CWSIA0051" , null , sioce , null , this , tc ) ; } catch ( SIException sice ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0053" , new Object [ ] { sice , "JmsSessionImpl.createTemporaryDestination (#5)" } , sice , null , this , tc ) ; } catch ( Exception e ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0053" , new Object [ ] { e , "JmsSessionImpl.createTemporaryDestination (#6)" } , e , "JmsSessionImpl.createTemporaryDestination#6" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createTemporaryDestination" , da ) ; return da ; }
Handles the call to core connection in which the temporary destination gets created .
25,857
protected void deleteTemporaryDestination ( SIDestinationAddress dest ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "deleteTemporaryDestination" , dest ) ; try { getCoreConnection ( ) . deleteTemporaryDestination ( dest ) ; } catch ( SITemporaryDestinationNotFoundException e ) { throw ( javax . jms . IllegalStateException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "DESTINATION_DOES_NOT_EXIST_CWSIA0052" , new Object [ ] { dest . getDestinationName ( ) } , e , null , this , tc ) ; } catch ( SIDestinationLockedException sidle ) { throw ( javax . jms . IllegalStateException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "DEST_LOCKED_CWSIA0058" , null , sidle , null , this , tc ) ; } catch ( SINotAuthorizedException sinae ) { String userID = "<unknown>" ; try { userID = coreConnection . getResolvedUserid ( ) ; } catch ( SIException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "failed to get resovledUserId: " + e ) ; } throw ( JMSSecurityException ) JmsErrorUtils . newThrowable ( JMSSecurityException . class , "AUTHORIZATION_FAILED_CWSIA0057" , new Object [ ] { userID } , sinae , null , this , tc ) ; } catch ( SIConnectionLostException sice ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0053" , new Object [ ] { sice , "JmsSessionImpl.deleteTemporaryDestination (#3)" } , sice , null , this , tc ) ; } catch ( SIConnectionUnavailableException sioce ) { throw ( javax . jms . IllegalStateException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "CONNECTION_CLOSED_CWSIA0051" , null , sioce , null , this , tc ) ; } catch ( SIException sice ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0053" , new Object [ ] { sice , "JmsSessionImpl.deleteTemporaryDestination (#6)" } , sice , "JmsSessionImpl.deleteTemporaryDestination#6" , this , tc ) ; } catch ( Exception e ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0053" , new Object [ ] { e , "JmsSessionImpl.deleteTemporaryDestination (#7)" } , e , "JmsSessionImpl.deleteTemporaryDestination#7" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "deleteTemporaryDestination" ) ; }
Handles the call to CoreConnection to delete a temporary destination .
25,858
boolean isAsync ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "isAsync" ) ; boolean isAsync = ! asyncConsumers . isEmpty ( ) && getState ( ) == STARTED ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "isAsync" , isAsync ) ; return isAsync ; }
Test to see if any of the consumers of this session are using async message delivery .
25,859
void checkSynchronousUsage ( String methodName ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "checkSynchronousUsage" , methodName ) ; if ( isAsync ( ) && ! Thread . holdsLock ( asyncDeliveryLock ) ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "ASYNC_IN_PROGRESS_CWSIA0082" , new Object [ ] { methodName } , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "checkSynchronousUsage" ) ; }
Utility method to generate JMSExceptions if a synchronous method is called on an asynchronous session . This method should be called at the beginning of every method that should not work if the owning session is being used for asynchronous receipt .
25,860
void validateStopCloseForMessageListener ( String functionCall ) throws IllegalStateException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "validateStopForMessageListener" ) ; if ( ( JmsSessionImpl . asyncReceiverThreadLocal . get ( ) != null ) && ( JmsSessionImpl . asyncReceiverThreadLocal . get ( ) == this ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Message Listener onMessage called stop on its own Context/connection." ) ; if ( functionCall . equalsIgnoreCase ( "stop" ) ) { throw ( IllegalStateException ) JmsErrorUtils . newThrowable ( IllegalStateException . class , "INVALID_METHOD_CWSIA0517" , new Object [ ] { this } , tc ) ; } else { throw ( IllegalStateException ) JmsErrorUtils . newThrowable ( IllegalStateException . class , "INVALID_METHOD_CWSIA0518" , new Object [ ] { this } , tc ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "validateStopForMessageListener" ) ; }
A message listener must not attempt to stop its own connection or context as this would lead to deadlock . IllegalStateException has to be thrown in case if it calls stop . THIS FUNCTION is called only in non - managed environments .
25,861
void addtoAsysncSendQueue ( JmsMsgProducerImpl msgProducer , CompletionListener cListner , Message msg , int sendMethodType , Object [ ] params ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "addtoAsysncSendQueue" , new Object [ ] { msgProducer , cListner , cListner , sendMethodType , params } ) ; _asyncSendQueue . offer ( new AysncSendDetails ( msgProducer , cListner , msg , sendMethodType , params ) ) ; if ( null == _asyncSendRunThread ) { _asyncSendRunThread = new Thread ( new AsyncSendTask ( ) ) ; _asyncSendRunThread . setDaemon ( true ) ; } if ( ( msg != null ) && msg instanceof JmsMessageImpl ) { ( ( JmsMessageImpl ) msg ) . setAsyncSendInProgress ( true ) ; } if ( ! _asyncSendRunThread . isAlive ( ) ) { try { _asyncSendRunThread . start ( ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "addtoAsysncSendQueue: starting asyncRunThread failed" , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "addtoAsysncSendQueue" ) ; }
Adds AsynSend operation details to the Queue . This function would get called only in case of non - managed environements .
25,862
private AttributeDefinitionSpecification [ ] getADs ( boolean isRequired ) { AttributeDefinitionSpecification [ ] retVal = null ; Vector < AttributeDefinitionSpecification > vector = new Vector < AttributeDefinitionSpecification > ( ) ; for ( Map . Entry < String , AttributeDefinitionSpecification > entry : attributes . entrySet ( ) ) { AttributeDefinitionSpecification ad = entry . getValue ( ) ; if ( isRequired == ad . isRequired ( ) ) { vector . add ( ad ) ; } } retVal = new AttributeDefinitionSpecification [ vector . size ( ) ] ; vector . toArray ( retVal ) ; return retVal ; }
Helper method to filter between required and optional ADs
25,863
protected void cleanup ( ) { final String methodName = "cleanup" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } if ( _unsuccessfulMessages . size ( ) > 0 ) { try { try { SIUncoordinatedTransaction localTran = _connection . createUncoordinatedTransaction ( ) ; deleteMessages ( getMessageHandles ( _unsuccessfulMessages ) , localTran ) ; localTran . rollback ( ) ; } catch ( SIException ex ) { FFDCFilter . processException ( ex , CLASS_NAME + "." + methodName , FFDC_PROBE_2 , this ) ; if ( TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , ex ) ; } } } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_1 , this ) ; if ( TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } } finally { _unsuccessfulMessages . clear ( ) ; } } if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Invoked after all messages in the batch have been delivered . Unlocks any unsuccessful messages .
25,864
public Locale calculateLocale ( FacesContext facesContext ) { Application application = facesContext . getApplication ( ) ; for ( Iterator < Locale > requestLocales = facesContext . getExternalContext ( ) . getRequestLocales ( ) ; requestLocales . hasNext ( ) ; ) { Locale requestLocale = requestLocales . next ( ) ; for ( Iterator < Locale > supportedLocales = application . getSupportedLocales ( ) ; supportedLocales . hasNext ( ) ; ) { Locale supportedLocale = supportedLocales . next ( ) ; if ( requestLocale . getLanguage ( ) . equals ( supportedLocale . getLanguage ( ) ) && ( supportedLocale . getCountry ( ) == null || supportedLocale . getCountry ( ) . length ( ) == 0 ) ) { return supportedLocale ; } else if ( supportedLocale . equals ( requestLocale ) ) { return supportedLocale ; } } } Locale defaultLocale = application . getDefaultLocale ( ) ; return defaultLocale != null ? defaultLocale : Locale . getDefault ( ) ; }
Get the locales specified as acceptable by the original request compare them to the locales supported by this Application and return the best match .
25,865
@ SuppressWarnings ( "unchecked" ) private JSONObject toJSONObjectForThrowable ( Map < String , ? > errorInfo , Throwable error ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "toJSONObjectForThrowable" , errorInfo , error ) ; LinkedHashMap < String , List < ? > > addedInfo = new LinkedHashMap < String , List < ? > > ( ) ; for ( Map . Entry < String , ? > entry : errorInfo . entrySet ( ) ) { Object value = entry . getValue ( ) ; if ( value instanceof List ) addedInfo . put ( entry . getKey ( ) , ( List < ? > ) value ) ; } JSONObject json = new OrderedJSONObject ( ) ; int index = 0 ; JSONObject current = json ; Set < Throwable > causes = new HashSet < Throwable > ( ) ; for ( Throwable cause = error ; cause != null && causes . add ( cause ) ; index ++ ) { for ( Map . Entry < String , List < ? > > entry : addedInfo . entrySet ( ) ) { List < ? > values = entry . getValue ( ) ; if ( values . size ( ) > index ) { Object value = values . get ( index ) ; if ( value != null ) current . put ( entry . getKey ( ) , value ) ; } } current . put ( "class" , cause . getClass ( ) . getName ( ) ) ; current . put ( "message" , cause . getMessage ( ) ) ; JSONArray stack = new JSONArray ( ) ; for ( StackTraceElement element : cause . getStackTrace ( ) ) stack . add ( element . toString ( ) ) ; current . put ( "stack" , stack ) ; if ( ( cause = cause . getCause ( ) ) != null ) { Map < String , Object > parent = current ; parent . put ( "cause" , current = new OrderedJSONObject ( ) ) ; } } return json ; }
Populate JSON object for a top level exception or error .
25,866
private ScriptEngine getScriptEngine ( String value ) { String engineName = value . substring ( 0 , value . indexOf ( ":" ) ) ; if ( engines . containsKey ( engineName ) ) { return engines . get ( engineName ) ; } else { ScriptEngine engine = manager . getEngineByName ( engineName ) ; if ( engine != null ) { engines . put ( engineName , engine ) ; } else { log . warning ( String . format ( "Could not find script engine by name '%s'" , engineName ) ) ; } return engine ; } }
Parses table cell to get script engine
25,867
private Object getScriptResult ( String script , ScriptEngine engine ) throws ScriptException { String scriptToExecute = script . substring ( script . indexOf ( ":" ) + 1 ) ; return engine . eval ( scriptToExecute ) ; }
Evaluates the script expression
25,868
private Connection createConnection ( ) { try { EntityTransaction tx = this . em . getTransaction ( ) ; if ( isHibernatePresentOnClasspath ( ) && em . getDelegate ( ) instanceof Session ) { connection = ( ( SessionImpl ) em . unwrap ( Session . class ) ) . connection ( ) ; } else { tx . begin ( ) ; connection = em . unwrap ( Connection . class ) ; tx . commit ( ) ; } } catch ( Exception e ) { throw new RuntimeException ( "Could not create database connection" , e ) ; } return connection ; }
unfortunately there is no standard way to get jdbc connection from JPA entity manager
25,869
protected void compareData ( ITable expectedTable , ITable actualTable , ComparisonColumn [ ] comparisonCols , FailureHandler failureHandler ) throws DataSetException { logger . debug ( "compareData(expectedTable={}, actualTable={}, " + "comparisonCols={}, failureHandler={}) - start" , new Object [ ] { expectedTable , actualTable , comparisonCols , failureHandler } ) ; if ( expectedTable == null ) { throw new NullPointerException ( "The parameter 'expectedTable' must not be null" ) ; } if ( actualTable == null ) { throw new NullPointerException ( "The parameter 'actualTable' must not be null" ) ; } if ( comparisonCols == null ) { throw new NullPointerException ( "The parameter 'comparisonCols' must not be null" ) ; } if ( failureHandler == null ) { throw new NullPointerException ( "The parameter 'failureHandler' must not be null" ) ; } for ( int i = 0 ; i < expectedTable . getRowCount ( ) ; i ++ ) { for ( int j = 0 ; j < comparisonCols . length ; j ++ ) { ComparisonColumn compareColumn = comparisonCols [ j ] ; String columnName = compareColumn . getColumnName ( ) ; DataType dataType = compareColumn . getDataType ( ) ; Object expectedValue = expectedTable . getValue ( i , columnName ) ; Object actualValue = actualTable . getValue ( i , columnName ) ; if ( skipCompare ( columnName , expectedValue , actualValue ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "ignoring comparison " + expectedValue + "=" + actualValue + " on column " + columnName ) ; } continue ; } if ( expectedValue != null && expectedValue . toString ( ) . startsWith ( "regex:" ) ) { if ( ! regexMatches ( expectedValue . toString ( ) , actualValue . toString ( ) ) ) { Difference diff = new Difference ( expectedTable , actualTable , i , columnName , expectedValue , actualValue ) ; failureHandler . handle ( diff ) ; } } else if ( dataType . compare ( expectedValue , actualValue ) != 0 ) { Difference diff = new Difference ( expectedTable , actualTable , i , columnName , expectedValue , actualValue ) ; failureHandler . handle ( diff ) ; } } } }
Same as DBUnitAssert with support for regex in row values
25,870
public static synchronized EntityManagerProvider instance ( String unitName , Map < String , String > overridingPersistenceProps ) { overridingProperties = overridingPersistenceProps ; return instance ( unitName ) ; }
Allows to pass in overriding Properties that may be specific to the JPA Vendor .
25,871
public void startWithInitialStateProbabilities ( Collection < S > initialStates , Map < S , Double > initialLogProbabilities ) { initializeStateProbabilities ( null , initialStates , initialLogProbabilities ) ; }
Lets the HMM computation start with the given initial state probabilities .
25,872
public void startWithInitialObservation ( O observation , Collection < S > candidates , Map < S , Double > emissionLogProbabilities ) { initializeStateProbabilities ( observation , candidates , emissionLogProbabilities ) ; }
Lets the HMM computation start at the given first observation and uses the given emission probabilities as the initial state probability for each starting state s .
25,873
public void nextStep ( O observation , Collection < S > candidates , Map < S , Double > emissionLogProbabilities , Map < Transition < S > , Double > transitionLogProbabilities , Map < Transition < S > , D > transitionDescriptors ) { if ( message == null ) { throw new IllegalStateException ( "startWithInitialStateProbabilities() or startWithInitialObservation() " + "must be called first." ) ; } if ( isBroken ) { throw new IllegalStateException ( "Method must not be called after an HMM break." ) ; } ForwardStepResult < S , O , D > forwardStepResult = forwardStep ( observation , prevCandidates , candidates , message , emissionLogProbabilities , transitionLogProbabilities , transitionDescriptors ) ; isBroken = hmmBreak ( forwardStepResult . newMessage ) ; if ( isBroken ) return ; if ( messageHistory != null ) { messageHistory . add ( forwardStepResult . newMessage ) ; } message = forwardStepResult . newMessage ; lastExtendedStates = forwardStepResult . newExtendedStates ; prevCandidates = new ArrayList < > ( candidates ) ; }
Processes the next time step . Must not be called if the HMM is broken .
25,874
private boolean hmmBreak ( Map < S , Double > message ) { for ( double logProbability : message . values ( ) ) { if ( logProbability != Double . NEGATIVE_INFINITY ) { return false ; } } return true ; }
Returns whether the specified message is either empty or only contains state candidates with zero probability and thus causes the HMM to break .
25,875
private ForwardStepResult < S , O , D > forwardStep ( O observation , Collection < S > prevCandidates , Collection < S > curCandidates , Map < S , Double > message , Map < S , Double > emissionLogProbabilities , Map < Transition < S > , Double > transitionLogProbabilities , Map < Transition < S > , D > transitionDescriptors ) { final ForwardStepResult < S , O , D > result = new ForwardStepResult < > ( curCandidates . size ( ) ) ; assert ! prevCandidates . isEmpty ( ) ; for ( S curState : curCandidates ) { double maxLogProbability = Double . NEGATIVE_INFINITY ; S maxPrevState = null ; for ( S prevState : prevCandidates ) { final double logProbability = message . get ( prevState ) + transitionLogProbability ( prevState , curState , transitionLogProbabilities ) ; if ( logProbability > maxLogProbability ) { maxLogProbability = logProbability ; maxPrevState = prevState ; } } result . newMessage . put ( curState , maxLogProbability + emissionLogProbabilities . get ( curState ) ) ; if ( maxPrevState != null ) { final Transition < S > transition = new Transition < > ( maxPrevState , curState ) ; final ExtendedState < S , O , D > extendedState = new ExtendedState < > ( curState , lastExtendedStates . get ( maxPrevState ) , observation , transitionDescriptors . get ( transition ) ) ; result . newExtendedStates . put ( curState , extendedState ) ; } } return result ; }
Computes the new forward message and the back pointers to the previous states .
25,876
private S mostLikelyState ( ) { assert ! message . isEmpty ( ) ; S result = null ; double maxLogProbability = Double . NEGATIVE_INFINITY ; for ( Map . Entry < S , Double > entry : message . entrySet ( ) ) { if ( entry . getValue ( ) > maxLogProbability ) { result = entry . getKey ( ) ; maxLogProbability = entry . getValue ( ) ; } } assert result != null ; return result ; }
Retrieves the first state of the current forward message with maximum probability .
25,877
private List < SequenceState < S , O , D > > retrieveMostLikelySequence ( ) { assert ! message . isEmpty ( ) ; final S lastState = mostLikelyState ( ) ; final List < SequenceState < S , O , D > > result = new ArrayList < > ( ) ; ExtendedState < S , O , D > es = lastExtendedStates . get ( lastState ) ; while ( es != null ) { final SequenceState < S , O , D > ss = new SequenceState < > ( es . state , es . observation , es . transitionDescriptor ) ; result . add ( ss ) ; es = es . backPointer ; } Collections . reverse ( result ) ; return result ; }
Retrieves most likely sequence from the internal back pointer sequence .
25,878
private List < SequenceState < State , Observation , Path > > computeViterbiSequence ( List < TimeStep < State , Observation , Path > > timeSteps , int originalGpxEntriesCount , QueryGraph queryGraph ) { final HmmProbabilities probabilities = new HmmProbabilities ( measurementErrorSigma , transitionProbabilityBeta ) ; final ViterbiAlgorithm < State , Observation , Path > viterbi = new ViterbiAlgorithm < > ( ) ; logger . debug ( "\n=============== Paths ===============" ) ; int timeStepCounter = 0 ; TimeStep < State , Observation , Path > prevTimeStep = null ; int i = 1 ; for ( TimeStep < State , Observation , Path > timeStep : timeSteps ) { logger . debug ( "\nPaths to time step {}" , i ++ ) ; computeEmissionProbabilities ( timeStep , probabilities ) ; if ( prevTimeStep == null ) { viterbi . startWithInitialObservation ( timeStep . observation , timeStep . candidates , timeStep . emissionLogProbabilities ) ; } else { computeTransitionProbabilities ( prevTimeStep , timeStep , probabilities , queryGraph ) ; viterbi . nextStep ( timeStep . observation , timeStep . candidates , timeStep . emissionLogProbabilities , timeStep . transitionLogProbabilities , timeStep . roadPaths ) ; } if ( viterbi . isBroken ( ) ) { String likelyReasonStr = "" ; if ( prevTimeStep != null ) { Observation prevGPXE = prevTimeStep . observation ; Observation gpxe = timeStep . observation ; double dist = distanceCalc . calcDist ( prevGPXE . getPoint ( ) . lat , prevGPXE . getPoint ( ) . lon , gpxe . getPoint ( ) . lat , gpxe . getPoint ( ) . lon ) ; if ( dist > 2000 ) { likelyReasonStr = "Too long distance to previous measurement? " + Math . round ( dist ) + "m, " ; } } throw new IllegalArgumentException ( "Sequence is broken for submitted track at time step " + timeStepCounter + " (" + originalGpxEntriesCount + " points). " + likelyReasonStr + "observation:" + timeStep . observation + ", " + timeStep . candidates . size ( ) + " candidates: " + getSnappedCandidates ( timeStep . candidates ) + ". If a match is expected consider increasing max_visited_nodes." ) ; } timeStepCounter ++ ; prevTimeStep = timeStep ; } return viterbi . computeMostLikelySequence ( ) ; }
Computes the most likely candidate sequence for the GPX entries .
25,879
private Map < String , EdgeIteratorState > createVirtualEdgesMap ( List < Collection < QueryResult > > queriesPerEntry , EdgeExplorer explorer ) { Map < String , EdgeIteratorState > virtualEdgesMap = new HashMap < > ( ) ; for ( Collection < QueryResult > queryResults : queriesPerEntry ) { for ( QueryResult qr : queryResults ) { if ( isVirtualNode ( qr . getClosestNode ( ) ) ) { EdgeIterator iter = explorer . setBaseNode ( qr . getClosestNode ( ) ) ; while ( iter . next ( ) ) { int node = traverseToClosestRealAdj ( explorer , iter ) ; if ( node == qr . getClosestEdge ( ) . getAdjNode ( ) ) { virtualEdgesMap . put ( virtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( false ) ) ; virtualEdgesMap . put ( reverseVirtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( true ) ) ; } else if ( node == qr . getClosestEdge ( ) . getBaseNode ( ) ) { virtualEdgesMap . put ( virtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( true ) ) ; virtualEdgesMap . put ( reverseVirtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( false ) ) ; } else { throw new RuntimeException ( ) ; } } } } } return virtualEdgesMap ; }
Returns a map where every virtual edge maps to its real edge with correct orientation .
25,880
public double transitionLogProbability ( double routeLength , double linearDistance ) { Double transitionMetric = Math . abs ( linearDistance - routeLength ) ; return Distributions . logExponentialDistribution ( beta , transitionMetric ) ; }
Returns the logarithmic transition probability density for the given transition parameters .
25,881
public Key register ( Watchable watchable , Iterable < ? extends WatchEvent . Kind < ? > > eventTypes ) throws IOException { checkOpen ( ) ; return new Key ( this , watchable , eventTypes ) ; }
Registers the given watchable with this service returning a new watch key for it . This implementation just checks that the service is open and creates a key ; subclasses may override it to do other things as well .
25,882
public DirectoryEntry lookUp ( File workingDirectory , JimfsPath path , Set < ? super LinkOption > options ) throws IOException { checkNotNull ( path ) ; checkNotNull ( options ) ; DirectoryEntry result = lookUp ( workingDirectory , path , options , 0 ) ; if ( result == null ) { throw new NoSuchFileException ( path . toString ( ) ) ; } return result ; }
Returns the result of the file lookup for the given path .
25,883
private DirectoryEntry lookUp ( File dir , Iterable < Name > names , Set < ? super LinkOption > options , int linkDepth ) throws IOException { Iterator < Name > nameIterator = names . iterator ( ) ; Name name = nameIterator . next ( ) ; while ( nameIterator . hasNext ( ) ) { Directory directory = toDirectory ( dir ) ; if ( directory == null ) { return null ; } DirectoryEntry entry = directory . get ( name ) ; if ( entry == null ) { return null ; } File file = entry . file ( ) ; if ( file . isSymbolicLink ( ) ) { DirectoryEntry linkResult = followSymbolicLink ( dir , ( SymbolicLink ) file , linkDepth ) ; if ( linkResult == null ) { return null ; } dir = linkResult . fileOrNull ( ) ; } else { dir = file ; } name = nameIterator . next ( ) ; } return lookUpLast ( dir , name , options , linkDepth ) ; }
Looks up the given names against the given base file . If the file is not a directory the lookup fails .
25,884
private DirectoryEntry followSymbolicLink ( File dir , SymbolicLink link , int linkDepth ) throws IOException { if ( linkDepth >= MAX_SYMBOLIC_LINK_DEPTH ) { throw new IOException ( "too many levels of symbolic links" ) ; } return lookUp ( dir , link . target ( ) , Options . FOLLOW_LINKS , linkDepth + 1 ) ; }
Returns the directory entry located by the target path of the given symbolic link resolved relative to the given directory .
25,885
private static boolean isValidFileSystemUri ( URI uri ) { return isNullOrEmpty ( uri . getPath ( ) ) && isNullOrEmpty ( uri . getQuery ( ) ) && isNullOrEmpty ( uri . getFragment ( ) ) ; }
Returns whether or not the given URI is valid as a base file system URI . It must not have a path query or fragment .
25,886
private static URI toFileSystemUri ( URI uri ) { try { return new URI ( uri . getScheme ( ) , uri . getUserInfo ( ) , uri . getHost ( ) , uri . getPort ( ) , null , null , null ) ; } catch ( URISyntaxException e ) { throw new AssertionError ( e ) ; } }
Returns the given URI with any path query or fragment stripped off .
25,887
@ SuppressWarnings ( "unused" ) public static Runnable removeFileSystemRunnable ( final URI uri ) { return new Runnable ( ) { public void run ( ) { fileSystems . remove ( uri ) ; } } ; }
Returns a runnable that when run removes the file system with the given URI from this provider .
25,888
public static JimfsFileSystem newFileSystem ( JimfsFileSystemProvider provider , URI uri , Configuration config ) throws IOException { PathService pathService = new PathService ( config ) ; FileSystemState state = new FileSystemState ( removeFileSystemRunnable ( uri ) ) ; JimfsFileStore fileStore = createFileStore ( config , pathService , state ) ; FileSystemView defaultView = createDefaultView ( config , fileStore , pathService ) ; WatchServiceConfiguration watchServiceConfig = config . watchServiceConfig ; JimfsFileSystem fileSystem = new JimfsFileSystem ( provider , uri , fileStore , pathService , defaultView , watchServiceConfig ) ; pathService . setFileSystem ( fileSystem ) ; return fileSystem ; }
Initialize and configure a new file system with the given provider and URI using the given configuration .
25,889
private static JimfsFileStore createFileStore ( Configuration config , PathService pathService , FileSystemState state ) { AttributeService attributeService = new AttributeService ( config ) ; HeapDisk disk = new HeapDisk ( config ) ; FileFactory fileFactory = new FileFactory ( disk ) ; Map < Name , Directory > roots = new HashMap < > ( ) ; for ( String root : config . roots ) { JimfsPath path = pathService . parsePath ( root ) ; if ( ! path . isAbsolute ( ) && path . getNameCount ( ) == 0 ) { throw new IllegalArgumentException ( "Invalid root path: " + root ) ; } Name rootName = path . root ( ) ; Directory rootDir = fileFactory . createRootDirectory ( rootName ) ; attributeService . setInitialAttributes ( rootDir ) ; roots . put ( rootName , rootDir ) ; } return new JimfsFileStore ( new FileTree ( roots ) , fileFactory , disk , attributeService , config . supportedFeatures , state ) ; }
Creates the file store for the file system .
25,890
private static FileSystemView createDefaultView ( Configuration config , JimfsFileStore fileStore , PathService pathService ) throws IOException { JimfsPath workingDirPath = pathService . parsePath ( config . workingDirectory ) ; Directory dir = fileStore . getRoot ( workingDirPath . root ( ) ) ; if ( dir == null ) { throw new IllegalArgumentException ( "Invalid working dir path: " + workingDirPath ) ; } for ( Name name : workingDirPath . names ( ) ) { Directory newDir = fileStore . directoryCreator ( ) . get ( ) ; fileStore . setInitialAttributes ( newDir ) ; dir . link ( name , newDir ) ; dir = newDir ; } return new FileSystemView ( fileStore , dir , workingDirPath ) ; }
Creates the default view of the file system using the given working directory .
25,891
public synchronized void allocate ( RegularFile file , int count ) throws IOException { int newAllocatedBlockCount = allocatedBlockCount + count ; if ( newAllocatedBlockCount > maxBlockCount ) { throw new IOException ( "out of disk space" ) ; } int newBlocksNeeded = Math . max ( count - blockCache . blockCount ( ) , 0 ) ; for ( int i = 0 ; i < newBlocksNeeded ; i ++ ) { file . addBlock ( new byte [ blockSize ] ) ; } if ( newBlocksNeeded != count ) { blockCache . transferBlocksTo ( file , count - newBlocksNeeded ) ; } allocatedBlockCount = newAllocatedBlockCount ; }
Allocates the given number of blocks and adds them to the given file .
25,892
public static ImmutableSet < OpenOption > getOptionsForChannel ( Set < ? extends OpenOption > options ) { if ( options . isEmpty ( ) ) { return DEFAULT_READ ; } boolean append = options . contains ( APPEND ) ; boolean write = append || options . contains ( WRITE ) ; boolean read = ! write || options . contains ( READ ) ; if ( read ) { if ( append ) { throw new UnsupportedOperationException ( "'READ' + 'APPEND' not allowed" ) ; } if ( ! write ) { return options . contains ( LinkOption . NOFOLLOW_LINKS ) ? DEFAULT_READ_NOFOLLOW_LINKS : DEFAULT_READ ; } } return addWrite ( options ) ; }
Returns an immutable set of open options for opening a new file channel .
25,893
@ SuppressWarnings ( "unchecked" ) public static ImmutableSet < OpenOption > getOptionsForInputStream ( OpenOption ... options ) { boolean nofollowLinks = false ; for ( OpenOption option : options ) { if ( checkNotNull ( option ) != READ ) { if ( option == LinkOption . NOFOLLOW_LINKS ) { nofollowLinks = true ; } else { throw new UnsupportedOperationException ( "'" + option + "' not allowed" ) ; } } } return ( ImmutableSet < OpenOption > ) ( ImmutableSet < ? > ) ( nofollowLinks ? NOFOLLOW_LINKS : FOLLOW_LINKS ) ; }
Returns an immutable set of open options for opening a new input stream .
25,894
public static ImmutableSet < OpenOption > getOptionsForOutputStream ( OpenOption ... options ) { if ( options . length == 0 ) { return DEFAULT_WRITE ; } ImmutableSet < OpenOption > result = addWrite ( Arrays . asList ( options ) ) ; if ( result . contains ( READ ) ) { throw new UnsupportedOperationException ( "'READ' not allowed" ) ; } return result ; }
Returns an immutable set of open options for opening a new output stream .
25,895
public static ImmutableSet < CopyOption > getMoveOptions ( CopyOption ... options ) { return ImmutableSet . copyOf ( Lists . asList ( LinkOption . NOFOLLOW_LINKS , options ) ) ; }
Returns an immutable set of the given options for a move .
25,896
public static ImmutableSet < CopyOption > getCopyOptions ( CopyOption ... options ) { ImmutableSet < CopyOption > result = ImmutableSet . copyOf ( options ) ; if ( result . contains ( ATOMIC_MOVE ) ) { throw new UnsupportedOperationException ( "'ATOMIC_MOVE' not allowed" ) ; } return result ; }
Returns an immutable set of the given options for a copy .
25,897
private void appendNormal ( char c ) { if ( REGEX_RESERVED . matches ( c ) ) { builder . append ( '\\' ) ; } builder . append ( c ) ; }
Appends the regex form of the given normal character from the glob .
25,898
private void appendSeparator ( ) { if ( separators . length ( ) == 1 ) { appendNormal ( separators . charAt ( 0 ) ) ; } else { builder . append ( '[' ) ; for ( int i = 0 ; i < separators . length ( ) ; i ++ ) { appendInBracket ( separators . charAt ( i ) ) ; } builder . append ( "]" ) ; } }
Appends the regex form matching the separators for the path type .
25,899
private void appendNonSeparator ( ) { builder . append ( "[^" ) ; for ( int i = 0 ; i < separators . length ( ) ; i ++ ) { appendInBracket ( separators . charAt ( i ) ) ; } builder . append ( ']' ) ; }
Appends the regex form that matches anything except the separators for the path type .