idx
int64 0
165k
| question
stringlengths 73
4.15k
| target
stringlengths 5
918
| len_question
int64 21
890
| len_target
int64 3
255
|
|---|---|---|---|---|
159,600
|
private static String convertToAbsoluteUrlIfNeeded ( String conduitName , String lastURL , String newURL , Message message ) throws IOException { if ( newURL != null && ! newURL . startsWith ( "http" ) ) { if ( MessageUtils . isTrue ( message . getContextualProperty ( AUTO_REDIRECT_ALLOW_REL_URI ) ) ) { return URI . create ( lastURL ) . resolve ( newURL ) . toString ( ) ; } else { String msg = "Relative Redirect detected on Conduit '" + conduitName + "' on '" + newURL + "'" ; LOG . log ( Level . INFO , msg ) ; throw new IOException ( msg ) ; } } else { return newURL ; } }
|
Relative Location values are also supported
| 165
| 7
|
159,601
|
private void resumeTran ( Transaction tran ) { if ( tran != null ) { try { tranMgr . resume ( tran ) ; } catch ( Exception e ) { throw new BatchRuntimeException ( "Failed to resume transaction after JobOperator method" , e ) ; } } }
|
Resume the given tran .
| 65
| 7
|
159,602
|
private void addAndSortReaders ( List < ProviderInfo < MessageBodyReader < ? > > > newReaders , boolean forceSort ) { Comparator < ProviderInfo < MessageBodyReader < ? > > > comparator = null ; if ( ! customComparatorAvailable ( MessageBodyReader . class ) ) { comparator = new MessageBodyReaderComparator ( readerMediaTypesMap ) ; } messageReaders . addAndSortProviders ( newReaders , comparator , forceSort ) ; }
|
Liberty code change start
| 104
| 5
|
159,603
|
private static Type [ ] getGenericInterfaces ( Class < ? > cls , Class < ? > expectedClass , Class < ? > commonBaseCls ) { if ( Object . class == cls ) { return emptyType ; } Type [ ] cachedTypes = getTypes ( cls , expectedClass , commonBaseCls ) ; if ( cachedTypes != null ) return cachedTypes ; if ( expectedClass != null ) { Type genericSuperType = cls . getGenericSuperclass ( ) ; if ( genericSuperType instanceof ParameterizedType ) { Class < ? > actualType = InjectionUtils . getActualType ( genericSuperType ) ; if ( actualType != null && actualType . isAssignableFrom ( expectedClass ) ) { Type [ ] tempTypes = new Type [ ] { genericSuperType } ; putTypes ( cls , expectedClass , commonBaseCls , tempTypes ) ; return tempTypes ; } else if ( commonBaseCls != null && commonBaseCls != Object . class && commonBaseCls . isAssignableFrom ( expectedClass ) && commonBaseCls . isAssignableFrom ( actualType ) || expectedClass . isAssignableFrom ( actualType ) ) { putTypes ( cls , expectedClass , commonBaseCls , emptyType ) ; return emptyType ; } } } Type [ ] types = cls . getGenericInterfaces ( ) ; if ( types . length > 0 ) { putTypes ( cls , expectedClass , commonBaseCls , types ) ; return types ; } Type [ ] superGenericTypes = getGenericInterfaces ( cls . getSuperclass ( ) , expectedClass , commonBaseCls ) ; putTypes ( cls , expectedClass , commonBaseCls , superGenericTypes ) ; return superGenericTypes ; }
|
Add the result to cache before return
| 387
| 7
|
159,604
|
void onCompletion ( Collection < ApplicationDependency > dependencies ) { if ( ! dependencies . isEmpty ( ) ) { for ( ApplicationDependency dependency : dependencies ) { dependency . onCompletion ( this ) ; } } }
|
final Field Semantics .
| 49
| 5
|
159,605
|
@ Override public boolean hasObjectWithPrefix ( JavaColonNamespace namespace , String name ) throws NamingException { JavaColonNamespaceBindings < EJBBinding > bindings ; boolean result = false ; Lock readLock = null ; ComponentMetaData cmd = null ; try { // This helper only provides support for java:global, java:app, and java:module if ( namespace == JavaColonNamespace . GLOBAL ) { // Called to ensure that the java:global code path // is coming from a Java EE thread. If not this will reject this // method call with the correct Java EE error message. cmd = getComponentMetaData ( namespace , name ) ; bindings = javaColonGlobalBindings ; readLock = javaColonLock . readLock ( ) ; readLock . lock ( ) ; } else if ( namespace == JavaColonNamespace . APP ) { // Get the ComponentMetaData for the currently active component. // There is no component name space if there is no active component. cmd = getComponentMetaData ( namespace , name ) ; bindings = getAppBindingMap ( cmd . getModuleMetaData ( ) . getApplicationMetaData ( ) ) ; readLock = javaColonLock . readLock ( ) ; readLock . lock ( ) ; } else if ( namespace == JavaColonNamespace . MODULE ) { cmd = getComponentMetaData ( namespace , name ) ; bindings = getModuleBindingMap ( cmd . getModuleMetaData ( ) ) ; } else { bindings = null ; } result = bindings != null && bindings . hasObjectWithPrefix ( name ) ; } finally { if ( readLock != null ) { readLock . unlock ( ) ; } } return result ; }
|
can suppress warning - if cmd is null NamingException will be thrown by getComponentMetaData
| 365
| 19
|
159,606
|
public void removeGlobalBindings ( List < String > names ) { Lock writeLock = javaColonLock . writeLock ( ) ; writeLock . lock ( ) ; try { for ( String name : names ) { javaColonGlobalBindings . unbind ( name ) ; } } finally { writeLock . unlock ( ) ; } }
|
Remove names from the global mapping .
| 71
| 7
|
159,607
|
private JavaColonNamespaceBindings < EJBBinding > getAppBindingMap ( ApplicationMetaData amd ) { @ SuppressWarnings ( "unchecked" ) JavaColonNamespaceBindings < EJBBinding > bindingMap = ( JavaColonNamespaceBindings < EJBBinding > ) amd . getMetaData ( amdSlot ) ; if ( bindingMap == null ) { bindingMap = new JavaColonNamespaceBindings < EJBBinding > ( NamingConstants . JavaColonNamespace . APP , this ) ; amd . setMetaData ( amdSlot , bindingMap ) ; } return bindingMap ; }
|
Get the EJBBinding map from the application meta data . Initialize if it is null .
| 140
| 20
|
159,608
|
private JavaColonNamespaceBindings < EJBBinding > getModuleBindingMap ( ModuleMetaData mmd ) { @ SuppressWarnings ( "unchecked" ) JavaColonNamespaceBindings < EJBBinding > bindingMap = ( JavaColonNamespaceBindings < EJBBinding > ) mmd . getMetaData ( mmdSlot ) ; if ( bindingMap == null ) { bindingMap = new JavaColonNamespaceBindings < EJBBinding > ( NamingConstants . JavaColonNamespace . MODULE , this ) ; mmd . setMetaData ( mmdSlot , bindingMap ) ; } return bindingMap ; }
|
Get the EJBBinding map from the module meta data . Initialize if it is null .
| 145
| 20
|
159,609
|
public void removeAppBindings ( ModuleMetaData mmd , List < String > names ) { ApplicationMetaData amd = mmd . getApplicationMetaData ( ) ; Lock writeLock = javaColonLock . writeLock ( ) ; writeLock . lock ( ) ; try { JavaColonNamespaceBindings < EJBBinding > bindings = getAppBindingMap ( amd ) ; // getAppBindings returns a non-null value for ( String name : names ) { bindings . unbind ( name ) ; } } finally { writeLock . unlock ( ) ; } }
|
Remove names from the application mapping . If all the bindings have been removed for an application remove the application mapping .
| 122
| 22
|
159,610
|
private void throwCannotInstanciateUnsupported ( EJBBinding binding , JavaColonNamespace jndiType , String lookupName , String messageId ) throws NameNotFoundException { J2EEName j2eeName = getJ2EEName ( binding ) ; String jndiName = jndiType . toString ( ) + "/" + lookupName ; String msgTxt = Tr . formatMessage ( tc , messageId , binding . interfaceName , j2eeName . getComponent ( ) , j2eeName . getModule ( ) , j2eeName . getApplication ( ) , jndiName ) ; throw ( new NameNotFoundException ( msgTxt ) ) ; }
|
Internal method to throw a NameNotFoundException for unsupported Home and Remote interfaces .
| 155
| 16
|
159,611
|
protected void unsetVirtualHost ( VirtualHost vhost ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unset vhost: " , vhost ) ; } secureVirtualHost = null ; }
|
Unset required VirtualHost . This will be called after deactivate
| 61
| 13
|
159,612
|
private synchronized void createJMXWorkAreaResourceIfChanged ( VirtualHost vhost ) { // Make sure our context root has been registered... String contextRoot = registeredContextRoot ; if ( contextRoot != null ) { // Make sure that we are dealing with the secure port before writing the file... String newAppURLString = vhost . getUrlString ( contextRoot , true ) ; if ( newAppURLString . startsWith ( "https" ) ) { // If we are dealing with the secure port, woohoo! String oldAppURL = appURL ; String newAppURL = processContextRootURL ( newAppURLString ) ; if ( oldAppURL == null || ! oldAppURL . equals ( newAppURL ) ) { this . appURL = newAppURL ; if ( restJMXAddressWorkareaFile == null ) { restJMXAddressWorkareaFile = createJMXWorkAreaResource ( locationService ) ; } else { createJmxAddressResource ( restJMXAddressWorkareaFile ) ; } if ( restJMXAddressStateFile == null ) { restJMXAddressStateFile = createJMXStateResource ( locationService ) ; } else { createJmxAddressResource ( restJMXAddressStateFile ) ; } // Register or update a marker service with JMX host/port Hashtable < String , Object > props = new Hashtable < String , Object > ( ) ; props . put ( "name" , "JMXConnectorEndpoint" ) ; props . put ( "jmxHost" , vhost . getHostName ( secureAlias ) ) ; props . put ( "jmxPort" , vhost . getSecureHttpPort ( secureAlias ) ) ; props . put ( "jmxAlias" , secureAlias ) ; if ( jmxEndpointRegistration == null ) jmxEndpointRegistration = bContext . registerService ( Object . class , this , props ) ; else jmxEndpointRegistration . setProperties ( props ) ; } } } }
|
Called to create the work area resource . Only re - generate the file if this is the first time or something in the url has changed .
| 419
| 29
|
159,613
|
@ Reference ( service = WsLocationAdmin . class , policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MANDATORY ) protected void setLocationService ( WsLocationAdmin locationService ) { this . locationService = locationService ; if ( restJMXAddressWorkareaFile == null ) { restJMXAddressWorkareaFile = createJMXWorkAreaResource ( locationService ) ; } if ( restJMXAddressStateFile == null ) { restJMXAddressStateFile = createJMXStateResource ( locationService ) ; } }
|
Set the dynamic reference to the WsLocationAdmin service . If the service is replaced the new service will be set before the old is removed .
| 121
| 29
|
159,614
|
public final List < String > getConnectionFactoryInterfaceNames ( ) { return cfInterfaceNames instanceof String ? Collections . singletonList ( ( String ) cfInterfaceNames ) // : cfInterfaceNames instanceof String [ ] ? Arrays . asList ( ( String [ ] ) cfInterfaceNames ) // : Collections . < String > emptyList ( ) ; }
|
This method is provided for the connection factory validator .
| 74
| 11
|
159,615
|
private void destroyConnectionFactories ( boolean destroyImmediately ) { lock . writeLock ( ) . lock ( ) ; try { if ( isInitialized . get ( ) ) { // Mark all connection factories as disabled isInitialized . set ( false ) ; // Destroy the connection factories conMgrSvc . deleteObserver ( this ) ; conMgrSvc . destroyConnectionFactories ( ) ; conMgrSvc = null ; } } finally { lock . writeLock ( ) . unlock ( ) ; } }
|
Utility method to destroy connection factory instances .
| 107
| 9
|
159,616
|
@ Override @ Trivial public boolean getReauthenticationSupport ( ) { return Boolean . TRUE . equals ( bootstrapContextRef . getReference ( ) . getProperty ( REAUTHENTICATION_SUPPORT ) ) ; }
|
Indicates whether or not reauthentication of connections is enabled .
| 50
| 13
|
159,617
|
@ Override public TransactionSupportLevel getTransactionSupport ( ) { // If ManagedConnectionFactory implements TransactionSupport, that takes priority TransactionSupportLevel transactionSupport = mcf instanceof TransactionSupport ? ( ( TransactionSupport ) mcf ) . getTransactionSupport ( ) : null ; // Otherwise get the value from the deployment descriptor String prop = ( String ) bootstrapContextRef . getReference ( ) . getProperty ( TRANSACTION_SUPPORT ) ; if ( prop != null ) { TransactionSupportLevel ddTransactionSupport = TransactionSupportLevel . valueOf ( prop ) ; if ( transactionSupport == null ) transactionSupport = ddTransactionSupport ; else if ( transactionSupport . ordinal ( ) > ddTransactionSupport . ordinal ( ) ) throw new IllegalArgumentException ( ManagedConnectionFactory . class . getName ( ) + ' ' + transactionSupport + ", " + Connector . class . getName ( ) + ' ' + ddTransactionSupport ) ; } if ( connectionFactoryTransactionSupport != null ) { if ( connectionFactoryTransactionSupport . ordinal ( ) > transactionSupport . ordinal ( ) ) throw new IllegalArgumentException ( ManagedConnectionFactory . class . getName ( ) + ' ' + transactionSupport + ", " + Connector . class . getName ( ) + ' ' + connectionFactoryTransactionSupport ) ; else transactionSupport = connectionFactoryTransactionSupport ; } // Otherwise choose NoTransaction return transactionSupport == null ? TransactionSupportLevel . NoTransaction : transactionSupport ; }
|
Indicates the level of transaction support .
| 305
| 8
|
159,618
|
public StackNode < E > clean ( ) { do { final StackNode < E > oldTop = top . get ( ) ; if ( top . compareAndSet ( oldTop , null ) ) return oldTop ; } while ( true ) ; }
|
Remove all nodes from stack and return the old top node .
| 52
| 12
|
159,619
|
public E pop ( ) { StackNode < E > oldTop , newTop ; while ( true ) { oldTop = top . get ( ) ; if ( oldTop == null ) return null ; newTop = oldTop . next ; if ( top . compareAndSet ( oldTop , newTop ) ) break ; } return oldTop . data ; }
|
Pop data from the Stack .
| 74
| 6
|
159,620
|
public void push ( E d ) { StackNode < E > oldTop , newTop ; newTop = new StackNode < E > ( d ) ; while ( true ) { oldTop = top . get ( ) ; newTop . next = oldTop ; if ( oldTop != null ) newTop . index = oldTop . index + 1 ; else newTop . index = 0 ; if ( top . compareAndSet ( oldTop , newTop ) ) return ; } }
|
Push data onto Stack .
| 100
| 5
|
159,621
|
public E peek ( ) { final StackNode < E > oldTop = top . get ( ) ; if ( oldTop == null ) { return null ; } else { return oldTop . data ; } }
|
Return copy of the top data on the Stack
| 43
| 9
|
159,622
|
public void setSizeRefsByMsgSize ( boolean sizeByMsgSize ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setSizeRefsByMsgSize" , Boolean . valueOf ( sizeByMsgSize ) ) ; this . _sizeRefsByMsgSize = sizeByMsgSize ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setSizeRefsByMsgSize" ) ; }
|
PK57207 Called when adding this reference to a reference stream when to specify that sib . msgstore . jdbcSpillSizeRefsByMsgSize has been enabled
| 128
| 36
|
159,623
|
public int getInMemoryDataSize ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getInMemoryDataSize" ) ; int dataSize ; // If tuning has requested return the size of the message we reference, // then delegate to the message. Otherwise call our parent to get a // (small) default size. if ( _sizeRefsByMsgSize ) { try { dataSize = getReferredItem ( ) . getInMemoryDataSize ( ) ; } catch ( SevereMessageStoreException e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ws.sib.msgstore.ItemReference.getInMemoryDataSize" , "244" , this ) ; // After FFDCing anything nasty, fall back to the standard answer dataSize = super . getInMemoryDataSize ( ) ; } } else { dataSize = super . getInMemoryDataSize ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getInMemoryDataSize" , dataSize ) ; return dataSize ; }
|
PK57207 Returns an estimated size for this message reference
| 276
| 11
|
159,624
|
public void begin ( ) throws SIIncorrectCallException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "begin" ) ; // Are we currently in use? do we have work // we still need to commit? if ( _state == TransactionState . STATE_ACTIVE && _workList != null ) { SIIncorrectCallException ice = new SIIncorrectCallException ( nls . getFormattedMessage ( "TRAN_PROTOCOL_ERROR_SIMS1001" , null , "TRAN_PROTOCOL_ERROR_SIMS1001" ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "Cannot begin new LocalTran. Existing work needs completing first!" , ice ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "begin" ) ; throw ice ; } synchronized ( this ) { _ptid = null ; } _workList = null ; _size = 0 ; _callbacks . clear ( ) ; _state = TransactionState . STATE_ACTIVE ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "begin" ) ; }
|
Begin a new local transaction by readying this object for re - use by the ItemStream interfaces .
| 314
| 20
|
159,625
|
public void rollback ( ) throws SIIncorrectCallException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "rollback" ) ; if ( _state != TransactionState . STATE_ACTIVE ) { SIIncorrectCallException sie = new SIIncorrectCallException ( nls . getFormattedMessage ( "CANNOT_ROLLBACK_COMPLETE_SIMS1005" , new Object [ ] { } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "Cannot rollback Transaction. Transaction is complete or completing!" , sie ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "rollback" ) ; throw sie ; } _state = TransactionState . STATE_ROLLINGBACK ; try { // We are rolling back all changes so we don't need // to tell the persistence layer to do anything we // just need to get the in memory model to back out // its changes. if ( _workList != null ) { _workList . rollback ( this ) ; } _state = TransactionState . STATE_ROLLEDBACK ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback" , "1:539:1.51.1.14" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "Exception caught during rollback phase of transaction!" , t ) ; throw new SIResourceException ( nls . getFormattedMessage ( "COMPLETION_EXCEPTION_SIMS1002" , new Object [ ] { t } , null ) , t ) ; } finally { // We always ensure that all afterCompletion // callbacks are called even in the case of // rollback. // Defect 316887 try { if ( _workList != null ) { _workList . postComplete ( this , false ) ; } for ( int i = 0 ; i < _callbacks . size ( ) ; i ++ ) { TransactionCallback callback = ( TransactionCallback ) _callbacks . get ( i ) ; callback . afterCompletion ( this , false ) ; } } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.sib.msgstore.transactions.MSDelegatingLocalTransaction.rollback" , "1:565:1.51.1.14" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "Exception caught during post rollback phase of transaction!" , t ) ; // We aren't going to rethrow this exception as if // a previous exception has been thrown outside the // finally block it is likely to have more // information about the root problem. } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "rollback" ) ; } }
|
Rollback all work associated with this local transaction .
| 764
| 10
|
159,626
|
static void setInjectionEngine ( InternalInjectionEngine ie ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setInjectionEngine : " + ie ) ; svInstance = ie ; }
|
F46994 . 2
| 58
| 5
|
159,627
|
public static boolean isRemoteable ( Class < ? > valueClass , int rmicCompatible ) { // NOTE: This logic must be kept in sync with write_value. return valueClass . isInterface ( ) && valueClass != Serializable . class && valueClass != Externalizable . class && ( isCORBAObject ( valueClass , rmicCompatible ) || Remote . class . isAssignableFrom ( valueClass ) || isAbstractInterface ( valueClass , rmicCompatible ) ) ; }
|
Determines whether a value of the specified type could be a remote object reference . This should return true if read_Object or read_abstract_interface is used for this type .
| 105
| 38
|
159,628
|
public static boolean hasJNDIScheme ( String jndiName ) { int colonIndex = jndiName . indexOf ( ' ' ) ; int slashIndex = jndiName . indexOf ( ' ' ) ; return colonIndex != - 1 && ( slashIndex == - 1 || colonIndex < slashIndex ) ; }
|
Return true if a JNDI name has a scheme .
| 71
| 12
|
159,629
|
private List < WsByteBuffer > writeHeader ( List < WsByteBuffer > list ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Writing gzip header information" ) ; } WsByteBuffer hdr = HttpDispatcher . getBufferManager ( ) . allocateDirect ( GZIP_Header . length ) ; hdr . put ( GZIP_Header ) ; hdr . flip ( ) ; list . add ( hdr ) ; this . haveWrittenHeader = true ; return list ; }
|
Write the gzip header onto the output list .
| 129
| 10
|
159,630
|
private WsByteBuffer makeBuffer ( int len ) { WsByteBuffer buffer = HttpDispatcher . getBufferManager ( ) . allocateDirect ( len ) ; buffer . put ( this . buf , 0 , len ) ; buffer . flip ( ) ; return buffer ; }
|
Create the output bytebuffer based on the output compressed storage .
| 59
| 12
|
159,631
|
private void writeInt ( int value , byte [ ] data , int offset ) { int index = offset ; data [ index ++ ] = ( byte ) ( value & 0xff ) ; data [ index ++ ] = ( byte ) ( ( value >> 8 ) & 0xff ) ; data [ index ++ ] = ( byte ) ( ( value >> 16 ) & 0xff ) ; data [ index ++ ] = ( byte ) ( ( value >> 24 ) & 0xff ) ; }
|
Write an integer into the output space starting at the input offset .
| 99
| 13
|
159,632
|
protected Object getInjectedObjectFromCXF ( Class < ? > classType , Type genericType , Annotation [ ] memberAnnotations , ParamInjectionMetadata paramInjectionMetadata ) { Parameter p = ResourceUtils . getParameter ( 0 , memberAnnotations , classType ) ; Object injectedObject = null ; Message message = paramInjectionMetadata . getInMessage ( ) ; OperationResourceInfo ori = paramInjectionMetadata . getOperationResourceInfo ( ) ; BeanResourceInfo cri = ori . getClassResourceInfo ( ) ; MultivaluedMap < String , String > values = ( MultivaluedMap < String , String > ) message . get ( URITemplate . TEMPLATE_PARAMETERS ) ; if ( p . getType ( ) == ParameterType . BEAN && cri instanceof ClassResourceInfo ) { injectedObject = JAXRSUtils . createBeanParamValue ( message , classType , ori ) ; } else { injectedObject = JAXRSUtils . createHttpParameterValue ( p , classType , genericType , memberAnnotations , message , values , ori ) ; } return injectedObject ; }
|
real create the paramter object based CXF implementation
| 249
| 11
|
159,633
|
private void setBufferSize ( int size ) { this . amountToBuffer = size ; this . bbSize = ( 49152 < size ) ? 32768 : 8192 ; int numBuffers = ( size / this . bbSize ) ; if ( 0 == size || 0 != ( size % this . bbSize ) ) { numBuffers ++ ; } this . _output = new WsByteBuffer [ numBuffers ] ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setBufferSize=[" + size + "]; " + this ) ; } }
|
Set the amount of data to buffer internally before the stream itself initiates a flush . A zero size means no buffer is done each write call will flush data .
| 139
| 32
|
159,634
|
private void clear ( ) { if ( null != this . _output ) { for ( int i = 0 ; i < this . _output . length ; i ++ ) { if ( null != this . _output [ i ] ) { this . _output [ i ] . release ( ) ; this . _output [ i ] = null ; } } } this . outputIndex = 0 ; this . bufferedCount = 0 ; this . bytesWritten = 0L ; this . setWriteListenerCallBack ( null ) ; }
|
Release any current buffer content in the stream .
| 109
| 9
|
159,635
|
@ Reference ( service = Application . class , cardinality = ReferenceCardinality . MULTIPLE , policy = ReferencePolicy . DYNAMIC , target = "(application.state=STARTED)" ) protected void addStartedApplication ( ServiceReference < Application > ref ) { ExecutorService executor ; String appName = ( String ) ref . getProperty ( NAME ) ; Set < Runnable > tasks ; lock . writeLock ( ) . lock ( ) ; try { executor = this . executor ; appStates . put ( appName , ApplicationState . STARTED ) ; tasks = deferredTasks . remove ( appName ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } if ( tasks != null ) for ( Runnable task : tasks ) executor . submit ( task ) ; }
|
Declarative Services method for setting a started Application instance
| 175
| 11
|
159,636
|
@ Reference ( service = Application . class , cardinality = ReferenceCardinality . MULTIPLE , policy = ReferencePolicy . DYNAMIC , target = "(application.state=STARTING)" ) protected void addStartingApplication ( ServiceReference < Application > ref ) { String appName = ( String ) ref . getProperty ( NAME ) ; lock . writeLock ( ) . lock ( ) ; try { if ( ! appStates . containsKey ( appName ) ) appStates . put ( appName , ApplicationState . STARTING ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } }
|
Declarative Services method for setting a starting Application instance
| 130
| 11
|
159,637
|
boolean isStarted ( String appName ) { lock . readLock ( ) . lock ( ) ; try { return appStates . get ( appName ) == ApplicationState . STARTED ; } finally { lock . readLock ( ) . unlock ( ) ; } }
|
Returns true if the application with the specified name is started otherwise false .
| 56
| 14
|
159,638
|
protected void removeStartedApplication ( ServiceReference < Application > ref ) { String appName = ( String ) ref . getProperty ( NAME ) ; lock . writeLock ( ) . lock ( ) ; try { appStates . remove ( appName ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } }
|
Declarative Services method for unsetting a started Application instance
| 68
| 12
|
159,639
|
String objectsToString ( String key , Object objects ) { java . io . StringWriter stringWriter = new java . io . StringWriter ( ) ; stringWriter . write ( key ) ; stringWriter . write ( ":" ) ; if ( objects == null ) { stringWriter . write ( "\n" ) ; } else if ( objects instanceof Object [ ] ) { for ( int i = 0 ; i < ( ( Object [ ] ) objects ) . length ; i ++ ) { Object object = ( ( Object [ ] ) objects ) [ i ] ; if ( object == null ) stringWriter . write ( "null\n" ) ; else { stringWriter . write ( ( ( Object [ ] ) objects ) [ i ] . toString ( ) ) ; stringWriter . write ( "\n" ) ; } } } else { stringWriter . write ( objects . toString ( ) ) ; stringWriter . write ( "\n" ) ; } return stringWriter . toString ( ) ; }
|
Create a simple default formatted string .
| 208
| 7
|
159,640
|
private static String getPID ( ) { String name = ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; int index = name . indexOf ( ' ' ) ; if ( index == - 1 ) { return null ; } String pid = name . substring ( 0 , index ) ; if ( ! pid . matches ( "[0-9]+" ) ) { return null ; } return pid ; }
|
Return the current process ID .
| 89
| 6
|
159,641
|
private File createNewFile ( File outputDir , String prefix , String extension ) throws IOException { String dateTime = new SimpleDateFormat ( "yyyyMMdd.HHmmss" ) . format ( new Date ( ) ) ; File outputFile ; do { String pid = PID == null ? "" : PID + ' ' ; int sequenceNumber = nextSequenceNumber . getAndIncrement ( ) ; outputFile = new File ( outputDir , String . format ( "%s.%s.%s%04d.%s" , prefix , dateTime , pid , sequenceNumber , extension ) ) ; } while ( outputFile . exists ( ) ) ; return outputFile ; }
|
Create a dump file with a unique name .
| 144
| 9
|
159,642
|
private File createThreadDump ( File outputDir ) { // Determine if we're using Java Attach (VirtualMachine.remoteDataDump) // or the DiagnosticCommand MBean. Java Attach is only available on // JREs (not JDKs) and sometimes fails to connect, but we prefer it when // available because DiagnosticCommand returns the entire thread dump as // a single String, which risks OutOfMemoryError. VirtualMachine vm = null ; try { vm = getAttachedVirtualMachine ( ) ; if ( vm == null && diagnosticCommandName == null ) { // Neither Java Attach nor DiagnosticCommand are available, so // it's not possible to create a thread dump. return null ; } } catch ( VirtualMachineException e ) { // Sometimes Java Attach fails spuriously. If DiagnosticCommand is // available, try that. Otherwise, propagate the failure. if ( diagnosticCommandName == null ) { Throwable cause = e . getCause ( ) ; throw cause instanceof RuntimeException ? ( RuntimeException ) cause : new RuntimeException ( cause ) ; } } File outputFile = null ; InputStream input = null ; OutputStream output = null ; boolean success = false ; try { // Use a filename that resembles an IBM javacore. outputFile = createNewFile ( outputDir , "javadump" , "txt" ) ; if ( vm != null ) { input = vm . remoteDataDump ( ) ; input = new BufferedInputStream ( input ) ; output = new FileOutputStream ( outputFile ) ; output = new BufferedOutputStream ( output ) ; byte [ ] buf = new byte [ 8192 ] ; for ( int read ; ( read = input . read ( buf ) ) != - 1 ; ) { output . write ( buf , 0 , read ) ; } } else { String outputString ; try { outputString = ( String ) platformMBeanServer . invoke ( diagnosticCommandName , "threadPrint" , new Object [ ] { new String [ ] { "-l" } } , new String [ ] { String [ ] . class . getName ( ) } ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } output = new FileOutputStream ( outputFile ) ; Writer writer = new OutputStreamWriter ( output , "UTF-8" ) ; writer . write ( outputString ) ; writer . close ( ) ; } success = true ; } catch ( IOException ex ) { throw new RuntimeException ( ex ) ; } finally { Utils . tryToClose ( input ) ; Utils . tryToClose ( output ) ; if ( ! success && outputFile != null && ! outputFile . delete ( ) ) { // Avoid FindBugs warning. We .delete() as a best effort. outputFile = null ; } } return outputFile ; }
|
Create a thread dump . This is the same output normally printed to the console when a kill - QUIT or Ctrl - Break is sent to the process .
| 600
| 31
|
159,643
|
private synchronized VirtualMachine getAttachedVirtualMachine ( ) throws VirtualMachineException { if ( PID == null ) { // Java Attach requires a PID. return null ; } if ( vm == null ) { vm = createVirtualMachine ( ) ; } return vm . isAttached ( ) ? vm : null ; }
|
Returns sun . tools . attach . HotSpotVirtualMachine if possible .
| 65
| 14
|
159,644
|
private VirtualMachine createVirtualMachine ( ) throws VirtualMachineException { ClassLoader toolsClassLoader ; File toolsJar = getToolsJar ( ) ; if ( toolsJar == null ) { // The attach classes are on the boot classpath on Mac. toolsClassLoader = HotSpotJavaDumperImpl . class . getClassLoader ( ) ; } else { try { toolsClassLoader = new URLClassLoader ( new URL [ ] { toolsJar . getAbsoluteFile ( ) . toURI ( ) . toURL ( ) } ) ; } catch ( MalformedURLException e ) { throw new RuntimeException ( e ) ; } } try { Class < ? > vmClass = toolsClassLoader . loadClass ( "com.sun.tools.attach.VirtualMachine" ) ; Method attachMethod = vmClass . getMethod ( "attach" , new Class < ? > [ ] { String . class } ) ; Object toolsVM = attachMethod . invoke ( null , new Object [ ] { PID } ) ; Method remoteDataDumpMethod = toolsVM . getClass ( ) . getMethod ( "remoteDataDump" , new Class < ? > [ ] { Object [ ] . class } ) ; return new VirtualMachine ( toolsVM , remoteDataDumpMethod ) ; } catch ( ClassNotFoundException e ) { // The class isn't found, so we won't be able to create dumps. } catch ( InvocationTargetException e ) { throw new VirtualMachineException ( e ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return new VirtualMachine ( null , null ) ; }
|
Create a VirtualMachine wrapper .
| 339
| 6
|
159,645
|
public List < com . ibm . wsspi . security . wim . model . IdentifierType > getManager ( ) { if ( manager == null ) { manager = new ArrayList < com . ibm . wsspi . security . wim . model . IdentifierType > ( ) ; } return this . manager ; }
|
Gets the value of the manager property .
| 71
| 9
|
159,646
|
public List < com . ibm . wsspi . security . wim . model . IdentifierType > getSecretary ( ) { if ( secretary == null ) { secretary = new ArrayList < com . ibm . wsspi . security . wim . model . IdentifierType > ( ) ; } return this . secretary ; }
|
Gets the value of the secretary property .
| 71
| 9
|
159,647
|
public List < com . ibm . wsspi . security . wim . model . AddressType > getHomeAddress ( ) { if ( homeAddress == null ) { homeAddress = new ArrayList < com . ibm . wsspi . security . wim . model . AddressType > ( ) ; } return this . homeAddress ; }
|
Gets the value of the homeAddress property .
| 73
| 10
|
159,648
|
public List < com . ibm . wsspi . security . wim . model . AddressType > getBusinessAddress ( ) { if ( businessAddress == null ) { businessAddress = new ArrayList < com . ibm . wsspi . security . wim . model . AddressType > ( ) ; } return this . businessAddress ; }
|
Gets the value of the businessAddress property .
| 73
| 10
|
159,649
|
public static ModuleMetaData getModuleMetaData ( ) { ComponentMetaData cmd = getComponentMetaData ( ) ; ModuleMetaData mmd = null ; if ( cmd != null ) { mmd = cmd . getModuleMetaData ( ) ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "ModuleMetaData object is " + ( mmd != null ? mmd . toString ( ) : "null!" ) ) ; } return mmd ; }
|
Gets the metadata for the module
| 103
| 7
|
159,650
|
void setDelete ( GBSNode deleteNode , int deleteIndex ) { _deleteNode = deleteNode ; _deleteIndex = deleteIndex ; _notFound = false ; }
|
Remember the information about the delete point .
| 36
| 8
|
159,651
|
void setTarget ( GBSNode targetNode , int targetIndex , int type ) { _targetNode = targetNode ; _targetIndex = targetIndex ; _type = type ; }
|
Remember the information about the target point .
| 38
| 8
|
159,652
|
void reset ( ) { _deleteNode = null ; _deleteIndex = 0 ; _targetNode = null ; _targetIndex = 0 ; _type = NONE ; _notFound = true ; }
|
Return this object to its original post - construction state .
| 42
| 11
|
159,653
|
private String getPID ( String dir , String serverName ) { String pid = null ; if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { String pidFile = dir + File . separator + "wlp" + File . separator + "usr" + File . separator + "servers" + File . separator + ".pid" + File . separator + serverName + ".pid" ; try { BufferedReader br = new BufferedReader ( new InputStreamReader ( new FileInputStream ( pidFile ) , "UTF-8" ) ) ; try { return br . readLine ( ) ; } finally { br . close ( ) ; } } catch ( IOException e ) { pid = null ; } if ( pid == null ) { Object [ ] substitution = { dir } ; System . out . println ( MessageFormat . format ( resourceBundle . getString ( "UNABLE_TO_FIND_PID" ) , substitution ) ) ; } } return pid ; }
|
Return PID from server directory for cygwin environment only .
| 221
| 12
|
159,654
|
private void stopServer ( ) throws IOException { // build stop command for Unix platforms String cmd = dir + File . separator + "wlp" + File . separator + "bin" + File . separator + "server stop " + serverName ; if ( platformType == SelfExtractUtils . PlatformType_UNIX ) { // use command as-is } else if ( platformType == SelfExtractUtils . PlatformType_WINDOWS ) { cmd = "cmd /k " + cmd ; } else if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { cmd = "bash -c " + ' ' + cmd . replace ( ' ' , ' ' ) + ' ' ; } Runtime . getRuntime ( ) . exec ( cmd , SelfExtractUtils . runEnv ( dir ) , null ) ; // stop server }
|
Run server stop command
| 186
| 4
|
159,655
|
private void startAsyncDelete ( ) throws IOException { Runtime rt = Runtime . getRuntime ( ) ; File scriptFile = null ; if ( platformType == SelfExtractUtils . PlatformType_UNIX ) { scriptFile = writeCleanupFile ( SelfExtractUtils . PlatformType_UNIX ) ; rt . exec ( "chmod 750 " + scriptFile . getAbsolutePath ( ) ) ; rt . exec ( "sh -c " + scriptFile . getAbsolutePath ( ) + " &" ) ; } else if ( platformType == SelfExtractUtils . PlatformType_WINDOWS ) { scriptFile = writeCleanupFile ( SelfExtractUtils . PlatformType_WINDOWS ) ; // Note: must redirect output in order for script to run on windows. // This is a quirk validated by testing. Redirect to NUL is fine since we're // not trying to trap this output anyway. rt . exec ( "cmd /k start /B " + scriptFile . getAbsolutePath ( ) + " >/NUL 2>/NUL" ) ; } else if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { scriptFile = writeCleanupFile ( SelfExtractUtils . PlatformType_CYGWIN ) ; // convert to Unix type path and run under bash rt . exec ( "bash -c " + scriptFile . getAbsolutePath ( ) . replace ( ' ' , ' ' ) + " &" ) ; } }
|
Start async deletion using background script
| 327
| 6
|
159,656
|
private void writeWindowsCleanup ( File file , BufferedWriter bw ) throws IOException { bw . write ( "set max=30\n" ) ; bw . write ( "set cnt=0\n" ) ; bw . write ( "set dir=" + dir + "\n" ) ; bw . write ( "echo delete %dir%\n" ) ; bw . write ( ":while\n" ) ; bw . write ( " if exist %dir% (\n" ) ; bw . write ( " rmdir /s /q %dir%\n" ) ; bw . write ( " timeout 1\n" ) ; bw . write ( " set /a cnt+=1\n" ) ; bw . write ( " if %cnt% leq %max% (\n" ) ; bw . write ( " goto :while \n" ) ; bw . write ( " )\n" ) ; bw . write ( " )\n" ) ; bw . write ( "erase " + file . getAbsoluteFile ( ) + "\n" ) ; }
|
Write logic for windows cleanup script
| 251
| 6
|
159,657
|
private void writeUnixCleanup ( File file , BufferedWriter bw ) throws IOException { bw . write ( "echo begin delete" + "\n" ) ; bw . write ( "n=0" + "\n" ) ; bw . write ( "while [ $n -ne 1 ]; do" + "\n" ) ; bw . write ( " sleep 3" + "\n" ) ; bw . write ( " if [ -e " + dir . replace ( ' ' , ' ' ) + " ]; then" + "\n" ) ; bw . write ( " rm -rf " + dir . replace ( ' ' , ' ' ) + "\n" ) ; bw . write ( " else" + "\n" ) ; bw . write ( " echo file not found - n=$n" + "\n" ) ; bw . write ( " n=1" + "\n" ) ; bw . write ( " fi" + "\n" ) ; bw . write ( "done" + "\n" ) ; bw . write ( "echo end delete" + "\n" ) ; bw . write ( "rm " + file . getAbsolutePath ( ) . replace ( ' ' , ' ' ) + "\n" ) ; }
|
Write logic for Unix cleanup script
| 277
| 6
|
159,658
|
private void writeCygwinCleanup ( File file , BufferedWriter bw ) throws IOException { // Under cygwin, must explicitly kill the process that runs // the server. It simply does not die on its own. And it's // JVM holds file locks which will prevent cleanup of extraction // directory. So kill it. String pid = getPID ( dir , serverName ) ; if ( pid != null ) bw . write ( "kill " + pid + "\n" ) ; writeUnixCleanup ( file , bw ) ; }
|
Write logic for Cygwin cleanup script
| 117
| 8
|
159,659
|
public void run ( ) { try { stopServer ( ) ; // first, stop server // wait on error/output stream threads to complete // note on Windows the streams never close, so wait with brief timeout if ( ! System . getProperty ( "os.name" ) . startsWith ( "Win" ) ) { out . join ( ) ; err . join ( ) ; } else { // windows, so use timeout out . join ( 500 ) ; err . join ( 500 ) ; } startAsyncDelete ( ) ; // now launch async process to cleanup extraction directory } catch ( Exception e ) { throw new RuntimeException ( "Shutdown hook failed with exception " + e . getMessage ( ) ) ; } }
|
Main method for shutdown hook . Job of this hook is to stop server and delete extraction directory .
| 148
| 19
|
159,660
|
protected int position ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "position" , this ) ; int position = _absolutePosition + _buffer . position ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "position" , new Integer ( position ) ) ; return position ; }
|
Returns the position of the byte cursor for the mapped byte buffer .
| 74
| 13
|
159,661
|
protected void position ( int newPosition ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "position" , new Object [ ] { this , new Integer ( newPosition ) } ) ; newPosition -= _absolutePosition ; _buffer . position ( newPosition ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "position" ) ; }
|
Sets the position of the byte cursor for the mapped byte buffer .
| 83
| 14
|
159,662
|
protected void advancePosition ( int bytes ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "advancePosition" , new Object [ ] { this , new Integer ( bytes ) } ) ; final int newPosition = _buffer . position ( ) + bytes ; _buffer . position ( newPosition ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Buffer's position now " + newPosition ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "advancePosition" ) ; }
|
Moves the current byte cursor position for the mapped byte buffer forwards .
| 120
| 14
|
159,663
|
protected void get ( byte [ ] bytes ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "get" , new Object [ ] { this , new Integer ( bytes . length ) } ) ; _buffer . get ( bytes ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , RLSUtils . toHexString ( bytes , RLSUtils . MAX_DISPLAY_BYTES ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "get" ) ; }
|
Getter method used to read bytes . length bytes from the mapped byte buffer at the current byte cursor position into the supplied byte array . The byte cursor is advanced by bytes . length .
| 121
| 37
|
159,664
|
protected int getInt ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getInt" , this ) ; int data = _buffer . getInt ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getInt" , new Integer ( data ) ) ; return data ; }
|
Getter method used to read an integer from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of an integer .
| 74
| 32
|
159,665
|
protected long getLong ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getLong" , this ) ; long data = _buffer . getLong ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getLong" , new Long ( data ) ) ; return data ; }
|
Getter method used to a long from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a long .
| 74
| 31
|
159,666
|
protected short getShort ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getShort" , this ) ; short data = _buffer . getShort ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getShort" , new Short ( data ) ) ; return data ; }
|
Getter method used to a short from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a short .
| 74
| 31
|
159,667
|
protected boolean getBoolean ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getBoolean" , this ) ; byte dataByte = _buffer . get ( ) ; boolean data = ( dataByte == TRUE ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getBoolean" , new Boolean ( data ) ) ; return data ; }
|
Getter method used to a boolean from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a boolean .
| 87
| 31
|
159,668
|
private Object readItem ( ) { Object itemRead = null ; try { currentChunkStatus . incrementItemsTouchedInCurrentChunk ( ) ; // call read listeners before and after the actual read for ( ItemReadListenerProxy readListenerProxy : itemReadListeners ) { readListenerProxy . beforeRead ( ) ; } itemRead = readerProxy . readItem ( ) ; for ( ItemReadListenerProxy readListenerProxy : itemReadListeners ) { readListenerProxy . afterRead ( itemRead ) ; } // itemRead == null means we reached the end of // the readerProxy "resultset" if ( itemRead == null ) { currentChunkStatus . markReadNull ( ) ; currentChunkStatus . decrementItemsTouchedInCurrentChunk ( ) ; } } catch ( Exception e ) { runtimeStepExecution . setException ( e ) ; for ( ItemReadListenerProxy readListenerProxy : itemReadListeners ) { readListenerProxy . onReadError ( e ) ; } if ( ! currentChunkStatus . isRetryingAfterRollback ( ) ) { if ( retryReadException ( e ) ) { if ( ! retryHandler . isRollbackException ( e ) ) { // retry without rollback itemRead = readItem ( ) ; } else { // retry with rollback currentChunkStatus . markForRollbackWithRetry ( e ) ; } } else if ( skipReadException ( e ) ) { currentItemStatus . setSkipped ( true ) ; runtimeStepExecution . getMetric ( MetricImpl . MetricType . READ_SKIP_COUNT ) . incValue ( ) ; } else { throw new BatchContainerRuntimeException ( e ) ; } } else { // coming from a rollback retry if ( skipReadException ( e ) ) { currentItemStatus . setSkipped ( true ) ; runtimeStepExecution . getMetric ( MetricImpl . MetricType . READ_SKIP_COUNT ) . incValue ( ) ; } else if ( retryReadException ( e ) ) { if ( ! retryHandler . isRollbackException ( e ) ) { // retry without rollback itemRead = readItem ( ) ; } else { // retry with rollback currentChunkStatus . markForRollbackWithRetry ( e ) ; } } else { throw new BatchContainerRuntimeException ( e ) ; } } } catch ( Throwable e ) { throw new BatchContainerRuntimeException ( e ) ; } logger . exiting ( sourceClass , "readItem" , itemRead == null ? "<null>" : itemRead ) ; return itemRead ; }
|
Reads an item from the reader
| 560
| 7
|
159,669
|
private void publishCheckpointEvent ( String stepName , long jobInstanceId , long jobExecutionId , long stepExecutionId ) { BatchEventsPublisher publisher = getBatchEventsPublisher ( ) ; if ( publisher != null ) { String correlationId = runtimeWorkUnitExecution . getCorrelationId ( ) ; publisher . publishCheckpointEvent ( stepName , jobInstanceId , jobExecutionId , stepExecutionId , correlationId ) ; } }
|
Helper method to publish checkpoint event
| 97
| 6
|
159,670
|
private int initStepTransactionTimeout ( ) { logger . entering ( sourceClass , "initStepTransactionTimeout" ) ; Properties p = runtimeStepExecution . getProperties ( ) ; int timeout = DEFAULT_TRAN_TIMEOUT_SECONDS ; // default as per spec. if ( p != null && ! p . isEmpty ( ) ) { String propertyTimeOut = p . getProperty ( "javax.transaction.global.timeout" ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . log ( Level . FINE , "javax.transaction.global.timeout = {0}" , propertyTimeOut == null ? "<null>" : propertyTimeOut ) ; } if ( propertyTimeOut != null && ! propertyTimeOut . isEmpty ( ) ) { timeout = Integer . parseInt ( propertyTimeOut , 10 ) ; } } logger . exiting ( sourceClass , "initStepTransactionTimeout" , timeout ) ; return timeout ; }
|
Note we can rely on the StepContext properties already having been set at this point .
| 212
| 17
|
159,671
|
@ Trivial private static String replaceWhitespace ( String value ) { final int length = value . length ( ) ; for ( int i = 0 ; i < length ; ++ i ) { char c = value . charAt ( i ) ; if ( c < 0x20 && ( c == 0x9 || c == 0xA || c == 0xD ) ) { return replace0 ( value , i , length ) ; } } return value ; }
|
Replaces all occurrences of 0x9 0xA and 0xD with 0x20 .
| 98
| 20
|
159,672
|
private void setMessagingEngineUuid ( SIBUuid8 uuid ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setMessagingEngineUuid" , new Object [ ] { uuid } ) ; messagingEngineUuid = uuid ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setMessagingEngineUuid" ) ; }
|
Set the messagingEngineUuid .
| 92
| 7
|
159,673
|
public static Map < String , List < Map < String , Object > > > nest ( Map < String , Object > map , String ... keys ) { Map < String , List < Map < String , Object > > > result = new HashMap < String , List < Map < String , Object > > > ( keys . length ) ; String keyMatch = "" ; for ( String key : keys ) { result . put ( key , new ArrayList < Map < String , Object > > ( ) ) ; keyMatch = MessageFormat . format ( "{0}{1}|" , keyMatch , Pattern . quote ( key ) ) ; } String patternString = MessageFormat . format ( "^({0})\\.([0-9]*)\\.(.*)" , keyMatch . substring ( 0 , keyMatch . length ( ) - 1 ) ) ; Pattern pattern = Pattern . compile ( patternString ) ; for ( Map . Entry < String , Object > entry : map . entrySet ( ) ) { String k = entry . getKey ( ) ; Matcher matcher = pattern . matcher ( k ) ; if ( matcher . matches ( ) ) { int base = 1 ; String key = matcher . group ( 1 ) ; processMatch ( result . get ( key ) , entry . getValue ( ) , matcher , base ) ; } } return result ; }
|
Extracts all sub configurations starting with any of the specified keys
| 287
| 13
|
159,674
|
private static String getUserHome ( ) { String home ; if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { home = System . getenv ( "HOME" ) ; } else { home = System . getProperty ( "user.home" ) ; } return home ; }
|
Determine user home based on platform type . Java user . home property is correct in all cases except for cygwin . For cygwin user . home is Windows home so use HOME env var instead .
| 66
| 43
|
159,675
|
private static String createIfNeeded ( String dir ) { File f = new File ( dir ) ; if ( f . exists ( ) ) { return dir ; } else { boolean success = f . mkdirs ( ) ; if ( success ) return dir ; else return null ; } }
|
Create input directory if it does not exist
| 60
| 8
|
159,676
|
private static String jarFileName ( ) { // do this first so we can access extractor, ok to invoke more than once createExtractor ( ) ; // get <name> from path/<name>.jar String fullyQualifiedFileName = extractor . container . getName ( ) ; int lastSeparator = fullyQualifiedFileName . lastIndexOf ( File . separatorChar ) ; String simpleFileName = fullyQualifiedFileName . substring ( lastSeparator + 1 ) ; int dotIdx = simpleFileName . lastIndexOf ( ' ' ) ; if ( dotIdx != - 1 ) { return simpleFileName . substring ( 0 , simpleFileName . lastIndexOf ( ' ' ) ) ; } return simpleFileName ; }
|
Return jar file name from input archive
| 163
| 7
|
159,677
|
private static void disable2PC ( String extractDirectory , String serverName ) throws IOException { String fileName = extractDirectory + File . separator + "wlp" + File . separator + "usr" + File . separator + "servers" + File . separator + serverName + File . separator + "jvm.options" ; BufferedReader br = null ; BufferedWriter bw = null ; StringBuffer sb = new StringBuffer ( ) ; try { String sCurrentLine ; File file = new File ( fileName ) ; // if file doesnt exists, then create it if ( ! file . exists ( ) ) { boolean success = file . createNewFile ( ) ; if ( ! success ) { throw new IOException ( "Failed to create file " + fileName ) ; } } else { // read existing file content br = new BufferedReader ( new InputStreamReader ( new FileInputStream ( fileName ) , "UTF-8" ) ) ; while ( ( sCurrentLine = br . readLine ( ) ) != null ) { sb . append ( sCurrentLine + "\n" ) ; } } // write property to disable 2PC commit String content = "-Dcom.ibm.tx.jta.disable2PC=true" ; bw = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file . getAbsoluteFile ( ) ) , "UTF-8" ) ) ; bw . write ( sb . toString ( ) ) ; bw . write ( content ) ; } finally { if ( br != null ) br . close ( ) ; if ( bw != null ) bw . close ( ) ; } }
|
Write property into jvm . options to disable 2PC transactions . 2PC transactions are disabled by default because default transaction log is stored in extract directory and therefore foils transaction recovery if the server terminates unexpectedly .
| 362
| 42
|
159,678
|
private static int runServer ( String extractDirectory , String serverName , String [ ] args ) throws IOException , InterruptedException { int rc = 0 ; Runtime rt = Runtime . getRuntime ( ) ; String action = "run" ; if ( System . getenv ( "WLP_JAR_DEBUG" ) != null ) action = "debug" ; // unless user specifies to enable 2PC, disable it if ( System . getenv ( "WLP_JAR_ENABLE_2PC" ) == null ) disable2PC ( extractDirectory , serverName ) ; String cmd = extractDirectory + File . separator + "wlp" + File . separator + "bin" + File . separator + "server " + action + " " + serverName ; if ( args . length > 0 ) { StringBuilder appArgs = new StringBuilder ( " --" ) ; for ( String arg : args ) { appArgs . append ( " " ) . append ( arg ) ; } cmd += appArgs . toString ( ) ; } System . out . println ( cmd ) ; if ( platformType == SelfExtractUtils . PlatformType_UNIX ) { // cmd ready as-is for Unix } else if ( platformType == SelfExtractUtils . PlatformType_WINDOWS ) { cmd = "cmd /k " + cmd ; } else if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { cmd = "bash -c " + ' ' + cmd . replace ( ' ' , ' ' ) + ' ' ; } Process proc = rt . exec ( cmd , SelfExtractUtils . runEnv ( extractDirectory ) , null ) ; // run server // setup and start reader threads for error and output streams StreamReader errorReader = new StreamReader ( proc . getErrorStream ( ) , "ERROR" ) ; errorReader . start ( ) ; StreamReader outputReader = new StreamReader ( proc . getInputStream ( ) , "OUTPUT" ) ; outputReader . start ( ) ; // now setup the shutdown hook Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( new ShutdownHook ( platformType , extractDirectory , serverName , outputReader , errorReader ) ) ) ; // wait on server start process to complete, capture and pass on return code rc = proc . waitFor ( ) ; return rc ; }
|
Run server extracted from jar If environment variable WLP_JAR_DEBUG is set use server debug instead
| 507
| 21
|
159,679
|
private void isInitialized ( boolean condition , String propName ) { if ( condition == true ) { IllegalStateException e = new IllegalStateException ( "J2CGlobalConfigProperties: internal error. Set once property already set." ) ; Tr . error ( tc , "SET_ONCE_PROP_ALREADY_SET_J2CA0159" , ( Object ) null ) ; throw e ; } }
|
Utility method for set once methods .
| 89
| 8
|
159,680
|
public synchronized final void applyRequestGroupConfigChanges ( ) { // Note: on the following call the "false,true" forces the change notification // to be sent. The listener will then pick up all property values in the // group. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "applyRequestGroupConfigChanges" ) ; changeSupport . firePropertyChange ( "applyRequestGroupConfigChanges" , false , true ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "applyRequestGroupConfigChanges" ) ; }
|
Request Stat variable group
| 145
| 4
|
159,681
|
public Object get ( int key ) throws SIErrorException // D214655 { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "get" ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "key: " + key ) ; // f174137 captiveComparitorKey . setValue ( key ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "captiveComparitorKey: " + captiveComparitorKey ) ; // f174317 // Start D214655 Object retObject = map . get ( captiveComparitorKey ) ; if ( retObject == null ) { // If no object existed this is always an error too throw new SIErrorException ( nls . getFormattedMessage ( "NO_SUCH_KEY_SICO2059" , new Object [ ] { "" + key } , null ) // D256974 ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "get" ) ; return retObject ; // End D214655 }
|
Retrives the object associated with a particular key from the map .
| 240
| 14
|
159,682
|
public Object remove ( int key ) throws SIErrorException // D214655 { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "remove" , "" + key ) ; captiveComparitorKey . setValue ( key ) ; // Start D214655 Object retObject = map . remove ( captiveComparitorKey ) ; if ( retObject == null ) { // If no object existed this is always an error too throw new SIErrorException ( nls . getFormattedMessage ( "NO_SUCH_KEY_SICO2059" , new Object [ ] { "" + key } , null ) // D256974 ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "remove" ) ; return retObject ; // End D214655 }
|
Removes an object from the map .
| 176
| 8
|
159,683
|
public Iterator iterator ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "iterator" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "iterator" ) ; return map . values ( ) . iterator ( ) ; }
|
Returns an iterator with which to browse the values
| 65
| 9
|
159,684
|
public boolean containsKey ( int id ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "get" , "" + id ) ; captiveComparitorKey . setValue ( id ) ; final boolean result = map . containsKey ( captiveComparitorKey ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "get" , "" + result ) ; return result ; }
|
Determines if the specified id is present in the IdToObjectMap
| 93
| 15
|
159,685
|
public static Object checkCast ( Object value , Object object , String valueClassName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { ClassLoader valueLoader = value == null ? null : AccessController . doPrivileged ( new GetClassLoaderPrivileged ( value . getClass ( ) ) ) ; ClassLoader contextLoader = AccessController . doPrivileged ( new GetContextClassLoaderPrivileged ( ) ) ; ClassLoader objectLoader = AccessController . doPrivileged ( new GetClassLoaderPrivileged ( object . getClass ( ) ) ) ; ClassLoader objectValueLoader ; try { Class < ? > objectValueClass = Class . forName ( valueClassName , false , objectLoader ) ; objectValueLoader = objectValueClass == null ? null : AccessController . doPrivileged ( new GetClassLoaderPrivileged ( objectValueClass ) ) ; } catch ( Throwable t ) { Tr . debug ( tc , "checkCast: failed to load " + valueClassName , t ) ; objectValueLoader = null ; } Tr . debug ( tc , "checkCast: value=" + Util . identity ( value ) + ", valueClassName=" + valueClassName , ", valueLoader=" + Util . identity ( valueLoader ) + ", contextLoader=" + Util . identity ( contextLoader ) + ", object=" + Util . identity ( object ) + ", objectLoader=" + Util . identity ( objectLoader ) + ", objectValueLoader=" + Util . identity ( objectValueLoader ) ) ; } return value ; }
|
Called by JIT - deployed code that is performing a checkcast . For the convenience of generated code the input value is returned directly .
| 332
| 28
|
159,686
|
GBSNode getNode ( Object newKey ) { GBSNode p ; if ( _nodePool == null ) p = new GBSNode ( this , newKey ) ; else { p = _nodePool ; _nodePool = p . rightChild ( ) ; p . reset ( newKey ) ; } return p ; }
|
Allocate a new node for the tree .
| 69
| 9
|
159,687
|
public void prePopulate ( int x ) { for ( int i = 0 ; i < x ; i ++ ) { GBSNode p = new GBSNode ( this ) ; releaseNode ( p ) ; } }
|
Add some number of free nodes to the node pool for testing .
| 46
| 13
|
159,688
|
public int maximumFringeImbalance ( ) { int maxBal ; GBSNode q = root ( ) ; if ( q . leftChild ( ) == null ) { maxBal = kFactor ( ) - 1 ; if ( maxBal < 3 ) maxBal = 3 ; } else { if ( ( kFactor ( ) % 3 ) == 0 ) maxBal = kFactor ( ) + 2 ; else maxBal = kFactor ( ) + 1 ; } return maxBal ; }
|
Return the maximum imbalance allowed for a fringe .
| 102
| 9
|
159,689
|
private int calcTZeroDepth ( int proposedK ) { int d = - 1 ; if ( ( proposedK >= 0 ) && ( proposedK < _t0_d . length ) ) d = _t0_d [ proposedK ] ; if ( d < 0 ) { String x = "K Factor (" + proposedK + ") is invalid.\n" + "Valid K factors are: " + kFactorString ( ) + "." ; throw new IllegalArgumentException ( x ) ; } return d ; }
|
Set the depth of a T0 sub - tree .
| 111
| 11
|
159,690
|
static boolean checkForPossibleIndexChange ( int v1 , int v2 , Throwable exc , String msg ) { if ( v1 != v2 ) return pessimisticNeeded ; else { GBSTreeException x = new GBSTreeException ( msg + ", v1 = " + v1 , exc ) ; throw x ; } }
|
Process an exception that may have occurred while the index was changing .
| 71
| 13
|
159,691
|
public Iterator iterator ( ) { GBSIterator x = new GBSIterator ( this ) ; Iterator q = ( Iterator ) x ; return q ; }
|
Create and return an Iterator positioned on the beginning of the tree .
| 34
| 14
|
159,692
|
public Object searchEqual ( Object searchKey ) { SearchComparator comp = searchComparator ( SearchComparator . EQ ) ; Object p = find ( comp , searchKey ) ; return p ; }
|
Find the first key in the index that is equal to the given key .
| 42
| 15
|
159,693
|
public Object searchGreater ( Object searchKey ) { SearchComparator comp = searchComparator ( SearchComparator . GT ) ; Object p = find ( comp , searchKey ) ; return p ; }
|
Find the first key in the index that is greater than the given key .
| 42
| 15
|
159,694
|
public Object searchGreaterOrEqual ( Object searchKey ) { SearchComparator comp = searchComparator ( SearchComparator . GE ) ; Object p = find ( comp , searchKey ) ; return p ; }
|
Find the first key in the index that is greater than or equal to the given key .
| 45
| 18
|
159,695
|
private SearchNode getSearchNode ( ) { Object x = _searchNode . get ( ) ; SearchNode g = null ; if ( x != null ) { g = ( SearchNode ) x ; g . reset ( ) ; } else { g = new SearchNode ( ) ; x = ( Object ) g ; _searchNode . set ( x ) ; } return g ; }
|
Find a SearchNode for use by the current thread .
| 79
| 11
|
159,696
|
private boolean optimisticFind ( SearchComparator comp , Object searchKey , SearchNode point ) { point . reset ( ) ; int v1 = _vno ; if ( root ( ) != null ) { if ( ( v1 & 1 ) != 0 ) return pessimisticNeeded ; synchronized ( point ) { } try { internalFind ( comp , searchKey , point ) ; } catch ( NullPointerException npe ) { //No FFDC Code Needed. _nullPointerExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , npe , "optimisticInsert" ) ; } catch ( OptimisticDepthException ode ) { //No FFDC Code Needed. _optimisticDepthExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , ode , "optimisticInsert" ) ; } if ( v1 != _vno ) return pessimisticNeeded ; } _optimisticFinds ++ ; return optimisticWorked ; }
|
Optimistic find in a GBS Tree
| 210
| 9
|
159,697
|
private void pessimisticFind ( SearchComparator comp , Object searchKey , SearchNode point ) { point . reset ( ) ; synchronized ( this ) { internalFind ( comp , searchKey , point ) ; _pessimisticFinds ++ ; } }
|
Pessimistic find in a GBS Tree
| 51
| 9
|
159,698
|
synchronized Object iteratorFind ( DeleteStack stack , SearchComparator comp , Object searchKey , SearchNode point ) { point . reset ( ) ; GBSNode p = root ( ) ; GBSNode l = null ; GBSNode r = null ; int lx = 0 ; int rx = 0 ; Object ret = null ; stack . start ( dummyTopNode ( ) , "GBSTree.iteratorFind" ) ; while ( p != null ) { int xcc = comp . compare ( searchKey , p . middleKey ( ) ) ; if ( xcc == 0 ) { point . setFound ( p , p . middleIndex ( ) ) ; p = null ; } else if ( xcc < 0 ) { if ( p . leftChild ( ) != null ) { stack . push ( NodeStack . PROCESS_CURRENT , p , "GBSTree.iteratorFind(1)" ) ; l = p ; lx = stack . index ( ) ; p = p . leftChild ( ) ; } else { leftSearch ( comp , p , r , searchKey , point ) ; if ( point . wasFound ( ) ) { if ( point . foundNode ( ) == r ) stack . reset ( rx - 1 ) ; } p = null ; } } else // (xcc > 0) { if ( p . rightChild ( ) != null ) { stack . push ( NodeStack . DONE_VISITS , p , "GBSTree.iteratorFind(2)" ) ; r = p ; rx = stack . index ( ) ; p = p . rightChild ( ) ; } else { rightSearch ( comp , p , l , searchKey , point ) ; if ( point . wasFound ( ) ) { if ( point . foundNode ( ) == l ) stack . reset ( lx - 1 ) ; } p = null ; } } } if ( point . wasFound ( ) ) { ret = point . foundNode ( ) . key ( point . foundIndex ( ) ) ; point . setLocation ( ret ) ; } return ret ; }
|
Search the index from an Iterator .
| 440
| 8
|
159,699
|
private void leftSearch ( SearchComparator comp , GBSNode p , GBSNode r , Object searchKey , SearchNode point ) { if ( r == null ) /* There is no upper predecessor */ { int idx = p . searchLeft ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( p , idx ) ; } else /* There is an upper predecessor */ { int xcc = comp . compare ( searchKey , r . rightMostKey ( ) ) ; if ( xcc == 0 ) /* Target is right-most in upper pred. */ point . setFound ( r , r . rightMostIndex ( ) ) ; else if ( xcc > 0 ) /* Target (if it exists) is in left */ { /* half of current node */ int idx = p . searchLeft ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( p , idx ) ; } else /* Target (if it exists) is in right */ { /* half of predecessor (if it exists) */ int idx = r . searchRight ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( r , idx ) ; } } }
|
Search after falling off a left edge .
| 268
| 8
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.