idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
14,900
String upcaseFirst ( String name ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( name . substring ( 0 , 1 ) . toUpperCase ( Locale . ENGLISH ) ) ; sb . append ( name . substring ( 1 ) ) ; return sb . toString ( ) ; }
Upcase first letter
14,901
public int getInitialSize ( ) { if ( initialSize == null ) return getMinSize ( ) ; if ( initialSize . intValue ( ) > maxSize ) return maxSize ; return initialSize . intValue ( ) ; }
Get initial - pool - size
14,902
private String dumpQueuedThread ( Thread t ) { StringBuilder sb = new StringBuilder ( ) ; sb = sb . append ( "Queued thread: " ) ; sb = sb . append ( t . getName ( ) ) ; sb = sb . append ( newLine ) ; StackTraceElement [ ] stes = SecurityActions . getStackTrace ( t ) ; if ( stes != null ) { for ( StackTraceElement ste ...
Dump a thread
14,903
public synchronized void addEvent ( WorkManagerEvent event ) { if ( trace ) log . tracef ( "addEvent(%s)" , event ) ; List < WorkManagerEvent > e = events . get ( event . getAddress ( ) . getWorkManagerName ( ) ) ; if ( e == null ) { e = new ArrayList < WorkManagerEvent > ( ) ; events . put ( event . getAddress ( ) . g...
Add an event
14,904
private ScriptText createScriptText ( int key , BMRule rule ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "# BMUnit autogenerated script: " ) . append ( rule . name ( ) ) ; builder . append ( "\nRULE " ) ; builder . append ( rule . name ( ) ) ; if ( rule . isInterface ( ) ) { builder . append (...
Create a ScriptText instance
14,905
static Class < ? > [ ] getDeclaredClasses ( final Class < ? > c ) { if ( System . getSecurityManager ( ) == null ) return c . getDeclaredClasses ( ) ; return AccessController . doPrivileged ( new PrivilegedAction < Class < ? > [ ] > ( ) { public Class < ? > [ ] run ( ) { return c . getDeclaredClasses ( ) ; } } ) ; }
Get the declared classes
14,906
static Field getDeclaredField ( final Class < ? > c , final String name ) throws NoSuchFieldException { if ( System . getSecurityManager ( ) == null ) return c . getDeclaredField ( name ) ; Field result = AccessController . doPrivileged ( new PrivilegedAction < Field > ( ) { public Field run ( ) { try { return c . getD...
Get the declared field
14,907
public String getAsText ( ) { if ( throwable != null ) return throwable . toString ( ) ; if ( result != null ) { try { if ( editor != null ) { editor . setValue ( result ) ; return editor . getAsText ( ) ; } else { return result . toString ( ) ; } } catch ( Exception e ) { return "String representation of " + name + "u...
Get the text representation
14,908
private void checkTransport ( ) throws WorkException { if ( ! transport . isInitialized ( ) ) { try { transport . initialize ( ) ; initialize ( ) ; } catch ( Throwable t ) { WorkException we = new WorkException ( "Exception during transport initialization" ) ; we . initCause ( t ) ; throw we ; } } }
Check the transport
14,909
private synchronized void removeDistributedStatistics ( ) { if ( distributedStatistics != null ) { listeners . remove ( ( NotificationListener ) distributedStatistics ) ; distributedStatistics . setTransport ( null ) ; distributedStatistics = null ; } }
Remove distributed statistics
14,910
Address getLocalAddress ( ) { if ( localAddress == null ) localAddress = new Address ( getId ( ) , getName ( ) , transport != null ? transport . getId ( ) : null ) ; return localAddress ; }
Get local address
14,911
public void setShortRunningThreadPool ( BlockingExecutor executor ) { if ( trace ) log . trace ( "short running executor:" + ( executor != null ? executor . getClass ( ) : "null" ) ) ; if ( executor != null ) { if ( executor instanceof StatisticsExecutor ) { this . shortRunningExecutor = ( StatisticsExecutor ) executor...
Set the executor for short running tasks
14,912
public void setLongRunningThreadPool ( BlockingExecutor executor ) { if ( trace ) log . trace ( "long running executor:" + ( executor != null ? executor . getClass ( ) : "null" ) ) ; if ( executor != null ) { if ( executor instanceof StatisticsExecutor ) { this . longRunningExecutor = ( StatisticsExecutor ) executor ; ...
Set the executor for long running tasks
14,913
public void doFirstChecks ( Work work , long startTimeout , ExecutionContext execContext ) throws WorkException { if ( isShutdown ( ) ) throw new WorkRejectedException ( bundle . workmanagerShutdown ( ) ) ; if ( work == null ) throw new WorkRejectedException ( bundle . workIsNull ( ) ) ; if ( startTimeout < 0 ) throw n...
Do first checks for work starting methods
14,914
void addWorkWrapper ( WorkWrapper ww ) { synchronized ( activeWorkWrappers ) { activeWorkWrappers . add ( ww ) ; if ( statisticsEnabled ) statistics . setWorkActive ( activeWorkWrappers . size ( ) ) ; } }
Add work wrapper to active set
14,915
void removeWorkWrapper ( WorkWrapper ww ) { synchronized ( activeWorkWrappers ) { activeWorkWrappers . remove ( ww ) ; if ( statisticsEnabled ) statistics . setWorkActive ( activeWorkWrappers . size ( ) ) ; } }
Remove work wrapper from active set
14,916
private BlockingExecutor getExecutor ( Work work ) { BlockingExecutor executor = shortRunningExecutor ; if ( longRunningExecutor != null && WorkManagerUtil . isLongRunning ( work ) ) { executor = longRunningExecutor ; } fireHintsComplete ( work ) ; return executor ; }
Get the executor
14,917
private void fireHintsComplete ( Work work ) { if ( work != null && work instanceof WorkContextProvider ) { WorkContextProvider wcProvider = ( WorkContextProvider ) work ; List < WorkContext > contexts = wcProvider . getWorkContexts ( ) ; if ( contexts != null && ! contexts . isEmpty ( ) ) { Iterator < WorkContext > it...
Fire complete for HintsContext
14,918
private void checkAndVerifyWork ( Work work , ExecutionContext executionContext ) throws WorkException { if ( specCompliant ) { verifyWork ( work ) ; } if ( work instanceof WorkContextProvider && executionContext != null ) { throw new WorkRejectedException ( bundle . workExecutionContextMustNullImplementsWorkContextPro...
Check and verify work before submitting .
14,919
private void verifyWork ( Work work ) throws WorkException { Class < ? extends Work > workClass = work . getClass ( ) ; String className = workClass . getName ( ) ; if ( ! validatedWork . contains ( className ) ) { if ( isWorkMethodSynchronized ( workClass , RUN_METHOD_NAME ) ) throw new WorkException ( bundle . runMet...
Verify the given work instance .
14,920
private boolean isWorkMethodSynchronized ( Class < ? extends Work > workClass , String methodName ) { try { Method method = SecurityActions . getMethod ( workClass , methodName , new Class [ 0 ] ) ; if ( Modifier . isSynchronized ( method . getModifiers ( ) ) ) return true ; } catch ( NoSuchMethodException e ) { } retu...
Checks if Work implementation class method is synchronized
14,921
private void checkWorkCompletionException ( WorkWrapper wrapper ) throws WorkException { if ( wrapper . getWorkException ( ) != null ) { if ( trace ) log . tracef ( "Exception %s for %s" , wrapper . getWorkException ( ) , this ) ; deltaWorkFailed ( ) ; throw wrapper . getWorkException ( ) ; } deltaWorkSuccessful ( ) ; ...
Checks work completed status .
14,922
private void fireWorkContextSetupFailed ( Object workContext , String errorCode , WorkListener workListener , Work work , WorkException exception ) { if ( workListener != null ) { WorkEvent event = new WorkEvent ( this , WorkEvent . WORK_STARTED , work , null ) ; workListener . workStarted ( event ) ; } if ( workContex...
Calls listener with given error code .
14,923
@ SuppressWarnings ( "unchecked" ) private < T extends WorkContext > Class < T > getSupportedWorkContextClass ( Class < T > adaptorWorkContext ) { for ( Class < ? extends WorkContext > supportedWorkContext : SUPPORTED_WORK_CONTEXT_CLASSES ) { if ( supportedWorkContext . isAssignableFrom ( adaptorWorkContext ) ) { Class...
Returns work context class if given work context is supported by server returns null instance otherwise .
14,924
public < T > T getWorkContext ( Class < T > workContextClass ) { T instance = null ; if ( workContexts != null && workContexts . containsKey ( workContextClass ) ) { instance = workContextClass . cast ( workContexts . get ( workContextClass ) ) ; } return instance ; }
Returns work context instance .
14,925
public void addWorkContext ( Class < ? extends WorkContext > workContextClass , WorkContext workContext ) { if ( workContextClass == null ) { throw new IllegalArgumentException ( "Work context class is null" ) ; } if ( workContext == null ) { throw new IllegalArgumentException ( "Work context is null" ) ; } if ( workCo...
Adds new work context .
14,926
private void fireWorkContextSetupComplete ( Object workContext ) { if ( workContext != null && workContext instanceof WorkContextLifecycleListener ) { if ( trace ) log . tracef ( "WorkContextSetupComplete(%s) for %s" , workContext , this ) ; WorkContextLifecycleListener listener = ( WorkContextLifecycleListener ) workC...
Calls listener after work context is setted up .
14,927
private void fireWorkContextSetupFailed ( Object workContext ) { if ( workContext != null && workContext instanceof WorkContextLifecycleListener ) { if ( trace ) log . tracef ( "WorkContextSetupFailed(%s) for %s" , workContext , this ) ; WorkContextLifecycleListener listener = ( WorkContextLifecycleListener ) workConte...
Calls listener if setup failed
14,928
@ SuppressWarnings ( "unchecked" ) public void inject ( Object object , String propertyName , Object propertyValue , String propertyType , boolean includeFields ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { if ( object == null ) throw new IllegalArgumentException ( "Object is nul...
Inject a value into an object property
14,929
protected String getSubstitutionValue ( String input ) { if ( input == null || input . trim ( ) . equals ( "" ) ) return input ; while ( input . indexOf ( "${" ) != - 1 ) { int from = input . indexOf ( "${" ) ; int to = input . indexOf ( "}" ) ; int dv = input . indexOf ( ":" , from + 2 ) ; if ( dv != - 1 && dv > to ) ...
System property substitution
14,930
public static Boolean getShouldDistribute ( DistributableWork work ) { if ( work != null && work instanceof WorkContextProvider ) { List < WorkContext > contexts = ( ( WorkContextProvider ) work ) . getWorkContexts ( ) ; if ( contexts != null ) { for ( WorkContext wc : contexts ) { if ( wc instanceof DistributableConte...
Get should distribute override
14,931
private Xid convertXid ( Xid xid ) { if ( xid instanceof XidWrapper ) return xid ; else return new XidWrapperImpl ( xid , pad , jndiName ) ; }
Return wrapper for given xid .
14,932
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { in . defaultReadObject ( ) ; validatorFactory = BeanValidationImpl . createValidatorFactory ( ) ; }
Read the object - Nothing is read as the validator factory is transient . A new instance is created
14,933
public void setExecutorService ( ExecutorService v ) { if ( v != null ) { executorService = v ; isExternal = true ; } else { executorService = null ; isExternal = false ; } }
Set the executor service
14,934
public void registerPool ( ManagedConnectionPool mcp , long mcpInterval ) { try { lock . lock ( ) ; synchronized ( registeredPools ) { registeredPools . put ( new Key ( System . identityHashCode ( mcp ) , System . currentTimeMillis ( ) , mcpInterval ) , mcp ) ; } if ( mcpInterval > 1 && mcpInterval / 2 < interval ) { i...
Register pool for idle connection cleanup
14,935
public void unregisterPool ( ManagedConnectionPool mcp ) { synchronized ( registeredPools ) { registeredPools . values ( ) . remove ( mcp ) ; if ( registeredPools . isEmpty ( ) ) interval = Long . MAX_VALUE ; } }
Unregister pool instance for idle connection cleanup
14,936
public Metadata registerMetadata ( String name , Connector c , File archive ) { Metadata md = new MetadataImpl ( name , c , archive ) ; metadataRepository . registerMetadata ( md ) ; return md ; }
Register a metadata instance with the repository
14,937
protected void createResourceAdapter ( DeploymentBuilder builder , String raClz , Collection < org . ironjacamar . common . api . metadata . spec . ConfigProperty > configProperties , Map < String , String > overrides , TransactionSupportEnum transactionSupport , String productName , String productVersion , InboundReso...
Create resource adapter instance
14,938
protected void createAdminObject ( DeploymentBuilder builder , Connector connector , AdminObject ao ) throws DeployException { try { String aoClass = findAdminObject ( ao . getClassName ( ) , connector ) ; Class < ? > clz = Class . forName ( aoClass , true , builder . getClassLoader ( ) ) ; Object adminObject = clz . n...
Create admin object instance
14,939
private String findManagedConnectionFactory ( String className , Connector connector ) { for ( org . ironjacamar . common . api . metadata . spec . ConnectionDefinition cd : connector . getResourceadapter ( ) . getOutboundResourceadapter ( ) . getConnectionDefinitions ( ) ) { if ( className . equals ( cd . getManagedCo...
Find the ManagedConnectionFactory class
14,940
private String findAdminObject ( String className , Connector connector ) { for ( org . ironjacamar . common . api . metadata . spec . AdminObject ao : connector . getResourceadapter ( ) . getAdminObjects ( ) ) { if ( className . equals ( ao . getAdminobjectClass ( ) . getValue ( ) ) || className . equals ( ao . getAdm...
Find the AdminObject class
14,941
private Collection < org . ironjacamar . common . api . metadata . spec . ConfigProperty > findConfigProperties ( String className , Connector connector ) { for ( org . ironjacamar . common . api . metadata . spec . ConnectionDefinition cd : connector . getResourceadapter ( ) . getOutboundResourceadapter ( ) . getConne...
Find the config properties for the class
14,942
private Class < ? > convertType ( Class < ? > old ) { if ( Boolean . class . equals ( old ) ) { return boolean . class ; } else if ( boolean . class . equals ( old ) ) { return Boolean . class ; } else if ( Byte . class . equals ( old ) ) { return byte . class ; } else if ( byte . class . equals ( old ) ) { return Byte...
Convert type if possible
14,943
private boolean isSupported ( Class < ? > t ) { if ( Boolean . class . equals ( t ) || boolean . class . equals ( t ) || Byte . class . equals ( t ) || byte . class . equals ( t ) || Short . class . equals ( t ) || short . class . equals ( t ) || Integer . class . equals ( t ) || int . class . equals ( t ) || Long . cl...
Is a support type
14,944
@ SuppressWarnings ( "unchecked" ) protected void associateResourceAdapter ( javax . resource . spi . ResourceAdapter resourceAdapter , Object object ) throws DeployException { if ( resourceAdapter != null && object != null && object instanceof ResourceAdapterAssociation ) { try { ResourceAdapterAssociation raa = ( Res...
Associate resource adapter with the object if it implements ResourceAdapterAssociation
14,945
private TransactionSupportEnum getTransactionSupport ( Connector connector , Activation activation ) { if ( activation . getTransactionSupport ( ) != null ) return activation . getTransactionSupport ( ) ; if ( connector . getResourceadapter ( ) . getOutboundResourceadapter ( ) != null ) return connector . getResourcead...
Get the transaction support level
14,946
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . resourceadapter . ConnectionDefinition cd ) { if ( cd . getJndiName ( ) != null ) cmc . setJndiName ( cd . getJndiName ( ) ) ; if ( cd . isSharable ( ) != null ) cmc . setSharable ( cd ....
Apply connection definition to connection manager configuration
14,947
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . common . Security s ) { if ( s != null && s . getSecurityDomain ( ) != null ) { cmc . setSecurityDomain ( s . getSecurityDomain ( ) ) ; } }
Apply security to connection manager configuration
14,948
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . common . XaPool xp ) { if ( xp != null ) { if ( xp . isIsSameRmOverride ( ) != null ) cmc . setIsSameRMOverride ( xp . isIsSameRmOverride ( ) ) ; if ( xp . isPadXid ( ) != null ) cmc . s...
Apply xa - pool to connection manager configuration
14,949
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . common . Timeout t ) { if ( t != null ) { if ( t . getAllocationRetry ( ) != null ) cmc . setAllocationRetry ( t . getAllocationRetry ( ) ) ; if ( t . getAllocationRetryWaitMillis ( ) !=...
Apply timeout to connection manager configuration
14,950
private void applyPoolConfiguration ( PoolConfiguration pc , org . ironjacamar . common . api . metadata . common . Pool p ) { if ( p != null ) { if ( p . getMinPoolSize ( ) != null ) pc . setMinSize ( p . getMinPoolSize ( ) . intValue ( ) ) ; if ( p . getInitialPoolSize ( ) != null ) pc . setInitialSize ( p . getIniti...
Apply pool to pool configuration
14,951
private void applyPoolConfiguration ( PoolConfiguration pc , org . ironjacamar . common . api . metadata . common . Timeout t ) { if ( t != null ) { if ( t . getBlockingTimeoutMillis ( ) != null ) pc . setBlockingTimeout ( t . getBlockingTimeoutMillis ( ) . longValue ( ) ) ; if ( t . getIdleTimeoutMinutes ( ) != null )...
Apply timeout to pool configuration
14,952
private void applyPoolConfiguration ( PoolConfiguration pc , org . ironjacamar . common . api . metadata . common . Validation v ) { if ( v != null ) { if ( v . isValidateOnMatch ( ) != null ) pc . setValidateOnMatch ( v . isValidateOnMatch ( ) . booleanValue ( ) ) ; if ( v . isBackgroundValidation ( ) != null ) pc . s...
Apply validation to pool configuration
14,953
private Map < String , ActivationSpecImpl > createInboundMapping ( InboundResourceAdapter ira , ClassLoader cl ) throws Exception { if ( ira != null ) { Map < String , ActivationSpecImpl > result = new HashMap < > ( ) ; for ( org . ironjacamar . common . api . metadata . spec . MessageListener ml : ira . getMessageadap...
Create an inbound mapping
14,954
private Map < String , Class < ? > > createPropertyMap ( Class < ? > clz ) throws Exception { Map < String , Class < ? > > result = new HashMap < > ( ) ; for ( Method m : clz . getMethods ( ) ) { if ( m . getName ( ) . startsWith ( "set" ) ) { if ( m . getReturnType ( ) . equals ( Void . TYPE ) && m . getParameterCount...
Get property map
14,955
private String getProductName ( Connector raXml ) { if ( raXml != null && ! XsdString . isNull ( raXml . getEisType ( ) ) ) return raXml . getEisType ( ) . getValue ( ) ; return "" ; }
Get the product name for the resource adapter
14,956
private String getProductVersion ( Connector raXml ) { if ( raXml != null && ! XsdString . isNull ( raXml . getResourceadapterVersion ( ) ) ) return raXml . getResourceadapterVersion ( ) . getValue ( ) ; return "" ; }
Get the product version for the resource adapter
14,957
private boolean is16 ( Connector connector ) { if ( connector == null || connector . getVersion ( ) == Connector . Version . V_16 || connector . getVersion ( ) == Connector . Version . V_17 ) return true ; return false ; }
Is a 1 . 6 + deployment
14,958
@ SuppressWarnings ( "unchecked" ) private void verifyBeanValidation ( Deployment deployment ) throws DeployException { if ( beanValidation != null ) { ValidatorFactory vf = null ; try { vf = beanValidation . getValidatorFactory ( ) ; javax . validation . Validator v = vf . getValidator ( ) ; Collection < String > l = ...
Verify deployment against bean validation
14,959
private void loadNativeLibraries ( File root ) { if ( root != null && root . exists ( ) ) { List < String > libs = new ArrayList < String > ( ) ; if ( root . isDirectory ( ) ) { if ( root . listFiles ( ) != null ) { for ( File f : root . listFiles ( ) ) { if ( f . isFile ( ) ) { String fileName = f . getName ( ) . toLo...
Load native libraries
14,960
protected boolean hasFailuresLevel ( Collection < Failure > failures , int severity ) { if ( failures != null ) { for ( Failure failure : failures ) { if ( failure . getSeverity ( ) == severity ) { return true ; } } } return false ; }
Check for failures at a certain level
14,961
public String printFailuresLog ( Validator validator , Collection < Failure > failures , FailureHelper ... fhInput ) { String errorText = "" ; FailureHelper fh = null ; if ( fhInput . length == 0 ) fh = new FailureHelper ( failures ) ; else fh = fhInput [ 0 ] ; if ( failures != null && failures . size ( ) > 0 ) { error...
print Failures into Log files .
14,962
private void resetXAResourceTimeout ( ) { if ( ! ( xaResource instanceof LocalXAResource ) && xaResourceTimeout > 0 ) { try { xaResource . setTransactionTimeout ( xaResourceTimeout ) ; } catch ( XAException e ) { log . debugf ( e , "Exception during resetXAResourceTimeout for %s" , this ) ; } } }
Reset XAResource timeout
14,963
public void process ( Map < String , String > varMap , Writer out ) { try { if ( templateText == null ) { templateText = Utils . readFileIntoString ( input ) ; } String replacedString = replace ( varMap ) ; out . write ( replacedString ) ; out . flush ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Processes the template
14,964
public String replace ( Map < String , String > varMap ) { StringBuilder newString = new StringBuilder ( ) ; int p = 0 ; int p0 = 0 ; while ( true ) { p = templateText . indexOf ( "${" , p ) ; if ( p == - 1 ) { newString . append ( templateText . substring ( p0 , templateText . length ( ) ) ) ; break ; } else { newStri...
Replace string in the template text
14,965
public Collection < ConnectionFactory > getConnectionFactories ( ) { if ( connectionFactories == null ) return Collections . emptyList ( ) ; return Collections . unmodifiableCollection ( connectionFactories ) ; }
Get connection factories
14,966
public DeploymentBuilder connectionFactory ( ConnectionFactory v ) { if ( connectionFactories == null ) connectionFactories = new ArrayList < ConnectionFactory > ( ) ; connectionFactories . add ( v ) ; return this ; }
Add connection factory
14,967
public Collection < AdminObject > getAdminObjects ( ) { if ( adminObjects == null ) return Collections . emptyList ( ) ; return Collections . unmodifiableCollection ( adminObjects ) ; }
Get admin objects
14,968
public DeploymentBuilder adminObject ( AdminObject v ) { if ( adminObjects == null ) adminObjects = new ArrayList < AdminObject > ( ) ; adminObjects . add ( v ) ; return this ; }
Add admin object
14,969
protected Boolean attributeAsBoolean ( XMLStreamReader reader , String attributeName , Boolean defaultValue , Map < String , String > expressions ) throws XMLStreamException , ParserException { String attributeString = rawAttributeText ( reader , attributeName ) ; if ( attributeName != null && expressions != null && at...
convert an xml attribute in boolean value . Empty elements results in default value
14,970
private String rawAttributeText ( XMLStreamReader reader , String attributeName ) { String attributeString = reader . getAttributeValue ( "" , attributeName ) ; if ( attributeString == null ) return null ; return attributeString . trim ( ) ; }
Read the raw attribute
14,971
protected Integer elementAsInteger ( XMLStreamReader reader , String key , Map < String , String > expressions ) throws XMLStreamException , ParserException { Integer integerValue = null ; String elementtext = rawElementText ( reader ) ; if ( key != null && expressions != null && elementtext != null && elementtext . in...
convert an xml element in Integer value
14,972
protected Long elementAsLong ( XMLStreamReader reader , String key , Map < String , String > expressions ) throws XMLStreamException , ParserException { Long longValue = null ; String elementtext = rawElementText ( reader ) ; if ( key != null && expressions != null && elementtext != null && elementtext . indexOf ( "${"...
convert an xml element in Long value
14,973
protected FlushStrategy elementAsFlushStrategy ( XMLStreamReader reader , Map < String , String > expressions ) throws XMLStreamException , ParserException { String elementtext = rawElementText ( reader ) ; if ( expressions != null && elementtext != null && elementtext . indexOf ( "${" ) != - 1 ) expressions . put ( Co...
convert an xml element in FlushStrategy value
14,974
protected Capacity parseCapacity ( XMLStreamReader reader ) throws XMLStreamException , ParserException , ValidateException { Extension incrementer = null ; Extension decrementer = null ; while ( reader . hasNext ( ) ) { switch ( reader . nextTag ( ) ) { case END_ELEMENT : { switch ( reader . getLocalName ( ) ) { case ...
Parse capacity tag
14,975
public static List < TraceEvent > filterPoolEvents ( List < TraceEvent > data ) throws Exception { List < TraceEvent > result = new ArrayList < TraceEvent > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_GET || te . getType ( ) == TraceEvent . CREATE_CONNECTION_LIS...
Filter the pool events
14,976
public static Map < String , List < TraceEvent > > filterLifecycleEvents ( List < TraceEvent > data ) throws Exception { Map < String , List < TraceEvent > > result = new TreeMap < String , List < TraceEvent > > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_GET ||...
Filter the lifecycle events
14,977
public static List < TraceEvent > filterCCMEvents ( List < TraceEvent > data ) throws Exception { List < TraceEvent > result = new ArrayList < TraceEvent > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . PUSH_CCM_CONTEXT || te . getType ( ) == TraceEvent . POP_CCM_CONTEXT ) { result . add ( t...
Filter the CCM events
14,978
public static Map < String , List < TraceEvent > > filterCCMPoolEvents ( List < TraceEvent > data ) throws Exception { Map < String , List < TraceEvent > > result = new TreeMap < String , List < TraceEvent > > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . REGISTER_CCM_CONNECTION || te . get...
Filter the CCM pool events
14,979
public static Map < String , Set < String > > poolManagedConnectionPools ( List < TraceEvent > data ) throws Exception { Map < String , Set < String > > result = new TreeMap < String , Set < String > > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER || te . getType ( )...
Pool to Managed Connection Pools mapping
14,980
public static List < TraceEvent > getEvents ( FileReader fr , File directory ) throws Exception { return getEvents ( getData ( fr , directory ) ) ; }
Get the events
14,981
public static boolean isStartState ( TraceEvent te ) { if ( te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER_NEW || te . getType ( ) == TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . GET_INTERLEAVING_CONNECTION_LI...
Is start state
14,982
public static boolean isEndState ( TraceEvent te ) { if ( te . getType ( ) == TraceEvent . RETURN_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . RETURN_CONNECTION_LISTENER_WITH_KILL || te . getType ( ) == TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . RETURN_INTERLEAVI...
Is end state
14,983
public static Map < String , List < Interaction > > getConnectionListenerData ( List < Interaction > data ) { Map < String , List < Interaction > > result = new TreeMap < String , List < Interaction > > ( ) ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { Interaction interaction = data . get ( i ) ; List < Interactio...
Get a connection listener map
14,984
public static boolean hasException ( List < TraceEvent > events ) { for ( TraceEvent te : events ) { if ( te . getType ( ) == TraceEvent . EXCEPTION ) return true ; } return false ; }
Has an exception event
14,985
public static String exceptionDescription ( String encoded ) { char [ ] data = encoded . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { char c = data [ i ] ; if ( c == '|' ) { sb = sb . append ( '\n' ) ; } else if ( c == '/' ) { sb = sb . append ( '\r' ) ; } ...
Get exception description
14,986
public static String prettyPrint ( TraceEvent te ) { if ( te . getType ( ) != TraceEvent . GET_CONNECTION_LISTENER && te . getType ( ) != TraceEvent . GET_CONNECTION_LISTENER_NEW && te . getType ( ) != TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER && te . getType ( ) != TraceEvent . GET_INTERLEAVING_CONNECTION_LIST...
Pretty print event
14,987
public static TraceEvent getVersion ( List < TraceEvent > events ) { for ( TraceEvent te : events ) { if ( te . getType ( ) == TraceEvent . VERSION ) return te ; } return null ; }
Get the version
14,988
static boolean hasMoreApplicationEvents ( List < TraceEvent > events , int index ) { if ( index < 0 || index >= events . size ( ) ) return false ; for ( int j = index ; j < events . size ( ) ; j ++ ) { TraceEvent te = events . get ( j ) ; if ( te . getType ( ) == TraceEvent . GET_CONNECTION || te . getType ( ) == Trace...
Has more application events
14,989
private Collection < FrameworkMethod > filterAndSort ( List < FrameworkMethod > fms , boolean isStatic ) throws Exception { SortedMap < Integer , FrameworkMethod > m = new TreeMap < > ( ) ; for ( FrameworkMethod fm : fms ) { SecurityActions . setAccessible ( fm . getMethod ( ) ) ; if ( Modifier . isStatic ( fm . getMet...
Filter and sort
14,990
private Object [ ] getParameters ( FrameworkMethod fm ) { Method m = fm . getMethod ( ) ; SecurityActions . setAccessible ( m ) ; Class < ? > [ ] parameters = m . getParameterTypes ( ) ; Annotation [ ] [ ] parameterAnnotations = m . getParameterAnnotations ( ) ; Object [ ] result = new Object [ parameters . length ] ; ...
Get parameter values for a method
14,991
private Object resolveBean ( String name , Class < ? > type ) { try { return embedded . lookup ( name , type ) ; } catch ( Throwable t ) { return null ; } }
Resolve a bean
14,992
static void setAccessible ( final Method m , final boolean value ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { m . setAccessible ( value ) ; return null ; } } ) ; }
Invoke setAccessible on a method
14,993
private void writeVars ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/** JNDI name */\n" ) ; writeWithIndent ( out , indent , "private static final String JNDI_NAME = \"java:/eis/" + def . getDefaultValue ( ) + "\";\n\n" ) ; writeWithIndent ( out , indent , "/** MBe...
Output class vars
14,994
private void writeMethods ( Definition def , Writer out , int indent ) throws IOException { if ( def . getMcfDefs ( ) . get ( 0 ) . isDefineMethodInConnection ( ) ) { if ( def . getMcfDefs ( ) . get ( 0 ) . getMethods ( ) . size ( ) > 0 ) { for ( MethodForConnection method : def . getMcfDefs ( ) . get ( 0 ) . getMethod...
Output defined methods
14,995
private void writeGetConnection ( Definition def , Writer out , int indent ) throws IOException { String connInterface = def . getMcfDefs ( ) . get ( 0 ) . getConnInterfaceClass ( ) ; String cfInterface = def . getMcfDefs ( ) . get ( 0 ) . getCfInterfaceClass ( ) ; writeWithIndent ( out , indent , "/**\n" ) ; writeWith...
Output getConnection method
14,996
public Timer createTimer ( ) { Timer t = new Timer ( true ) ; if ( timers == null ) timers = new ArrayList < Timer > ( ) ; timers . add ( t ) ; return t ; }
Create a timer
14,997
public boolean isContextSupported ( Class < ? extends WorkContext > workContextClass ) { if ( workContextClass == null ) return false ; return supportedContexts . contains ( workContextClass ) ; }
Is the work context supported ?
14,998
void writeConfigPropsXml ( List < ConfigPropType > props , Writer out , int indent ) throws IOException { if ( props == null || props . size ( ) == 0 ) return ; for ( ConfigPropType prop : props ) { writeIndent ( out , indent ) ; out . write ( "<config-property>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 1 ) ...
Output config props xml part
14,999
void writeRequireConfigPropsXml ( List < ConfigPropType > props , Writer out , int indent ) throws IOException { if ( props == null || props . size ( ) == 0 ) return ; for ( ConfigPropType prop : props ) { if ( prop . isRequired ( ) ) { writeIndent ( out , indent ) ; out . write ( "<required-config-property>" ) ; write...
Output required config props xml part