idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
36,800
private boolean isStoppingStoppedOrFailed ( ) { BatchStatus jobBatchStatus = runtimeWorkUnitExecution . getBatchStatus ( ) ; if ( jobBatchStatus . equals ( BatchStatus . STOPPING ) || jobBatchStatus . equals ( BatchStatus . STOPPED ) || jobBatchStatus . equals ( BatchStatus . FAILED ) ) { return true ; } return false ; }
Today we know the PartitionedStepControllerImpl always runs in the JVM of the top - level job and so will be notified on the top - level stop .
36,801
private void partitionFinished ( PartitionReplyMsg msg ) { JoblogUtil . logToJobLogAndTraceOnly ( Level . FINE , "partition.ended" , new Object [ ] { msg . getPartitionPlanConfig ( ) . getPartitionNumber ( ) , msg . getBatchStatus ( ) , msg . getExitStatus ( ) , msg . getPartitionPlanConfig ( ) . getStepName ( ) , msg . getPartitionPlanConfig ( ) . getTopLevelNameInstanceExecutionInfo ( ) . getInstanceId ( ) , msg . getPartitionPlanConfig ( ) . getTopLevelNameInstanceExecutionInfo ( ) . getExecutionId ( ) } , logger ) ; finishedWork . add ( msg ) ; }
Issue message for partition finished and add it to the finishedWork list .
36,802
private void waitForNextPartitionToFinish ( List < Throwable > analyzerExceptions , List < Integer > finishedPartitions ) throws JobStoppingException { boolean isStoppingStoppedOrFailed = false ; PartitionReplyMsg msg = null ; do { if ( isMultiJvm ) { if ( isStoppingStoppedOrFailed ( ) ) { isStoppingStoppedOrFailed = true ; } } if ( isStoppingStoppedOrFailed ) { try { Thread . sleep ( PartitionReplyTimeoutConstants . BATCH_REPLY_MSG_SLEEP_AFTER_STOP ) ; } catch ( InterruptedException e ) { } while ( true ) { msg = waitForPartitionReplyMsgNoWait ( ) ; if ( msg != null ) { try { processPartitionReplyMsg ( msg ) ; } catch ( Throwable t ) { analyzerExceptions . add ( t ) ; } receivedLastMessageForPartition ( msg , finishedPartitions ) ; } else { throw new JobStoppingException ( ) ; } } } else { msg = waitForPartitionReplyMsg ( ) ; if ( msg == null ) { continue ; } } try { processPartitionReplyMsg ( msg ) ; } catch ( Throwable t ) { analyzerExceptions . add ( t ) ; } } while ( msg == null || ! receivedLastMessageForPartition ( msg , finishedPartitions ) ) ; }
Wait and process the data sent back by the partitions . This method returns as soon as the next partition sends back an i m finished message .
36,803
@ FFDCIgnore ( JobStoppingException . class ) private void executeAndWaitForCompletion ( PartitionPlanDescriptor currentPlan ) throws JobRestartException { if ( isStoppingStoppedOrFailed ( ) ) { logger . fine ( "Job already in " + runtimeWorkUnitExecution . getWorkUnitJobContext ( ) . getBatchStatus ( ) . toString ( ) + " state, exiting from executeAndWaitForCompletion() before beginning execution" ) ; return ; } List < Integer > partitionsToExecute = getPartitionNumbersToExecute ( currentPlan ) ; logger . fine ( "Partitions to execute in this run: " + partitionsToExecute + ". Total number of partitions in step: " + currentPlan . getNumPartitionsInPlan ( ) ) ; List < Integer > startedPartitions = new ArrayList < Integer > ( ) ; List < Integer > finishedPartitions = new ArrayList < Integer > ( ) ; List < Throwable > analyzerExceptions = new ArrayList < Throwable > ( ) ; while ( finishedPartitions . size ( ) < partitionsToExecute . size ( ) ) { startPartitions ( partitionsToExecute , startedPartitions , finishedPartitions , currentPlan ) ; if ( finishedPartitions . size ( ) >= partitionsToExecute . size ( ) ) { break ; } try { waitForNextPartitionToFinish ( analyzerExceptions , finishedPartitions ) ; } catch ( JobStoppingException e ) { break ; } } if ( ! analyzerExceptions . isEmpty ( ) ) { rollbackPartitionedStep ( ) ; throw new BatchContainerRuntimeException ( "Exception previously thrown by Analyzer, rolling back step." , analyzerExceptions . get ( 0 ) ) ; } }
Spawn the partitions and wait for them to complete .
36,804
private void checkFinishedPartitions ( ) { List < String > failingPartitionSeen = new ArrayList < String > ( ) ; boolean stoppedPartitionSeen = false ; for ( PartitionReplyMsg replyMsg : finishedWork ) { BatchStatus batchStatus = replyMsg . getBatchStatus ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "For partitioned step: " + getStepName ( ) + ", the partition # " + replyMsg . getPartitionPlanConfig ( ) . getPartitionNumber ( ) + " ended with status '" + batchStatus ) ; } if ( batchStatus . equals ( BatchStatus . FAILED ) ) { String msg = "For partitioned step: " + getStepName ( ) + ", the partition # " + replyMsg . getPartitionPlanConfig ( ) . getPartitionNumber ( ) + " ended with status '" + batchStatus ; failingPartitionSeen . add ( msg ) ; } if ( batchStatus . equals ( BatchStatus . STOPPED ) ) { stoppedPartitionSeen = true ; } } if ( ! failingPartitionSeen . isEmpty ( ) ) { markStepForFailure ( ) ; rollbackPartitionedStep ( ) ; throw new BatchContainerRuntimeException ( "One or more partitions failed: " + failingPartitionSeen ) ; } else if ( isStoppingStoppedOrFailed ( ) ) { rollbackPartitionedStep ( ) ; } else if ( stoppedPartitionSeen ) { markStepForFailure ( ) ; rollbackPartitionedStep ( ) ; } else { if ( this . partitionReducerProxy != null ) { this . partitionReducerProxy . beforePartitionedStepCompletion ( ) ; } } }
check the batch status of each subJob after it s done to see if we need to issue a rollback start rollback if any have stopped or failed
36,805
protected void invokePreStepArtifacts ( ) { if ( stepListeners != null ) { for ( StepListenerProxy listenerProxy : stepListeners ) { listenerProxy . beforeStep ( ) ; } } if ( this . partitionReducerProxy != null ) { this . partitionReducerProxy . beginPartitionedStep ( ) ; } }
Invoke the StepListeners and PartitionReducer .
36,806
private static String getClassNameandPath ( String className , Path path ) { if ( path == null ) { return getClassNameandPath ( className , "/" ) ; } else { return getClassNameandPath ( className , path . value ( ) ) ; } }
start Liberty change
36,807
private static boolean checkMethodDispatcher ( ClassResourceInfo cr ) { if ( cr . getMethodDispatcher ( ) . getOperationResourceInfos ( ) . isEmpty ( ) ) { LOG . warning ( new org . apache . cxf . common . i18n . Message ( "NO_RESOURCE_OP_EXC" , BUNDLE , cr . getServiceClass ( ) . getName ( ) ) . toString ( ) ) ; return false ; } return true ; }
end Liberty change
36,808
public void run ( ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . entry ( tc , "run" ) ; int numPools ; synchronized ( this ) { if ( ivIsCanceled ) { return ; } ivIsRunning = true ; numPools = pools . size ( ) ; if ( numPools > 0 ) { if ( numPools > poolArray . length ) { poolArray = new PoolImplBase [ numPools ] ; } pools . toArray ( poolArray ) ; } } try { for ( int i = 0 ; i < poolArray . length && poolArray [ i ] != null ; ++ i ) { if ( poolArray [ i ] . inactive ) { poolArray [ i ] . periodicDrain ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setting inactive: " + poolArray [ i ] ) ; poolArray [ i ] . inactive = true ; } poolArray [ i ] = null ; } } finally { synchronized ( this ) { ivIsRunning = false ; if ( ivIsCanceled ) { notify ( ) ; } else if ( ! pools . isEmpty ( ) ) { startAlarm ( ) ; } else { ivScheduledFuture = null ; } } } if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . exit ( tc , "run" ) ; }
Handle the scavenger alarm . Scan the list of pools and drain all inactive ones .
36,809
private Object addBatch ( Object implObject , Method method , Object [ ] args ) throws IllegalAccessException , IllegalArgumentException , InvocationTargetException , SQLException { Object sqljPstmt = args [ 0 ] ; final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "addBatch" , new Object [ ] { this , AdapterUtil . toString ( sqljPstmt ) } ) ; if ( sqljPstmt != null && Proxy . isProxyClass ( sqljPstmt . getClass ( ) ) ) { InvocationHandler handler = Proxy . getInvocationHandler ( sqljPstmt ) ; if ( handler instanceof WSJdbcWrapper ) args = new Object [ ] { ( ( WSJdbcWrapper ) handler ) . getJDBCImplObject ( ) } ; } return method . invoke ( implObject , args ) ; }
Invokes addBatch after replacing the parameter with the DB2 impl object if proxied .
36,810
private Object executeBatch ( Object implObject , Method method , Object [ ] args ) throws IllegalAccessException , IllegalArgumentException , InvocationTargetException , SQLException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "executeBatch" , new Object [ ] { this , args [ 0 ] } ) ; if ( childWrapper != null ) { closeAndRemoveResultSet ( ) ; } if ( childWrappers != null && ! childWrappers . isEmpty ( ) ) { closeAndRemoveResultSets ( ) ; } enforceStatementProperties ( ) ; Object results = method . invoke ( implObject , args ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "executeBatch" , results instanceof int [ ] ? Arrays . toString ( ( int [ ] ) results ) : results ) ; return results ; }
Invokes executeBatch and after closing any previous result sets and ensuring statement properties are up - to - date .
36,811
private Object getReturnResultSet ( Object implObject , Method method ) throws IllegalAccessException , IllegalArgumentException , InvocationTargetException , SQLException { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getReturnResultSet" , this ) ; WSJdbcResultSet rsetWrapper = null ; ResultSet rsetImpl = ( ResultSet ) method . invoke ( implObject ) ; if ( rsetImpl != null ) { if ( childWrapper == null && ( childWrappers == null || childWrappers . isEmpty ( ) ) ) { childWrapper = rsetWrapper = mcf . jdbcRuntime . newResultSet ( rsetImpl , this ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Set the result set to child wrapper" ) ; } else { if ( childWrappers == null ) childWrappers = new ArrayList < Wrapper > ( 5 ) ; rsetWrapper = mcf . jdbcRuntime . newResultSet ( rsetImpl , this ) ; childWrappers . add ( rsetWrapper ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Add the result set to child wrappers list." ) ; } } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getReturnResultSet" , rsetWrapper ) ; return rsetWrapper ; }
Invokes getReturnResultSet and wraps the result set .
36,812
public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { if ( ! haveStatementPropertiesChanged && VENDOR_PROPERTY_SETTERS . contains ( method . getName ( ) ) ) { haveStatementPropertiesChanged = true ; } if ( sqljSection != null && "getSection" . equals ( method . getName ( ) ) ) { return sqljSection ; } return super . invoke ( proxy , method , args ) ; }
Intercept the proxy handler to detect changes to statement properties that must be reset on cached statements .
36,813
public void nextRangeMaximumAvailable ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "nextRangeMaximumAvailable" ) ; synchronized ( _globalUniqueLock ) { _globalUniqueThreshold = _globalUniqueLimit + _midrange ; _globalUniqueLimit = _globalUniqueLimit + _range ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "nextRangeMaximumAvailable" ) ; }
Callback to inform the generator that the current range of available unique keys has now grown .
36,814
public byte [ ] transform ( ClassLoader loader , String className , Class < ? > classBeingRedefined , ProtectionDomain protectionDomain , byte [ ] classfileBuffer ) throws IllegalClassFormatException { if ( className . startsWith ( Transformer . class . getPackage ( ) . getName ( ) . replaceAll ( "\\." , "/" ) ) ) { return null ; } if ( className . startsWith ( "java/util/logging/" ) ) { return null ; } boolean include = false ; for ( String s : includesList ) { if ( className . startsWith ( s ) || s . equals ( "/" ) ) { include = true ; break ; } } for ( String s : excludesList ) { if ( className . startsWith ( s ) || s . equals ( "/" ) ) { include = false ; break ; } } if ( include == false ) { return null ; } String internalPackageName = className . replaceAll ( "/[^/]+$" , "" ) ; PackageInfo packageInfo = getPackageInfo ( internalPackageName ) ; if ( packageInfo == null && loader != null ) { String packageInfoResourceName = internalPackageName + "/package-info.class" ; InputStream is = loader . getResourceAsStream ( packageInfoResourceName ) ; packageInfo = processPackageInfo ( is ) ; addPackageInfo ( packageInfo ) ; } try { return transform ( new ByteArrayInputStream ( classfileBuffer ) ) ; } catch ( Throwable t ) { t . printStackTrace ( ) ; return null ; } }
Instrument the classes .
36,815
public String resolveString ( String value , boolean ignoreWarnings ) throws ConfigEvaluatorException { value = variableEvaluator . resolveVariables ( value , this , ignoreWarnings ) ; return value ; }
Tries to resolve variables .
36,816
@ SuppressWarnings ( "unchecked" ) public void init ( ) throws ServletException { String servlets = getRequiredInitParameter ( PARAM_SERVLET_PATHS ) ; StringTokenizer sTokenizer = new StringTokenizer ( servlets ) ; Vector servletChainPath = new Vector ( ) ; while ( sTokenizer . hasMoreTokens ( ) == true ) { String path = sTokenizer . nextToken ( ) . trim ( ) ; if ( path . length ( ) > 0 ) { servletChainPath . addElement ( path ) ; } } int chainLength = servletChainPath . size ( ) ; if ( chainLength > 0 ) { this . chainPath = new String [ chainLength ] ; for ( int index = 0 ; index < chainLength ; ++ index ) { this . chainPath [ index ] = ( String ) servletChainPath . elementAt ( index ) ; } } }
Initialize the servlet chainer .
36,817
public void service ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { ServletChain chain = new ServletChain ( ) ; try { String path = null ; for ( int index = 0 ; index < this . chainPath . length ; ++ index ) { path = this . chainPath [ index ] ; RequestDispatcher rDispatcher = getServletContext ( ) . getRequestDispatcher ( path ) ; chain . addRequestDispatcher ( rDispatcher ) ; } chain . forward ( new HttpServletRequestWrapper ( request ) , new HttpServletResponseWrapper ( response ) ) ; } finally { if ( chain != null ) { chain . clear ( ) ; } } }
Handle a servlet request by chaining the configured list of servlets . Only the final response in the chain will be sent back to the client . This servlet does not actual generate any content . This servlet only constructs and processes the servlet chain .
36,818
String getRequiredInitParameter ( String name ) throws ServletException { String value = getInitParameter ( name ) ; if ( value == null ) { throw new ServletException ( MessageFormat . format ( nls . getString ( "Missing.required.initialization.parameter" , "Missing required initialization parameter: {0}" ) , new Object [ ] { name } ) ) ; } return value ; }
Retrieve a required init parameter by name .
36,819
private void initializePermissions ( ) { int count = 0 ; if ( tc . isDebugEnabled ( ) ) { if ( isServer ) { Tr . debug ( tc , "running on server " ) ; } else { Tr . debug ( tc , "running on client " ) ; } } if ( isServer ) { count = DEFAULT_SERVER_RESTRICTABLE_PERMISSIONS . length ; originationFile = SERVER_XML ; } else { count = DEFAULT_CLIENT_RESTRICTABLE_PERMISSIONS . length ; originationFile = CLIENT_XML ; } for ( int i = 0 ; i < count ; i ++ ) { if ( isServer ) { restrictablePermissions . add ( DEFAULT_SERVER_RESTRICTABLE_PERMISSIONS [ i ] ) ; } else { restrictablePermissions . add ( DEFAULT_CLIENT_RESTRICTABLE_PERMISSIONS [ i ] ) ; } } if ( permissions != null && ! permissions . isEmpty ( ) ) { Iterable < JavaPermissionsConfiguration > javaPermissions = permissions . services ( ) ; if ( javaPermissions != null ) { for ( JavaPermissionsConfiguration permission : javaPermissions ) { String permissionClass = String . valueOf ( permission . get ( JavaPermissionsConfiguration . PERMISSION ) ) ; String target = String . valueOf ( permission . get ( JavaPermissionsConfiguration . TARGET_NAME ) ) ; String action = String . valueOf ( permission . get ( JavaPermissionsConfiguration . ACTIONS ) ) ; String credential = String . valueOf ( permission . get ( JavaPermissionsConfiguration . SIGNED_BY ) ) ; String principalType = String . valueOf ( permission . get ( JavaPermissionsConfiguration . PRINCIPAL_TYPE ) ) ; String principalName = String . valueOf ( permission . get ( JavaPermissionsConfiguration . PRINCIPAL_NAME ) ) ; String codebase = normalize ( String . valueOf ( permission . get ( JavaPermissionsConfiguration . CODE_BASE ) ) ) ; Permission perm = createPermissionObject ( permissionClass , target , action , credential , principalType , principalName , originationFile ) ; boolean isRestriction = false ; if ( permission . get ( JavaPermissionsConfiguration . RESTRICTION ) != null ) { isRestriction = ( ( Boolean ) permission . get ( JavaPermissionsConfiguration . RESTRICTION ) ) . booleanValue ( ) ; } if ( isRestriction ) { if ( perm != null ) { restrictablePermissions . add ( perm ) ; } } else { if ( perm != null ) { if ( codebase != null && ! codebase . equalsIgnoreCase ( "null" ) ) { setCodeBasePermission ( codebase , perm ) ; } else { grantedPermissions . add ( perm ) ; } } } } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "restrictablePermissions : " + restrictablePermissions ) ; Tr . debug ( tc , "grantedPermissions : " + grantedPermissions ) ; } } } setSharedLibraryPermission ( ) ; }
InvocationTargetException . class NoSuchMethodException . class SecurityException . class } )
36,820
public PermissionCollection getCombinedPermissions ( PermissionCollection staticPolicyPermissionCollection , CodeSource codesource ) { Permissions effectivePermissions = new Permissions ( ) ; List < Permission > staticPolicyPermissions = Collections . list ( staticPolicyPermissionCollection . elements ( ) ) ; String codeBase = codesource . getLocation ( ) . getPath ( ) ; ArrayList < Permission > permissions = getEffectivePermissions ( staticPolicyPermissions , codeBase ) ; for ( Permission permission : permissions ) { effectivePermissions . add ( permission ) ; } return effectivePermissions ; }
Combine the static permissions with the server . xml and permissions . xml permissions removing any restricted permission . This is called back from the dynamic policy to obtain the permissions for the JSP classes .
36,821
private boolean isRestricted ( Permission permission ) { for ( Permission restrictedPermission : restrictablePermissions ) { if ( restrictedPermission . implies ( permission ) ) { return true ; } } return false ; }
Check if this is a restricted permission .
36,822
public void addPermissionsXMLPermission ( CodeSource codeSource , Permission permission ) { ArrayList < Permission > permissions = null ; String codeBase = codeSource . getLocation ( ) . getPath ( ) ; if ( ! isRestricted ( permission ) ) { if ( permissionXMLPermissionMap . containsKey ( codeBase ) ) { permissions = permissionXMLPermissionMap . get ( codeBase ) ; permissions . add ( permission ) ; } else { permissions = new ArrayList < Permission > ( ) ; permissions . add ( permission ) ; permissionXMLPermissionMap . put ( codeBase , permissions ) ; } } }
Adds a permission from the permissions . xml file for the given CodeSource .
36,823
public NonDelayedClassInfo getClassInfo ( ) { String useName = getName ( ) ; NonDelayedClassInfo useClassInfo = this . classInfo ; if ( useClassInfo != null ) { if ( ! useClassInfo . isJavaClass ( ) && ! ( useClassInfo . isAnnotationPresent ( ) || useClassInfo . isFieldAnnotationPresent ( ) || useClassInfo . isMethodAnnotationPresent ( ) ) ) { getInfoStore ( ) . recordAccess ( useClassInfo ) ; } return useClassInfo ; } useClassInfo = getInfoStore ( ) . resolveClassInfo ( useName ) ; String [ ] useLogParms = getLogParms ( ) ; if ( useLogParms != null ) { useLogParms [ EXTRA_DATA_OFFSET_0 ] = useName ; } if ( useClassInfo == null ) { if ( useLogParms != null ) { Tr . debug ( tc , MessageFormat . format ( "[ {0} ] - Class not found [ {1} ]" , ( Object [ ] ) useLogParms ) ) ; } useClassInfo = new NonDelayedClassInfo ( useName , getInfoStore ( ) ) ; this . isArtificial = true ; getInfoStore ( ) . getClassInfoCache ( ) . addClassInfo ( useClassInfo ) ; } useClassInfo . setDelayedClassInfo ( this ) ; this . classInfo = useClassInfo ; if ( useLogParms != null ) { useLogParms [ EXTRA_DATA_OFFSET_1 ] = this . classInfo . getHashText ( ) ; if ( this . isArtificial ) { Tr . debug ( tc , MessageFormat . format ( "[ {0} ] RETURN [ {1} ] as [ {2} ] ** ARTFICIAL **" , ( Object [ ] ) useLogParms ) ) ; } else { Tr . debug ( tc , MessageFormat . format ( "[ {0} ] RETURN [ {1} ] as [ {2} ] " , ( Object [ ] ) useLogParms ) ) ; } } return useClassInfo ; }
Assignments to the extra data of the log parms may not be held across other method calls .
36,824
protected void intialiseNonPersistent ( MultiMEProxyHandler proxyHandler , Neighbours neighbours ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "intialiseNonPersistent" ) ; iProxyHandler = proxyHandler ; iNeighbours = neighbours ; iDestinationManager = iProxyHandler . getMessageProcessor ( ) . getDestinationManager ( ) ; iRemoteQueue = SIMPUtils . createJsSystemDestinationAddress ( SIMPConstants . PROXY_SYSTEM_DESTINATION_PREFIX , iMEUuid , iBusId ) ; if ( iMEUuid == null ) iMEUuid = iRemoteQueue . getME ( ) ; iProxies = new Hashtable ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "intialiseNonPersistent" ) ; }
Setup the non persistent state .
36,825
public final SIBUuid8 getUUID ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getUUID" ) ; SibTr . exit ( tc , "getUUID" , iMEUuid ) ; } return iMEUuid ; }
Gets the UUID for this Neighbour
36,826
public final String getBusId ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getBusId" ) ; SibTr . exit ( tc , "getBusId" , iBusId ) ; } return iBusId ; }
Get the Bus name for this Neighbour
36,827
BusGroup getBus ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getBus" ) ; SibTr . exit ( tc , "getBus" , iBusGroup ) ; } return iBusGroup ; }
Gets the Bus for this Neighbour
36,828
void setBus ( BusGroup busGroup ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setBus" ) ; iBusGroup = busGroup ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setBus" ) ; }
Sets the Bus for this Neighbour
36,829
private synchronized void createProducerSession ( ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createProducerSession" ) ; if ( iProducerSession == null ) { try { iProducerSession = ( ProducerSessionImpl ) iProxyHandler . getMessageProcessor ( ) . getSystemConnection ( ) . createSystemProducerSession ( iRemoteQueue , null , null , null , null ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.proxyhandler.Neighbour.createProducerSession" , "1:434:1.107" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createProducerSession" , "SIResourceException" ) ; throw new SIResourceException ( e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createProducerSession" ) ; }
Creates a producer session for sending the proxy messages to the Neighbours
36,830
MESubscription proxyRegistered ( SIBUuid12 topicSpaceUuid , String localTopicSpaceName , String topic , String foreignTSName , Transaction transaction , boolean foreignSecuredProxy , String MESubUserId ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "proxyRegistered" , new Object [ ] { topicSpaceUuid , localTopicSpaceName , topic , foreignTSName , transaction , new Boolean ( foreignSecuredProxy ) , MESubUserId } ) ; final String key = BusGroup . subscriptionKey ( topicSpaceUuid , topic ) ; MESubscription sub = ( MESubscription ) iProxies . get ( key ) ; if ( sub != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unmarking subscription " + sub ) ; sub . unmark ( ) ; boolean attrChanged = checkForeignSecurityAttributesChanged ( sub , foreignSecuredProxy , MESubUserId ) ; if ( attrChanged ) { try { sub . requestUpdate ( transaction ) ; } catch ( MessageStoreException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.proxyhandler.Neighbour.proxyRegistered" , "1:522:1.107" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour" , "1:529:1.107" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "proxyRegistered" , "SIResourceException" ) ; throw new SIResourceException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour" , "1:539:1.107" , e } , null ) , e ) ; } } sub = null ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Subscription being created" ) ; sub = new MESubscription ( topicSpaceUuid , localTopicSpaceName , topic , foreignTSName , foreignSecuredProxy , MESubUserId ) ; try { addItem ( sub , transaction ) ; } catch ( MessageStoreException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.proxyhandler.Neighbour.proxyRegistered" , "1:574:1.107" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour" , "1:581:1.107" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "proxyRegistered" , "SIResourceException" ) ; throw new SIResourceException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour" , "1:591:1.107" , e } , null ) , e ) ; } iProxies . put ( key , sub ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "proxyRegistered" , sub ) ; return sub ; }
proxyRegistered is called on this Neighbour object when a proxy subscription is received from a Neighbour .
36,831
protected void removeSubscription ( SIBUuid12 topicSpace , String topic ) { final String key = BusGroup . subscriptionKey ( topicSpace , topic ) ; iProxies . remove ( key ) ; }
Remove the subscription in the case of a rollback
36,832
MESubscription proxyDeregistered ( SIBUuid12 topicSpace , String topic , Transaction transaction ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "proxyDeregistered" , new Object [ ] { topicSpace , topic , transaction } ) ; final String key = BusGroup . subscriptionKey ( topicSpace , topic ) ; final MESubscription sub = ( MESubscription ) iProxies . get ( key ) ; if ( sub != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Subscription " + sub + " being removed" ) ; try { sub . remove ( transaction , sub . getLockID ( ) ) ; } catch ( MessageStoreException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.proxyhandler.Neighbour.proxyDeregistered" , "1:669:1.107" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour" , "1:676:1.107" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "proxyDeregistered" , "SIResourceException" ) ; throw new SIResourceException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.Neighbour" , "1:686:1.107" , e } , null ) , e ) ; } iProxies . remove ( key ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "No Subscription to be removed" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "proxyDeregistered" , sub ) ; return sub ; }
proxyDeregistered is called on this Neighbour object when a delete proxy subscription is received from a Neighbour .
36,833
protected void addSubscription ( SIBUuid12 topicSpace , String topic , MESubscription subscription ) { final String key = BusGroup . subscriptionKey ( topicSpace , topic ) ; iProxies . put ( key , subscription ) ; }
Adds the rolled back subscription to the list .
36,834
protected MESubscription getSubscription ( SIBUuid12 topicSpace , String topic ) { return ( MESubscription ) iProxies . get ( BusGroup . subscriptionKey ( topicSpace , topic ) ) ; }
Gets the MESubscription represented from this topicSpace and topic
36,835
void markAllProxies ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "markAllProxies" ) ; final Enumeration enu = iProxies . elements ( ) ; while ( enu . hasMoreElements ( ) ) { final MESubscription sub = ( MESubscription ) enu . nextElement ( ) ; sub . mark ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "markAllProxies" ) ; }
Marks all the proxies from this Neighbour .
36,836
void sweepMarkedProxies ( List topicSpaces , List topics , Transaction transaction , boolean okToForward ) throws SIResourceException , SIException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "sweepMarkedProxies" , new Object [ ] { topicSpaces , topics , transaction , new Boolean ( okToForward ) } ) ; final Enumeration enu = iProxies . elements ( ) ; while ( enu . hasMoreElements ( ) ) { final MESubscription sub = ( MESubscription ) enu . nextElement ( ) ; if ( sub . isMarked ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Subscription " + sub + " being removed" ) ; proxyDeregistered ( sub . getTopicSpaceUuid ( ) , sub . getTopic ( ) , transaction ) ; final boolean proxyDeleted = iNeighbours . deleteProxy ( iDestinationManager . getDestinationInternal ( sub . getTopicSpaceUuid ( ) , false ) , sub , this , sub . getTopicSpaceUuid ( ) , sub . getTopic ( ) , true , false ) ; final String key = BusGroup . subscriptionKey ( sub . getTopicSpaceUuid ( ) , sub . getTopic ( ) ) ; iProxies . remove ( key ) ; if ( okToForward && proxyDeleted ) { topics . add ( sub . getTopic ( ) ) ; topicSpaces . add ( sub . getTopicSpaceUuid ( ) ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sweepMarkedProxies" ) ; }
Removes all Subscriptions that are no longer registered
36,837
void sendToNeighbour ( JsMessage message , Transaction transaction ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "sendToNeighbour" , new Object [ ] { message , transaction } ) ; if ( iProducerSession == null ) createProducerSession ( ) ; try { iProducerSession . send ( ( SIBusMessage ) message , ( SITransaction ) transaction ) ; } catch ( SIException e ) { SibTr . exception ( tc , e ) ; SibTr . warning ( tc , "PUBSUB_CONSISTENCY_ERROR_CWSIP0383" , new Object [ ] { JsAdminUtils . getMENameByUuidForMessage ( iMEUuid . toString ( ) ) , e } ) ; SIResourceException ee = null ; if ( ! ( e instanceof SIResourceException ) ) ee = new SIResourceException ( e ) ; else ee = ( SIResourceException ) e ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendToNeighbour" , ee ) ; throw ee ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendToNeighbour" ) ; }
Forwards the message given onto this Neighbours Queue .
36,838
protected void recoverSubscriptions ( MultiMEProxyHandler proxyHandler ) throws MessageStoreException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "recoverSubscriptions" , proxyHandler ) ; iProxyHandler = proxyHandler ; iProxies = new Hashtable ( ) ; NonLockingCursor cursor = null ; try { cursor = newNonLockingItemCursor ( new ClassEqualsFilter ( MESubscription . class ) ) ; AbstractItem item = null ; while ( ( item = cursor . next ( ) ) != null ) { MESubscription sub = null ; sub = ( MESubscription ) item ; final String key = BusGroup . subscriptionKey ( sub . getTopicSpaceUuid ( ) , sub . getTopic ( ) ) ; iProxies . put ( key , sub ) ; iNeighbours . createProxy ( this , iDestinationManager . getDestinationInternal ( sub . getTopicSpaceUuid ( ) , false ) , sub , sub . getTopicSpaceUuid ( ) , sub . getTopic ( ) , true ) ; sub . eventPostCommitAdd ( null ) ; } } finally { if ( cursor != null ) cursor . finished ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "recoverSubscriptions" ) ; }
Recovers the Neighbours subscriptions that it had registered .
36,839
protected void deleteDestination ( ) throws SIConnectionLostException , SIResourceException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteDestination" ) ; synchronized ( this ) { if ( iProducerSession != null ) iProducerSession . close ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Removing destination " + iRemoteQueue . getDestinationName ( ) ) ; try { iDestinationManager . deleteSystemDestination ( iRemoteQueue ) ; } catch ( SINotPossibleInCurrentConfigurationException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Destination " + iRemoteQueue + " already deleted" ) ; } synchronized ( this ) { if ( ! iAlarmCancelled ) { if ( iAlarm != null ) iAlarm . cancel ( ) ; iAlarmCancelled = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteDestination" ) ; }
Deletes the Queue that would be used for sending proxy update messages to this remote ME .
36,840
protected void addPubSubOutputHandler ( PubSubOutputHandler handler ) { if ( iPubSubOutputHandlers == null ) iPubSubOutputHandlers = new HashSet ( ) ; iPubSubOutputHandlers . add ( handler ) ; }
Add a PubSubOutputHandler to the list of PubSubOutputHandlers that this neighbour knows about .
36,841
void setRequestedProxySubscriptions ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setRequestedProxySubscriptions" ) ; MPAlarmManager manager = iProxyHandler . getMessageProcessor ( ) . getAlarmManager ( ) ; iAlarm = manager . create ( REQUEST_TIMER , this ) ; synchronized ( this ) { iRequestSent = true ; iAlarmCancelled = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setRequestedProxySubscriptions" ) ; }
Indicate that we have sent a request message to this neighbour .
36,842
void setRequestedProxySubscriptionsResponded ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setRequestedProxySubscriptionsResponded" ) ; synchronized ( this ) { iRequestSent = false ; if ( ! iAlarmCancelled ) iAlarm . cancel ( ) ; iAlarmCancelled = true ; } String meName = JsAdminUtils . getMENameByUuidForMessage ( iMEUuid . toString ( ) ) ; if ( meName == null ) meName = iMEUuid . toString ( ) ; SibTr . push ( iProxyHandler . getMessageProcessor ( ) . getMessagingEngine ( ) ) ; SibTr . info ( tc , "NEIGHBOUR_REPLY_RECIEVED_INFO_CWSIP0382" , new Object [ ] { meName } ) ; SibTr . pop ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setRequestedProxySubscriptionsResponded" ) ; }
The request for proxy subscriptions was responded to .
36,843
boolean wasProxyRequestSent ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "wasProxyRequestSent" ) ; SibTr . exit ( tc , "wasProxyRequestSent" , new Boolean ( iRequestSent ) ) ; } return iRequestSent ; }
If a request message was sent to this neighbour for the proxy subscriptions
36,844
protected void deleteSystemDestinations ( ) throws SIConnectionLostException , SIResourceException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteSystemDestinations" ) ; synchronized ( this ) { if ( iProducerSession != null ) iProducerSession . close ( ) ; } List systemDestinations = iDestinationManager . getAllSystemDestinations ( iMEUuid ) ; Iterator itr = systemDestinations . iterator ( ) ; while ( itr . hasNext ( ) ) { JsDestinationAddress destAddress = ( JsDestinationAddress ) itr . next ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Removing destination " + destAddress . getDestinationName ( ) ) ; try { iDestinationManager . deleteSystemDestination ( destAddress ) ; } catch ( SINotPossibleInCurrentConfigurationException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Destination " + destAddress + " already deleted" ) ; } } synchronized ( this ) { if ( ! iAlarmCancelled ) { if ( iAlarm != null ) iAlarm . cancel ( ) ; iAlarmCancelled = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteSystemDestinations" ) ; }
Deletes all remote system destinations that are on referencing the me that this neighbour is referenced too .
36,845
private boolean checkForeignSecurityAttributesChanged ( MESubscription sub , boolean foreignSecuredProxy , String MESubUserId ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkForeignSecurityAttributesChanged" , new Object [ ] { sub , new Boolean ( foreignSecuredProxy ) , MESubUserId } ) ; boolean attrChanged = false ; if ( foreignSecuredProxy ) { if ( sub . isForeignSecuredProxy ( ) ) { if ( MESubUserId != null ) { if ( sub . getMESubUserId ( ) != null ) { if ( ! MESubUserId . equals ( sub . getMESubUserId ( ) ) ) { sub . setMESubUserId ( MESubUserId ) ; attrChanged = true ; } } else { sub . setMESubUserId ( MESubUserId ) ; attrChanged = true ; } } else { if ( sub . getMESubUserId ( ) != null ) { sub . setMESubUserId ( null ) ; attrChanged = true ; } } } else { sub . setForeignSecuredProxy ( true ) ; sub . setMESubUserId ( MESubUserId ) ; attrChanged = true ; } } else { if ( sub . isForeignSecuredProxy ( ) ) { sub . setForeignSecuredProxy ( false ) ; sub . setMESubUserId ( null ) ; attrChanged = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkForeignSecurityAttributesChanged" , new Boolean ( attrChanged ) ) ; return attrChanged ; }
checkForeignSecurityAttributesChanged is called in order to determine whether security attributes have changed .
36,846
synchronized void resetListFailed ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "resetListFailed" ) ; iRequestFailed = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "resetListFailed" ) ; }
Method indicates that the reset list failed - update the alarm to indicate that this failed .
36,847
public boolean isDeclaredAnnotationWithin ( Collection < String > annotationNames ) { if ( declaredAnnotations != null ) { for ( AnnotationInfo annotation : declaredAnnotations ) { if ( annotationNames . contains ( annotation . getAnnotationClassName ( ) ) ) { return true ; } } } return false ; }
Optimized to iterate across the declared annotations first .
36,848
private void readObject ( ObjectInputStream s ) throws IOException , ClassNotFoundException { ObjectInputStream . GetField getField = s . readFields ( ) ; version = getField . get ( "version" , 1 ) ; resourceAdapterKey = ( String ) getField . get ( "resourceAdapterKey" , null ) ; }
Overrides the default deserialization .
36,849
private void writeObject ( ObjectOutputStream s ) throws IOException { ObjectOutputStream . PutField putField = s . putFields ( ) ; putField . put ( "version" , version ) ; putField . put ( "resourceAdapterKey" , resourceAdapterKey ) ; s . writeFields ( ) ; }
Overrides the default serialization .
36,850
static void notifyTimeout ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "notifyTimeout" ) ; synchronized ( SUSPEND_LOCK ) { if ( _tokenManager . isResumable ( ) ) { if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Resuming recovery log service following a suspension timeout" ) ; _isSuspended = false ; Tr . info ( tc , "CWRLS0023_RESUME_RLS" ) ; SUSPEND_LOCK . notifyAll ( ) ; } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "notifyTimeout" ) ; }
Called by the RLSSuspendTokenManager in the event of a suspension timeout occurring
36,851
protected synchronized final Transaction getExternalTransaction ( ) { final String methodName = "getExternalTransaction" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName ) ; Transaction transaction = null ; if ( transactionReference != null ) transaction = ( Transaction ) transactionReference . get ( ) ; if ( transaction == null ) { transaction = new Transaction ( this ) ; transactionReference = new TransactionReference ( this , transaction ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { transaction } ) ; return transaction ; }
Create the extrnal transaction for use by the public interface from this InternalTransaction .
36,852
protected synchronized void requestCallback ( Token token , Transaction transaction ) throws ObjectManagerException { final String methodName = "requestCallback" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { token , transaction } ) ; if ( transaction . internalTransaction != this ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { "via InvalidTransactionException" , transaction . internalTransaction } ) ; throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; } setState ( nextStateForRequestCallback ) ; callbackTokens . add ( token ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Note a request for the Token in the transaction to be called at prePrepare preCommit preBackout postCommit and postBackout .
36,853
protected synchronized void addFromCheckpoint ( ManagedObject managedObject , Transaction transaction ) throws ObjectManagerException { final String methodName = "addFromCheckpoint" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { managedObject , transaction } ) ; managedObject . preAdd ( transaction ) ; setState ( nextStateForInvolvePersistentObjectFromCheckpoint ) ; includedManagedObjects . put ( managedObject . owningToken , managedObject ) ; if ( ! logSequenceNumbers . containsKey ( managedObject . owningToken ) ) { logSequenceNumbers . put ( managedObject . owningToken , new Long ( 0 ) ) ; managedObjectSequenceNumbers . put ( managedObject . owningToken , new Long ( 0 ) ) ; } managedObject . postAdd ( transaction , true ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Recover an Add operation from a checkpoint .
36,854
protected synchronized void replaceFromCheckpoint ( ManagedObject managedObject , byte [ ] serializedBytes , Transaction transaction ) throws ObjectManagerException { final String methodName = "replaceFromCheckpoint" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { managedObject , new Integer ( serializedBytes . length ) , transaction } ) ; managedObject . preReplace ( transaction ) ; setState ( nextStateForInvolvePersistentObjectFromCheckpoint ) ; includedManagedObjects . put ( managedObject . owningToken , managedObject ) ; if ( ! logSequenceNumbers . containsKey ( managedObject . owningToken ) ) { logSequenceNumbers . put ( managedObject . owningToken , new Long ( 0 ) ) ; managedObjectSequenceNumbers . put ( managedObject . owningToken , new Long ( 0 ) ) ; loggedSerializedBytes . put ( managedObject . owningToken , serializedBytes ) ; } managedObject . postReplace ( transaction , true ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Recover a Replace operation from a checkpoint .
36,855
protected synchronized void prepare ( Transaction transaction ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "prepare" , "transaction=" + transaction + "(Trasnaction)" ) ; if ( transaction . internalTransaction != this ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "prepare" , new Object [ ] { "via InvalidTransactionException" , transaction . internalTransaction } ) ; throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; } prePrepare ( transaction ) ; if ( state == statePrePreparedPersistent ) { TransactionPrepareLogRecord transactionPrepareLogRecord = new TransactionPrepareLogRecord ( this ) ; objectManagerState . logOutput . writeNext ( transactionPrepareLogRecord , 0 , true , true ) ; } setState ( nextStateForPrepare ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "prepare" ) ; }
Prepare the transaction . After execution of this method the users of this transaction shall not perform any further work as part of the logical unit of work or modify any of the objects that are referenced by the transaction .
36,856
protected void commit ( boolean reUse , Transaction transaction ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "commit" , new Object [ ] { new Boolean ( reUse ) , transaction } ) ; boolean persistentWorkDone = false ; ManagedObject [ ] lockedManagedObjects ; int numberOfLockedManagedObjects = 0 ; synchronized ( this ) { if ( transaction . internalTransaction != this ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "commit" , new Object [ ] { "via InvalidTransactionException" , transaction . internalTransaction } ) ; throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; } if ( state == stateInactive || state == stateActiveNonPersistent || state == stateActivePersistent ) { prePrepare ( transaction ) ; } testState ( nextStateForStartCommit ) ; setState ( nextStateForStartCommit ) ; preCommit ( transaction ) ; if ( state == stateCommitingPersistent ) { persistentWorkDone = true ; TransactionCommitLogRecord transactionCommitLogRecord = new TransactionCommitLogRecord ( this ) ; objectManagerState . logOutput . writeNext ( transactionCommitLogRecord , - logSpaceReserved , true , true ) ; logSpaceReserved = 0 ; } lockedManagedObjects = new ManagedObject [ includedManagedObjects . size ( ) ] ; boolean requiresCurrentPersistentCheckpoint = requiresPersistentCheckpoint || ( objectManagerState . checkpointStarting == ObjectManagerState . CHECKPOINT_STARTING_PERSISTENT ) ; for ( java . util . Iterator managedObjectIterator = includedManagedObjects . values ( ) . iterator ( ) ; managedObjectIterator . hasNext ( ) ; ) { ManagedObject managedObject = ( ManagedObject ) managedObjectIterator . next ( ) ; ObjectManagerByteArrayOutputStream serializedBytes = ( ObjectManagerByteArrayOutputStream ) loggedSerializedBytes . get ( managedObject . owningToken ) ; long managedObjectSequenceNumber = ( ( Long ) managedObjectSequenceNumbers . get ( managedObject . owningToken ) ) . longValue ( ) ; if ( managedObject . lockedBy ( transaction ) ) { managedObject . commit ( transaction , serializedBytes , managedObjectSequenceNumber , requiresCurrentPersistentCheckpoint ) ; lockedManagedObjects [ numberOfLockedManagedObjects ++ ] = managedObject ; } else { managedObject . optimisticReplaceCommit ( transaction , serializedBytes , managedObjectSequenceNumber , requiresCurrentPersistentCheckpoint ) ; } } setState ( nextStateForCommit ) ; transactionLock . unLock ( objectManagerState ) ; postCommit ( transaction ) ; complete ( reUse , transaction ) ; } for ( int i = 0 ; i < numberOfLockedManagedObjects ; i ++ ) { synchronized ( lockedManagedObjects [ i ] ) { lockedManagedObjects [ i ] . notify ( ) ; } } objectManagerState . transactionCompleted ( this , persistentWorkDone ) ; if ( reUse ) objectManagerState . transactionPacing ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "commit" ) ; }
Commit the transaction . Fore write a commit record to the log . Unlock the objects that are part of this logical unit of work .
36,857
protected void backout ( boolean reUse , Transaction transaction ) throws ObjectManagerException { final String methodName = "backout" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { new Boolean ( reUse ) , transaction } ) ; boolean persistentWorkDone = false ; ManagedObject [ ] lockedManagedObjects ; int numberOfLockedManagedObjects = 0 ; synchronized ( this ) { if ( transaction . internalTransaction != this ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { "via InvalidTransactionException" , transaction . internalTransaction } ) ; throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; } if ( state == stateInactive || state == stateActiveNonPersistent || state == stateActivePersistent ) { prePrepare ( transaction ) ; } testState ( nextStateForStartBackout ) ; setState ( nextStateForStartBackout ) ; preBackout ( transaction ) ; if ( state == stateBackingOutPersistent ) { persistentWorkDone = true ; TransactionBackoutLogRecord transactionBackoutLogRecord = new TransactionBackoutLogRecord ( this ) ; objectManagerState . logOutput . writeNext ( transactionBackoutLogRecord , - logSpaceReserved , true , true ) ; logSpaceReserved = 0 ; } lockedManagedObjects = new ManagedObject [ includedManagedObjects . size ( ) ] ; boolean requiresCurrentPersistentCheckpoint = requiresPersistentCheckpoint || ( objectManagerState . checkpointStarting == ObjectManagerState . CHECKPOINT_STARTING_PERSISTENT ) ; for ( java . util . Iterator managedObjectIterator = includedManagedObjects . values ( ) . iterator ( ) ; managedObjectIterator . hasNext ( ) ; ) { ManagedObject managedObject = ( ManagedObject ) managedObjectIterator . next ( ) ; long managedObjectSequenceNumber = ( ( Long ) managedObjectSequenceNumbers . get ( managedObject . owningToken ) ) . longValue ( ) ; if ( managedObject . lockedBy ( transaction ) ) { managedObject . backout ( transaction , managedObjectSequenceNumber , requiresCurrentPersistentCheckpoint ) ; lockedManagedObjects [ numberOfLockedManagedObjects ++ ] = managedObject ; } else { ObjectManagerByteArrayOutputStream serializedBytes = ( ObjectManagerByteArrayOutputStream ) loggedSerializedBytes . get ( managedObject . owningToken ) ; managedObject . optimisticReplaceBackout ( transaction , serializedBytes , managedObjectSequenceNumber , requiresCurrentPersistentCheckpoint ) ; } } setState ( nextStateForBackout ) ; transactionLock . unLock ( objectManagerState ) ; postBackout ( transaction ) ; complete ( reUse , transaction ) ; } for ( int i = 0 ; i < numberOfLockedManagedObjects ; i ++ ) { synchronized ( lockedManagedObjects [ i ] ) { lockedManagedObjects [ i ] . notify ( ) ; } } objectManagerState . transactionCompleted ( this , persistentWorkDone ) ; if ( reUse ) objectManagerState . transactionPacing ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Rollback the transacion . Force a backout record to the log .
36,858
void preBackout ( Transaction transaction ) throws ObjectManagerException { final String methodName = "preBackout" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { transaction } ) ; for ( java . util . Iterator tokenIterator = callbackTokens . iterator ( ) ; tokenIterator . hasNext ( ) ; ) { Token token = ( Token ) tokenIterator . next ( ) ; ManagedObject managedObject = token . getManagedObject ( ) ; managedObject . preBackout ( transaction ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Before the transaction is backed out give the ManagedObjects a chance to adjust their transient state to reflect the final outcome . It is too late for them to adjust persistent state as that is already written to the log assuming an outcome of Commit .
36,859
private final void complete ( boolean reUse , Transaction transaction ) throws ObjectManagerException { final String methodName = "complete" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { new Boolean ( reUse ) , transaction } ) ; requiresPersistentCheckpoint = false ; logicalUnitOfWork . XID = null ; transactionLock = new TransactionLock ( this ) ; includedManagedObjects . clear ( ) ; callbackTokens . clear ( ) ; allPersistentTokensToNotify . clear ( ) ; loggedSerializedBytes . clear ( ) ; logSequenceNumbers . clear ( ) ; managedObjectSequenceNumbers . clear ( ) ; useCount ++ ; if ( reUse ) { } else { transaction . internalTransaction = objectManagerState . dummyInternalTransaction ; if ( transactionReference != null ) transactionReference . clear ( ) ; objectManagerState . deRegisterTransaction ( this ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Tidy up after Commit or Backout have finished all work for this InternalTransaction .
36,860
protected synchronized void terminate ( int reason ) throws ObjectManagerException { final String methodName = "terminate" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { new Integer ( reason ) } ) ; if ( transactionReference != null ) { Transaction transaction = ( Transaction ) transactionReference . get ( ) ; if ( transaction != null ) transaction . setTerminationReason ( reason ) ; } setState ( nextStateForTerminate ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Permanently disable use of this transaction . reason the Transaction . terininatedXXX reason
36,861
protected synchronized void shutdown ( ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "shutDown" ) ; setState ( nextStateForShutdown ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "shutdown" ) ; }
Run at shutdown of the ObjectManager to close activity .
36,862
protected final void setRequiresCheckpoint ( ) { final String methodName = "setRequiresCheckpoint" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { new Boolean ( requiresPersistentCheckpoint ) } ) ; final boolean checkpointRequired [ ] = { false , false , false , true , false , false , true , false , false , true , false , false , true , false , false , true , false } ; requiresPersistentCheckpoint = checkpointRequired [ state ] ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { new Boolean ( requiresPersistentCheckpoint ) } ) ; }
Mark this InternalTransaction as requiring a Checkpoint in the current checkpoint cycle .
36,863
protected synchronized void checkpoint ( long forcedLogSequenceNumber ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "checkpoint" , new Object [ ] { new Long ( forcedLogSequenceNumber ) , new Boolean ( requiresPersistentCheckpoint ) } ) ; if ( requiresPersistentCheckpoint ) { java . util . List persistentTokensToAdd = new java . util . ArrayList ( ) ; java . util . List persistentTokensToReplace = new java . util . ArrayList ( ) ; java . util . List persistentSerializedBytesToReplace = new java . util . ArrayList ( ) ; java . util . List persistentTokensToOptimisticReplace = new java . util . ArrayList ( ) ; java . util . List persistentTokensToDelete = new java . util . ArrayList ( ) ; for ( java . util . Iterator managedObjectIterator = includedManagedObjects . values ( ) . iterator ( ) ; managedObjectIterator . hasNext ( ) ; ) { ManagedObject managedObject = ( ManagedObject ) managedObjectIterator . next ( ) ; if ( managedObject . owningToken . getObjectStore ( ) . getPersistence ( ) ) { long logSequenceNumber = ( ( Long ) logSequenceNumbers . get ( managedObject . owningToken ) ) . longValue ( ) ; if ( forcedLogSequenceNumber >= logSequenceNumber ) { ObjectManagerByteArrayOutputStream serializedBytes = ( ObjectManagerByteArrayOutputStream ) loggedSerializedBytes . get ( managedObject . owningToken ) ; long managedObjectSequenceNumber = ( ( Long ) managedObjectSequenceNumbers . get ( managedObject . owningToken ) ) . longValue ( ) ; managedObject . checkpoint ( this , serializedBytes , managedObjectSequenceNumber ) ; if ( managedObject . lockedBy ( this ) ) { switch ( managedObject . getState ( ) ) { case ManagedObject . stateAdded : persistentTokensToAdd . add ( managedObject . owningToken ) ; break ; case ManagedObject . stateReplaced : persistentTokensToReplace . add ( managedObject . owningToken ) ; persistentSerializedBytesToReplace . add ( serializedBytes ) ; break ; case ManagedObject . stateToBeDeleted : persistentTokensToDelete . add ( managedObject . owningToken ) ; break ; } } else { persistentTokensToOptimisticReplace . add ( managedObject . owningToken ) ; } } } } TransactionCheckpointLogRecord transactionCheckpointLogRecord = new TransactionCheckpointLogRecord ( this , persistentTokensToAdd , persistentTokensToReplace , persistentSerializedBytesToReplace , persistentTokensToOptimisticReplace , persistentTokensToDelete , allPersistentTokensToNotify ) ; objectManagerState . logOutput . writeNext ( transactionCheckpointLogRecord , 0 , false , false ) ; requiresPersistentCheckpoint = false ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "checkpoint" ) ; }
Called by the ObjectManager when it has written a checkpointStartLogRecord . The Transaction can assume that all log records up to and including logSequenceNumber are now safely hardened to disk . On this assumption it calls includedObjects so that they can write after images to the ObjectStores .
36,864
public void afterCompletion ( int status ) { if ( status == Status . STATUS_COMMITTED ) { Boolean previous = persistentExecutor . inMemoryTaskIds . put ( taskId , Boolean . TRUE ) ; if ( previous == null ) { long delay = expectedExecTime - new Date ( ) . getTime ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Schedule " + taskId + " for " + delay + "ms from now" ) ; persistentExecutor . scheduledExecutor . schedule ( this , delay , TimeUnit . MILLISECONDS ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Found task " + taskId + " already scheduled" ) ; } } }
Upon successful transaction commit automatically schedules a task for execution in the near future .
36,865
@ FFDCIgnore ( Throwable . class ) private byte [ ] serializeResult ( Object result , ClassLoader loader ) throws IOException { try { return persistentExecutor . serialize ( result ) ; } catch ( Throwable x ) { return persistentExecutor . serialize ( new TaskFailure ( x , loader , persistentExecutor , TaskFailure . NONSER_RESULT , result . getClass ( ) . getName ( ) ) ) ; } }
Utility method that serializes a task result or the failure that occurred when attempting to serialize the task result .
36,866
protected Converter createConverter ( FaceletContext ctx ) throws FacesException , ELException , FaceletException { return ctx . getFacesContext ( ) . getApplication ( ) . createConverter ( NumberConverter . CONVERTER_ID ) ; }
Returns a new NumberConverter
36,867
public void queueDataReceivedInvocation ( Connection connection , ReceiveListener listener , WsByteBuffer data , int segmentType , int requestNumber , int priority , boolean allocatedFromBufferPool , boolean partOfExchange , Conversation conversation ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "queueDataReceivedInvocation" , new Object [ ] { connection , listener , data , "" + segmentType , "" + requestNumber , "" + priority , "" + allocatedFromBufferPool , "" + partOfExchange , conversation } ) ; int dataSize = 0 ; if ( dispatcherEnabled ) dataSize = data . position ( ) ; AbstractInvocation invocation = allocateDataReceivedInvocation ( connection , listener , data , dataSize , segmentType , requestNumber , priority , allocatedFromBufferPool , partOfExchange , conversation ) ; queueInvocationCommon ( invocation , ( ConversationImpl ) conversation ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "queueDataReceivedInvocation" ) ; }
Queues the invocation of a data received method into the dispatcher .
36,868
public static ReceiveListenerDispatcher getInstance ( Conversation . ConversationType convType , boolean isOnClientSide ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getInstance" , new Object [ ] { "" + convType , "" + isOnClientSide } ) ; ReceiveListenerDispatcher retInstance ; if ( convType == Conversation . CLIENT ) { if ( isOnClientSide ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Returning client instance" ) ; synchronized ( ReceiveListenerDispatcher . class ) { if ( clientInstance == null ) { clientInstance = new ReceiveListenerDispatcher ( true , true ) ; } } retInstance = clientInstance ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Returning server instance" ) ; synchronized ( ReceiveListenerDispatcher . class ) { if ( serverInstance == null ) { serverInstance = new ReceiveListenerDispatcher ( false , true ) ; } } retInstance = serverInstance ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Returning ME-ME instance" ) ; synchronized ( ReceiveListenerDispatcher . class ) { if ( meInstance == null ) { meInstance = new ReceiveListenerDispatcher ( false , false ) ; } } retInstance = meInstance ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getInstance" , retInstance ) ; return retInstance ; }
Return a reference to the instance of this class . Used to implement the singleton design pattern .
36,869
public static boolean isCommandLine ( ) { String output = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { public String run ( ) { return System . getProperty ( "wlp.process.type" ) ; } } ) ; boolean value = true ; if ( output != null && ( "server" . equals ( output ) || "client" . equals ( output ) ) ) { value = false ; } if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "value: " + value ) ; } return value ; }
Returns true when the value of wlp . process . type is neither server nor client . false otherwise .
36,870
public static String getInstallRoot ( ) { return AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { public String run ( ) { String output = System . getProperty ( "wlp.install.dir" ) ; if ( output == null ) { output = System . getenv ( "WLP_INSTALL_DIR" ) ; } if ( output == null ) { URL url = CLASS_NAME . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) ; try { output = new File ( url . toString ( ) . substring ( "file:" . length ( ) ) ) . getParentFile ( ) . getParentFile ( ) . getCanonicalPath ( ) ; } catch ( IOException e ) { output = "." ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "The install root was not detected. " + e . getMessage ( ) ) ; } } } if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "The install root is " + output ) ; } return output ; } } ) ; }
Returns the installation root . If it wasn t detected use current directory .
36,871
public static ResourceBundle getResourceBundle ( File location , String name , Locale locale ) { File [ ] files = new File [ ] { new File ( location , name + "_" + locale . toString ( ) + RESOURCE_FILE_EXT ) , new File ( location , name + "_" + locale . getLanguage ( ) + RESOURCE_FILE_EXT ) , new File ( location , name + RESOURCE_FILE_EXT ) } ; for ( File file : files ) { if ( exists ( file ) ) { try { return new PropertyResourceBundle ( new FileReader ( file ) ) ; } catch ( IOException e ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "The resource file was not loaded. The exception is " + e . getMessage ( ) ) ; } } } } return null ; }
find the best matching resouce bundle of the specified resouce file name .
36,872
public static List < CustomManifest > findCustomEncryption ( String extension ) throws IOException { List < File > dirs = listRootAndExtensionDirectories ( ) ; return findCustomEncryption ( dirs , TOOL_EXTENSION_DIR + extension ) ; }
Find the URL of the jar file which includes specified class . If there is none return empty array .
36,873
protected static List < CustomManifest > findCustomEncryption ( List < File > rootDirs , String path ) throws IOException { List < CustomManifest > list = new ArrayList < CustomManifest > ( ) ; for ( File dir : rootDirs ) { dir = new File ( dir , path ) ; if ( exists ( dir ) ) { File [ ] files = listFiles ( dir ) ; if ( files != null ) { for ( File file : files ) { if ( isFile ( file ) && file . getName ( ) . toLowerCase ( ) . endsWith ( JAR_FILE_EXT ) ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "The extension manifest file : " + file ) ; } try { CustomManifest cm = new CustomManifest ( file ) ; list . add ( cm ) ; } catch ( IllegalArgumentException iae ) { if ( logger . isLoggable ( Level . INFO ) ) { logger . info ( MessageUtils . getMessage ( "PASSWORDUTIL_ERROR_IN_EXTENSION_MANIFEST_FILE" , file , iae . getMessage ( ) ) ) ; } } } } } } } return list ; }
Find the custom encryption manifest files from the specified list of root directories and path name . The reason why there are multiple root directories is that the product extensions which will allow to add the additional root directory anywhere .
36,874
public NetworkTransportFactory getNetworkTransportFactory ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getNetworkTransportFactory" ) ; NetworkTransportFactory factory = new RichClientTransportFactory ( framework ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getNetworkTransportFactory" , factory ) ; return factory ; }
This method is our entry point into the Channel Framework implementation of the JFap Framework interfaces .
36,875
public Map getOutboundConnectionProperties ( String outboundTransportName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getOutboundConnectionProperties" , outboundTransportName ) ; ChainData chainData = framework . getChain ( outboundTransportName ) ; ChannelData [ ] channelList = chainData . getChannelList ( ) ; Map properties = null ; if ( channelList . length > 0 ) { properties = channelList [ 0 ] . getPropertyBag ( ) ; } else { throw new SIErrorException ( nls . getFormattedMessage ( "OUTCONNTRACKER_INTERNAL_SICJ0064" , null , "OUTCONNTRACKER_INTERNAL_SICJ0064" ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getOutboundConnectionProperties" , properties ) ; return properties ; }
This method will retrieve the property bag on the named chain so that it can be determined what properties have been set on it .
36,876
public Map getOutboundConnectionProperties ( Object ep ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getOutboundConnectionProperties" , ep ) ; Map properties = null ; if ( ep instanceof CFEndPoint ) { OutboundChannelDefinition [ ] channelDefinitions = ( OutboundChannelDefinition [ ] ) ( ( CFEndPoint ) ep ) . getOutboundChannelDefs ( ) . toArray ( ) ; if ( channelDefinitions . length < 1 ) throw new SIErrorException ( nls . getFormattedMessage ( "OUTCONNTRACKER_INTERNAL_SICJ0064" , null , "OUTCONNTRACKER_INTERNAL_SICJ0064" ) ) ; properties = channelDefinitions [ 0 ] . getOutboundChannelProperties ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getOutboundConnectionProperties" , properties ) ; return properties ; }
This method will retrieve the property bag on the outbound chain that will be used by the specified end point . This method is only valid for CFEndPoints .
36,877
public InetAddress getHostAddress ( Object endPoint ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getHostAddress" , endPoint ) ; InetAddress address = null ; if ( endPoint instanceof CFEndPoint ) { address = ( ( CFEndPoint ) endPoint ) . getAddress ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getHostAddress" , address ) ; return address ; }
Retrieves the host address from the specified CFEndPoint .
36,878
public int getHostPort ( Object endPoint ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getHostPort" , endPoint ) ; int port = 0 ; if ( endPoint instanceof CFEndPoint ) { port = ( ( CFEndPoint ) endPoint ) . getPort ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getHostPort" , Integer . valueOf ( port ) ) ; return port ; }
Retrieves the host port from the specified CFEndPoint .
36,879
public boolean areEndPointsEqual ( Object ep1 , Object ep2 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "areEndPointsEqual" , new Object [ ] { ep1 , ep2 } ) ; boolean isEqual = false ; if ( ep1 instanceof CFEndPoint && ep2 instanceof CFEndPoint ) { CFEndPoint cfEp1 = ( CFEndPoint ) ep1 ; CFEndPoint cfEp2 = ( CFEndPoint ) ep2 ; isEqual = isEqual ( cfEp1 . getAddress ( ) , cfEp2 . getAddress ( ) ) && isEqual ( cfEp1 . getName ( ) , cfEp2 . getName ( ) ) && cfEp1 . getPort ( ) == cfEp2 . getPort ( ) && cfEp1 . isLocal ( ) == cfEp2 . isLocal ( ) && cfEp1 . isSSLEnabled ( ) == cfEp2 . isSSLEnabled ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "areEndPointsEqual" , Boolean . valueOf ( isEqual ) ) ; return isEqual ; }
The channel framework EP s don t have their own equals method - so one is implemented here by comparing the various parts of the EP .
36,880
public int getEndPointHashCode ( Object ep ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getEndPointHashCode" , ep ) ; int hashCode = 0 ; if ( ep instanceof CFEndPoint ) { CFEndPoint cfEndPoint = ( CFEndPoint ) ep ; if ( cfEndPoint . getAddress ( ) != null ) hashCode = hashCode ^ cfEndPoint . getAddress ( ) . hashCode ( ) ; if ( cfEndPoint . getName ( ) != null ) hashCode = hashCode ^ cfEndPoint . getName ( ) . hashCode ( ) ; } if ( hashCode == 0 ) hashCode = hashCode ^ ep . hashCode ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getEndPointHashCode" , Integer . valueOf ( hashCode ) ) ; return hashCode ; }
The channel framework EP s don t have their own hashCode method - so one is implemented here using the various parts of the EP .
36,881
private CFEndPoint cloneEndpoint ( final CFEndPoint originalEndPoint ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "cloneEndpoint" , originalEndPoint ) ; CFEndPoint endPoint ; ByteArrayOutputStream baos = null ; ObjectOutputStream out = null ; ObjectInputStream in = null ; try { baos = new ByteArrayOutputStream ( ) ; out = new ObjectOutputStream ( baos ) ; out . writeObject ( originalEndPoint ) ; out . flush ( ) ; ClassLoader cl = AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { public ClassLoader run ( ) { return Thread . currentThread ( ) . getContextClassLoader ( ) ; } } ) ; in = new DeserializationObjectInputStream ( new ByteArrayInputStream ( baos . toByteArray ( ) ) , cl ) ; endPoint = ( CFEndPoint ) in . readObject ( ) ; } catch ( IOException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".cloneEndpoint" , JFapChannelConstants . RICHCLIENTFRAMEWORK_CLONE_01 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Caught IOException copying endpoint" , e ) ; endPoint = originalEndPoint ; } catch ( ClassNotFoundException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".cloneEndpoint" , JFapChannelConstants . RICHCLIENTFRAMEWORK_CLONE_02 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Caught ClassNotFoundException copying endpoint" , e ) ; endPoint = originalEndPoint ; } finally { try { if ( out != null ) { out . close ( ) ; } if ( in != null ) { in . close ( ) ; } } catch ( IOException e ) { } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "cloneEndpoint" , endPoint ) ; return endPoint ; }
Creates a copy of originalEndPoint . This is to prevent us causing problems when we change it . As there is no exposed way to do this we will use serialization . It may be a bit slow but it is implementation safe as the implementation of CFEndPoint is designed to be serialized by WLM . Plus we only need to do this when creating the original connection so it is not main line code .
36,882
private Throwable getCause ( Throwable t ) { Throwable cause = t . getCause ( ) ; if ( t . getCause ( ) != null ) { return cause ; } else { return t ; } }
get if cause exists else return the original exception
36,883
public String traceLogFormat ( LogRecord logRecord , Object id , String formattedMsg , String formattedVerboseMsg ) { final String txt ; if ( formattedVerboseMsg == null ) { txt = formatVerboseMessage ( logRecord , formattedMsg , false ) ; } else { txt = formattedVerboseMsg ; } return createFormattedString ( logRecord , id , txt ) ; }
Format a detailed record for trace . log . Previously formatted messages may be provided and may be reused if possible .
36,884
private Object formatVerboseObj ( Object obj ) { if ( obj instanceof TruncatableThrowable ) { TruncatableThrowable truncatable = ( TruncatableThrowable ) obj ; final Throwable wrappedException = truncatable . getWrappedException ( ) ; return DataFormatHelper . throwableToString ( wrappedException ) ; } else if ( obj instanceof Throwable ) { return DataFormatHelper . throwableToString ( ( Throwable ) obj ) ; } return null ; }
Format an object for a verbose message .
36,885
protected String formatStreamOutput ( GenericData genData ) { String txt = null ; String loglevel = null ; KeyValuePair kvp = null ; KeyValuePair [ ] pairs = genData . getPairs ( ) ; for ( KeyValuePair p : pairs ) { if ( p != null && ! p . isList ( ) ) { kvp = p ; if ( kvp . getKey ( ) . equals ( "message" ) ) { txt = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( "loglevel" ) ) { loglevel = kvp . getStringValue ( ) ; } } } String message = BaseTraceService . filterStackTraces ( txt ) ; if ( message != null ) { if ( loglevel . equals ( "SystemErr" ) ) { message = "[err] " + message ; } } return message ; }
Outputs filteredStream of genData
36,886
private void createTimeout ( IAbstractAsyncFuture future , long delay , boolean isRead ) { if ( AsyncProperties . disableTimeouts ) { return ; } long timeoutTime = ( System . currentTimeMillis ( ) + delay + Timer . timeoutRoundup ) & Timer . timeoutResolution ; synchronized ( future . getCompletedSemaphore ( ) ) { if ( ! future . isCompleted ( ) ) { timer . createTimeoutRequest ( timeoutTime , this . callback , future ) ; } } }
Create the delayed timeout work item for this request .
36,887
public void refresh ( ) { this . productProperties = new Properties ( ) ; FileInputStream fis = null ; try { fis = new FileInputStream ( new File ( this . installDir , PRODUCT_PROPERTIES_PATH ) ) ; this . productProperties . load ( fis ) ; } catch ( Exception e ) { } finally { InstallUtils . close ( fis ) ; } featureDefs = null ; installFeatureDefs = null ; mfp = null ; }
Resets productProperties featureDefs installFeatureDefs and mfp .
36,888
public static RequestMetadata getRequestMetadata ( ) { RequestMetadata metadata = threadLocal . get ( ) ; if ( metadata == null ) metadata = getNoMetadata ( ) ; return metadata ; }
Gets the metadata for the current request
36,889
public void initialize ( int [ ] bufferEntrySizes , int [ ] bufferEntryDepths ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "initialize" ) ; } int len = bufferEntrySizes . length ; int [ ] bSizes = new int [ len ] ; int [ ] bDepths = new int [ len ] ; int sizeCompare ; int depth ; int sizeSort ; int j ; for ( int i = 0 ; i < len ; i ++ ) { sizeCompare = bufferEntrySizes [ i ] ; depth = bufferEntryDepths [ i ] ; for ( j = i - 1 ; j >= 0 ; j -- ) { sizeSort = bSizes [ j ] ; if ( sizeCompare > sizeSort ) { bSizes [ j + 1 ] = sizeCompare ; bDepths [ j + 1 ] = depth ; break ; } bSizes [ j + 1 ] = sizeSort ; bDepths [ j + 1 ] = bDepths [ j ] ; } if ( j < 0 ) { bSizes [ 0 ] = sizeCompare ; bDepths [ 0 ] = depth ; } } boolean tracking = trackingBuffers ( ) ; this . pools = new WsByteBufferPool [ len ] ; this . poolsDirect = new WsByteBufferPool [ len ] ; this . poolSizes = new int [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { this . pools [ i ] = new WsByteBufferPool ( bSizes [ i ] , bDepths [ i ] * 10 , tracking , false ) ; this . poolsDirect [ i ] = new WsByteBufferPool ( bSizes [ i ] , bDepths [ i ] * 10 , tracking , true ) ; this . poolSizes [ i ] = bSizes [ i ] ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Number of pools created: " + this . poolSizes . length ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "initialize" ) ; } }
Initialize the pool manager with the number of pools the entry sizes for each pool and the maximum depth of the free pool .
36,890
public void setLeakDetectionSettings ( int interval , String output ) throws IOException { this . leakDetectionInterval = interval ; this . leakDetectionOutput = TrConfigurator . getLogLocation ( ) + File . separator + output ; if ( ( interval > - 1 ) && ( output != null ) ) { FileWriter outFile = new FileWriter ( this . leakDetectionOutput , false ) ; outFile . close ( ) ; } }
Set the memory leak detection parameters . If the interval is 0 or greater then the detection code will enabled .
36,891
public WsByteBuffer allocateFileChannelBuffer ( FileChannel fc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "allocateFileChannelBuffer" ) ; } return new FCWsByteBufferImpl ( fc ) ; }
Allocate a buffer which will use tha FileChannel until the buffer needs to be used in a non - FileChannel way .
36,892
protected WsByteBufferImpl allocateBufferDirect ( WsByteBufferImpl buffer , int size , boolean overrideRefCount ) { DirectByteBufferHelper directByteBufferHelper = this . directByteBufferHelper . get ( ) ; ByteBuffer byteBuffer ; if ( directByteBufferHelper != null ) { byteBuffer = directByteBufferHelper . allocateDirectByteBuffer ( size ) ; } else { byteBuffer = ByteBuffer . allocateDirect ( size ) ; } buffer . setByteBufferNonSafe ( byteBuffer ) ; return buffer ; }
Allocate the direct ByteBuffer that will be wrapped by the input WsByteBuffer object .
36,893
protected void releasing ( ByteBuffer buffer ) { if ( buffer != null && buffer . isDirect ( ) ) { DirectByteBufferHelper directByteBufferHelper = this . directByteBufferHelper . get ( ) ; if ( directByteBufferHelper != null ) { directByteBufferHelper . releaseDirectByteBuffer ( buffer ) ; } } }
Method called when a buffer is being destroyed to allow any additional cleanup that might be required .
36,894
public String debug ( ) { String data = null ; StringBuffer sb = new StringBuffer ( ) ; sb . append ( "ConsumerProperties" ) ; sb . append ( "\n" ) ; sb . append ( "------------------" ) ; sb . append ( "\n" ) ; sb . append ( "Destination: " ) ; sb . append ( getJmsDestination ( ) ) ; sb . append ( "\n" ) ; sb . append ( "DestType: " ) ; sb . append ( getDestinationType ( ) ) ; sb . append ( "\n" ) ; sb . append ( "Selector: " ) ; sb . append ( getSelector ( ) ) ; sb . append ( "\n" ) ; sb . append ( "NoLocal: " ) ; sb . append ( noLocal ( ) ) ; sb . append ( "\n" ) ; sb . append ( "Reliablity: " ) ; sb . append ( getReliability ( ) ) ; sb . append ( "\n" ) ; sb . append ( "ClientID: " ) ; sb . append ( getClientID ( ) ) ; sb . append ( "\n" ) ; sb . append ( "SubName: " ) ; sb . append ( getSubName ( ) ) ; sb . append ( "\n" ) ; sb . append ( "DurableSubHome: " ) ; sb . append ( getDurableSubscriptionHome ( ) ) ; sb . append ( "\n" ) ; sb . append ( "ReadAhead: " ) ; sb . append ( readAhead ( ) ) ; sb . append ( "\n" ) ; sb . append ( "UnrecoverableReliability: " ) ; sb . append ( getUnrecovReliability ( ) ) ; sb . append ( "\n" ) ; sb . append ( "Supports Multiple: " ) ; sb . append ( supportsMultipleConsumers ( ) ) ; sb . append ( "\n" ) ; if ( dest instanceof Queue ) { sb . append ( "GatherMessages: " ) ; sb . append ( isGatherMessages ( ) ) ; sb . append ( "\n" ) ; } data = sb . toString ( ) ; return data ; }
Returns a printable form of the information stored in this object .
36,895
private Pattern loadAcceptPattern ( ExternalContext context ) { assert context != null ; String mappings = context . getInitParameter ( ViewHandler . FACELETS_VIEW_MAPPINGS_PARAM_NAME ) ; if ( mappings == null ) { return null ; } mappings = mappings . trim ( ) ; if ( mappings . length ( ) == 0 ) { return null ; } return Pattern . compile ( toRegex ( mappings ) ) ; }
Load and compile a regular expression pattern built from the Facelet view mapping parameters .
36,896
private String toRegex ( String mappings ) { assert mappings != null ; mappings = mappings . replaceAll ( "\\s" , "" ) ; mappings = mappings . replaceAll ( "\\." , "\\\\." ) ; mappings = mappings . replaceAll ( "\\*" , ".*" ) ; mappings = mappings . replaceAll ( ";" , "|" ) ; return mappings ; }
Convert the specified mapping string to an equivalent regular expression .
36,897
protected void prepareConduitSelector ( Message message , URI currentURI , boolean proxy ) { try { cfg . prepareConduitSelector ( message ) ; } catch ( Fault ex ) { LOG . warning ( "Failure to prepare a message from conduit selector" ) ; } message . getExchange ( ) . put ( ConduitSelector . class , cfg . getConduitSelector ( ) ) ; message . getExchange ( ) . put ( Service . class , cfg . getConduitSelector ( ) . getEndpoint ( ) . getService ( ) ) ; String address = ( String ) message . get ( Message . ENDPOINT_ADDRESS ) ; if ( address . startsWith ( HTTP_SCHEME ) && ! address . equals ( currentURI . toString ( ) ) ) { URI baseAddress = URI . create ( address ) ; currentURI = calculateNewRequestURI ( baseAddress , currentURI , proxy ) ; message . put ( Message . ENDPOINT_ADDRESS , currentURI . toString ( ) ) ; message . put ( Message . REQUEST_URI , currentURI . toString ( ) ) ; } message . put ( Message . BASE_PATH , getBaseURI ( ) . toString ( ) ) ; }
or web client invocation has returned
36,898
public boolean isCorruptOrIndoubt ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isCorruptOrIndoubt" ) ; boolean isCorruptOrIndoubt = _targetDestinationHandler . isCorruptOrIndoubt ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isCorruptOrIndoubt" , Boolean . valueOf ( isCorruptOrIndoubt ) ) ; return isCorruptOrIndoubt ; }
Is a real target destination corrupt?
36,899
public void delete ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "delete" ) ; _targetDestinationHandler . removeTargettingAlias ( this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "delete" ) ; }
This destination handler is being deleted and should perform any processing required .