idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
14,800 | public static synchronized void unknownCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . UNKNOWN_CCM_CONNECTION , Integer . toHexString ( System . iden... | Unknown CCM connection | 113 | 4 |
14,801 | public static synchronized void closeCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CLOSE_CCM_CONNECTION , Integer . toHexString ( System . identity... | Close CCM connection | 113 | 4 |
14,802 | public static synchronized void ccmUserTransaction ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CCM_USER_TRANSACTION , Integer . toHexString ( System . identity... | CCM user transaction | 112 | 4 |
14,803 | public < T > T lookup ( String name , Class < T > expectedType ) throws Throwable { if ( name == null ) throw new IllegalArgumentException ( "Name is null" ) ; if ( expectedType == null ) throw new IllegalArgumentException ( "ExpectedType is null" ) ; if ( ! started ) throw new IllegalStateException ( "Container not st... | Lookup a bean | 96 | 4 |
14,804 | private void removeDeployment ( File deployment ) throws IOException { if ( deployment == null ) throw new IllegalArgumentException ( "Deployment is null" ) ; if ( deployment . exists ( ) || ( shrinkwrapDeployments != null && shrinkwrapDeployments . contains ( deployment ) ) ) { shrinkwrapDeployments . remove ( deploym... | Remove ShrinkWrap deployment | 99 | 7 |
14,805 | public String getValue ( ) { return StringUtils . isEmptyTrimmed ( resolvedValue ) ? ( StringUtils . isEmptyTrimmed ( defaultValue ) ? "" : defaultValue ) : resolvedValue ; } | Resolves the expression | 47 | 4 |
14,806 | private Context currentContext ( ) { LinkedList < Context > stack = threadContexts . get ( ) ; if ( stack != null && ! stack . isEmpty ( ) ) { return stack . getLast ( ) ; } return null ; } | Look at the current context | 51 | 5 |
14,807 | private boolean closeAll ( Context context ) { boolean unclosed = false ; CloseConnectionSynchronization ccs = getCloseConnectionSynchronization ( true ) ; for ( org . ironjacamar . core . connectionmanager . ConnectionManager cm : context . getConnectionManagers ( ) ) { for ( org . ironjacamar . core . connectionmanag... | Close all connections for a context | 210 | 6 |
14,808 | private CloseConnectionSynchronization getCloseConnectionSynchronization ( boolean createIfNotFound ) { try { Transaction tx = null ; if ( transactionIntegration != null ) tx = transactionIntegration . getTransactionManager ( ) . getTransaction ( ) ; if ( tx != null && TxUtils . isActive ( tx ) ) { CloseConnectionSynch... | Get the CloseConnectionSynchronization instance | 238 | 8 |
14,809 | private void closeConnection ( Object connectionHandle ) { try { Throwable exception = null ; synchronized ( connectionStackTraces ) { exception = connectionStackTraces . remove ( connectionHandle ) ; } Method m = SecurityActions . getMethod ( connectionHandle . getClass ( ) , "close" , new Class [ ] { } ) ; try { if (... | Close connection handle | 171 | 3 |
14,810 | public static boolean isActive ( Transaction tx ) { if ( tx == null ) return false ; try { int status = tx . getStatus ( ) ; return status == Status . STATUS_ACTIVE ; } catch ( SystemException error ) { throw new RuntimeException ( "Error during isActive()" , error ) ; } } | Is the transaction active | 68 | 4 |
14,811 | public static boolean isUncommitted ( Transaction tx ) { if ( tx == null ) return false ; try { int status = tx . getStatus ( ) ; return status == Status . STATUS_ACTIVE || status == Status . STATUS_MARKED_ROLLBACK ; } catch ( SystemException error ) { throw new RuntimeException ( "Error during isUncommitted()" , error... | Is the transaction uncommitted | 87 | 5 |
14,812 | public static boolean isCompleted ( Transaction tx ) { if ( tx == null ) return true ; try { int status = tx . getStatus ( ) ; return status == Status . STATUS_COMMITTED || status == Status . STATUS_ROLLEDBACK || status == Status . STATUS_NO_TRANSACTION ; } catch ( SystemException error ) { throw new RuntimeException (... | Is the transaction completed | 95 | 4 |
14,813 | public static String getStatusAsString ( int status ) { if ( status >= Status . STATUS_ACTIVE && status <= Status . STATUS_ROLLING_BACK ) { return TX_STATUS_STRINGS [ status ] ; } else { return "STATUS_INVALID(" + status + ")" ; } } | Converts a transaction status to a text representation | 70 | 9 |
14,814 | public void store ( Activations metadata , XMLStreamWriter writer ) throws Exception { if ( metadata != null && writer != null ) { writer . writeStartElement ( XML . ELEMENT_RESOURCE_ADAPTERS ) ; for ( Activation a : metadata . getActivations ( ) ) { writer . writeStartElement ( XML . ELEMENT_RESOURCE_ADAPTER ) ; if ( ... | Store a - ra . xml file | 206 | 7 |
14,815 | public int compareTo ( Object o ) { MBeanData md = ( MBeanData ) o ; String d1 = objectName . getDomain ( ) ; String d2 = md . objectName . getDomain ( ) ; int compare = d1 . compareTo ( d2 ) ; if ( compare == 0 ) { String p1 = objectName . getCanonicalKeyPropertyListString ( ) ; String p2 = md . objectName . getCanoni... | Compares MBeanData based on the ObjectName domain name and canonical key properties | 124 | 17 |
14,816 | public static ConnectionManager createConnectionManager ( TransactionSupportEnum tse , ManagedConnectionFactory mcf , CachedConnectionManager ccm , ConnectionManagerConfiguration cmc , TransactionIntegration ti ) { if ( tse == TransactionSupportEnum . NoTransaction ) { return new NoTransactionConnectionManager ( mcf , ... | Create a connection manager | 133 | 4 |
14,817 | public static MBeanServer getMBeanServer ( String domain ) { try { ArrayList < MBeanServer > l = MBeanServerFactory . findMBeanServer ( null ) ; if ( l != null ) { for ( MBeanServer ms : l ) { String [ ] domains = ms . getDomains ( ) ; if ( domains != null ) { for ( String d : domains ) { if ( domain . equals ( d ) ) {... | Get the MBeanServer instance | 122 | 7 |
14,818 | public static MBeanData getMBeanData ( String name ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; MBeanInfo info = server . getMBeanInfo ( objName ) ; return new MBeanData ( objName , info ) ; } | Get MBean data | 77 | 5 |
14,819 | public static Object getMBeanAttributeObject ( String name , String attrName ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; return server . getAttribute ( objName , attrName ) ; } | Get MBean attribute object | 63 | 6 |
14,820 | public static String getMBeanAttribute ( String name , String attrName ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; String value = null ; try { Object attr = server . getAttribute ( objName , attrName ) ; if ( attr != null ) value = attr . toString ( ) ... | Get MBean attribute | 110 | 5 |
14,821 | public static AttrResultInfo getMBeanAttributeResultInfo ( String name , MBeanAttributeInfo attrInfo ) throws JMException { ClassLoader loader = SecurityActions . getThreadContextClassLoader ( ) ; MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; String attrName = attrInfo . getNa... | Get MBean attribute result info | 263 | 7 |
14,822 | public static AttributeList setAttributes ( String name , HashMap attributes ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; MBeanInfo info = server . getMBeanInfo ( objName ) ; MBeanAttributeInfo [ ] attributesInfo = info . getAttributes ( ) ; AttributeLi... | Set MBean attributes | 412 | 5 |
14,823 | public static OpResultInfo invokeOp ( String name , int index , String [ ] args ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; MBeanInfo info = server . getMBeanInfo ( objName ) ; MBeanOperationInfo [ ] opInfo = info . getOperations ( ) ; MBeanOperationIn... | Invoke an operation | 187 | 4 |
14,824 | public static OpResultInfo invokeOpByName ( String name , String opName , String [ ] argTypes , String [ ] args ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; int length = argTypes != null ? argTypes . length : 0 ; Object [ ] typedArgs = new Object [ leng... | Invoke an operation by name | 332 | 6 |
14,825 | @ Override public List < ConnectionDefinition > getConnectionDefinitions ( ) { if ( connectionDefinitions == null ) return null ; return Collections . unmodifiableList ( connectionDefinitions ) ; } | Get the connectionFactories . | 41 | 6 |
14,826 | @ Override public List < AdminObject > getAdminObjects ( ) { return adminObjects == null ? null : Collections . unmodifiableList ( adminObjects ) ; } | Get the adminObjects . | 38 | 6 |
14,827 | @ Override public Map < String , String > getConfigProperties ( ) { return configProperties == null ? null : Collections . unmodifiableMap ( configProperties ) ; } | Get the configProperties . | 39 | 6 |
14,828 | @ Override public List < String > getBeanValidationGroups ( ) { return beanValidationGroups == null ? null : Collections . unmodifiableList ( beanValidationGroups ) ; } | Get the beanValidationGroups . | 44 | 8 |
14,829 | public void addProvider ( UserTransactionProvider provider ) { UserTransactionProviderImpl impl = new UserTransactionProviderImpl ( provider ) ; delegator . addProvider ( impl ) ; providers . put ( provider , impl ) ; } | Add a provider | 45 | 3 |
14,830 | public void removeProvider ( UserTransactionProvider provider ) { UserTransactionProviderImpl impl = providers . get ( provider ) ; if ( impl != null ) { delegator . removeProvider ( impl ) ; providers . remove ( provider ) ; } } | Remove a provider | 49 | 3 |
14,831 | public void setDefaultGroups ( String [ ] value ) { if ( value != null ) { defaultGroups = Arrays . copyOf ( value , value . length ) ; } else { defaultGroups = null ; } } | Set the default groups | 48 | 4 |
14,832 | public static org . ironjacamar . core . connectionmanager . pool . Capacity create ( org . ironjacamar . common . api . metadata . common . Capacity metadata , ClassLoaderPlugin classLoaderPlugin ) { if ( metadata == null ) return DefaultCapacity . INSTANCE ; CapacityIncrementer incrementer = null ; CapacityDecremente... | Create a capacity instance based on the metadata | 592 | 8 |
14,833 | private static CapacityIncrementer loadIncrementer ( Extension incrementer , ClassLoaderPlugin classLoaderPlugin ) { Object result = loadExtension ( incrementer , classLoaderPlugin ) ; if ( result != null && result instanceof CapacityIncrementer ) { return ( CapacityIncrementer ) result ; } log . debugf ( "%s wasn't a ... | Load the incrementer | 93 | 4 |
14,834 | private static CapacityDecrementer loadDecrementer ( Extension decrementer , ClassLoaderPlugin classLoaderPlugin ) { Object result = loadExtension ( decrementer , classLoaderPlugin ) ; if ( result != null && result instanceof CapacityDecrementer ) { return ( CapacityDecrementer ) result ; } log . debugf ( "%s wasn't a ... | Load the decrementer | 96 | 5 |
14,835 | private static Object loadExtension ( Extension extension , ClassLoaderPlugin classLoaderPlugin ) { try { Class < ? > c = classLoaderPlugin . loadClass ( extension . getClassName ( ) , extension . getModuleName ( ) , extension . getModuleSlot ( ) ) ; return c . newInstance ( ) ; } catch ( Throwable t ) { log . tracef (... | Load the class | 116 | 3 |
14,836 | private void getPropsString ( StringBuilder strProps , List < ConfigPropType > propsList , int indent ) { for ( ConfigPropType props : propsList ) { for ( int i = 0 ; i < indent ; i ++ ) strProps . append ( " " ) ; strProps . append ( "<config-property name=\"" ) ; strProps . append ( props . getName ( ) ) ; strProps .... | generate properties String | 142 | 4 |
14,837 | public static TransactionIsolation forName ( String v ) { if ( v != null && ! v . trim ( ) . equals ( "" ) ) { if ( "TRANSACTION_READ_UNCOMMITTED" . equalsIgnoreCase ( v ) || "1" . equalsIgnoreCase ( v ) ) { return TRANSACTION_READ_UNCOMMITTED ; } else if ( "TRANSACTION_READ_COMMITTED" . equalsIgnoreCase ( v ) || "2" .... | Static method to get an instance | 270 | 6 |
14,838 | public boolean start ( String home , File options ) { File homeDirectory = new File ( home ) ; if ( ! homeDirectory . exists ( ) ) return false ; stop ( home ) ; try { List < String > command = new ArrayList < String > ( ) ; command . add ( java ) ; command . add ( "-Dironjacamar.home=" + home ) ; if ( options != null ... | Start an instance | 332 | 3 |
14,839 | public int stop ( String home ) { Process p = instances . get ( home ) ; if ( p != null ) { try { p . destroy ( ) ; return p . exitValue ( ) ; } catch ( Throwable t ) { return - 1 ; } finally { instances . remove ( home ) ; } } return 0 ; } | Stop an instance | 69 | 3 |
14,840 | public void registerBootstrapContext ( CloneableBootstrapContext bc ) { if ( bc != null ) { if ( bc . getName ( ) == null || bc . getName ( ) . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The name of BootstrapContext is invalid: " + bc ) ; if ( ! bootstrapContexts . keySet ( ) . contains ( bc . get... | Register bootstrap context | 115 | 4 |
14,841 | public void unregisterBootstrapContext ( CloneableBootstrapContext bc ) { if ( bc != null ) { if ( bc . getName ( ) == null || bc . getName ( ) . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The name of BootstrapContext is invalid: " + bc ) ; if ( bootstrapContexts . keySet ( ) . contains ( bc . get... | Unregister boostrap context | 113 | 5 |
14,842 | public void setDefaultBootstrapContext ( CloneableBootstrapContext bc ) { if ( trace ) log . tracef ( "Default BootstrapContext: %s" , bc ) ; String currentName = null ; if ( defaultBootstrapContext != null ) currentName = defaultBootstrapContext . getName ( ) ; defaultBootstrapContext = bc ; if ( bc != null ) { bootst... | Set the default bootstrap context | 120 | 6 |
14,843 | public synchronized CloneableBootstrapContext createBootstrapContext ( String id , String name ) { if ( id == null || id . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The id of BootstrapContext is invalid: " + id ) ; // Check for an active BC if ( activeBootstrapContexts . keySet ( ) . contains ( i... | Get a bootstrap context | 373 | 5 |
14,844 | public synchronized void removeBootstrapContext ( String id ) { if ( id == null || id . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The id of BootstrapContext is invalid: " + id ) ; Integer i = refCountBootstrapContexts . get ( id ) ; if ( i != null ) { int newValue = i . intValue ( ) - 1 ; if ( ne... | Remove a bootstrap context | 172 | 5 |
14,845 | public static Janitor createJanitor ( String type ) { if ( type == null || type . equals ( "" ) ) return new MinimalJanitor ( ) ; type = type . toLowerCase ( Locale . US ) ; switch ( type ) { case "minimal" : return new MinimalJanitor ( ) ; case "full" : return new FullJanitor ( ) ; default : { return new MinimalJanito... | Create a janitor | 96 | 4 |
14,846 | static Properties getSystemProperties ( ) { return ( Properties ) AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { return System . getProperties ( ) ; } } ) ; } | Get the system properties | 50 | 4 |
14,847 | static URLClassLoader createURLCLassLoader ( final URL [ ] urls , final ClassLoader parent ) { return ( URLClassLoader ) AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { return new URLClassLoader ( urls , parent ) ; } } ) ; } | Create an URLClassLoader | 69 | 5 |
14,848 | private static String readStreamIntoString ( Reader reader ) throws IOException { StringBuilder s = new StringBuilder ( ) ; char a [ ] = new char [ 0x10000 ] ; while ( true ) { int l = reader . read ( a ) ; if ( l == - 1 ) break ; if ( l <= 0 ) throw new IOException ( ) ; s . append ( a , 0 , l ) ; } return s . toStrin... | Reads the contents of a stream into a string variable . | 97 | 12 |
14,849 | public static FileWriter createSrcFile ( String name , String packageName , String outDir ) throws IOException { String directory = "src" + File . separatorChar + "main" + File . separatorChar + "java" ; return createPackageFile ( name , packageName , directory , outDir ) ; } | Create source file | 68 | 3 |
14,850 | private static FileWriter createPackageFile ( String name , String packageName , String directory , String outDir ) throws IOException { if ( packageName != null && ! packageName . trim ( ) . equals ( "" ) ) { directory = directory + File . separatorChar + packageName . replace ( ' ' , File . separatorChar ) ; } File p... | Create file in the package | 190 | 5 |
14,851 | public Set < Address > getAddresses ( T physicalAddress ) { Set < Address > result = new HashSet < Address > ( ) ; for ( Entry < Address , T > entry : nodes . entrySet ( ) ) { if ( entry . getValue ( ) == null || entry . getValue ( ) . equals ( physicalAddress ) ) { result . add ( entry . getKey ( ) ) ; } } if ( trace ... | Get the addresses | 118 | 3 |
14,852 | public void localDeltaDoWorkAccepted ( Address address ) { if ( trace ) log . tracef ( "LOCAL_DELTA_DOWORK_ACCEPTED(%s)" , address ) ; DistributedWorkManager dwm = workManagerCoordinator . resolveDistributedWorkManager ( address ) ; if ( dwm != null ) { Collection < NotificationListener > copy = new ArrayList < Notific... | Local delta doWork accepted | 126 | 5 |
14,853 | private void done ( ) { if ( longThreadPool != null && isLong ) { transport . updateLongRunningFree ( address , longThreadPool . getNumberOfFreeThreads ( ) + 1 ) ; } else { transport . updateShortRunningFree ( address , shortThreadPool . getNumberOfFreeThreads ( ) + 1 ) ; } } | Send the done signal to other nodes We are adding 1 to the result since the thread officially has been released yet but will be shortly | 73 | 26 |
14,854 | private Subject getSubject ( ) { return AccessController . doPrivileged ( new PrivilegedAction < Subject > ( ) { /** * run method */ public Subject run ( ) { try { String domain = recoverSecurityDomain ; if ( domain != null && subjectFactory != null ) { Subject subject = SecurityActions . createSubject ( subjectFactory... | This method provide the Subject used for the XA Resource Recovery integration with the XAResourceRecoveryRegistry . | 214 | 24 |
14,855 | @ SuppressWarnings ( "unchecked" ) private ManagedConnection open ( Subject s ) throws ResourceException { log . debugf ( "Open managed connection (%s)" , s ) ; if ( recoverMC == null ) recoverMC = mcf . createManagedConnection ( s , null ) ; if ( plugin == null ) { try { ValidatingManagedConnectionFactory vmcf = ( Val... | Open a managed connection | 236 | 4 |
14,856 | private void close ( ManagedConnection mc ) { log . debugf ( "Closing managed connection for recovery (%s)" , mc ) ; if ( mc != null ) { try { mc . cleanup ( ) ; } catch ( ResourceException ire ) { log . debugf ( "Error during recovery cleanup" , ire ) ; } } if ( mc != null ) { try { mc . destroy ( ) ; } catch ( Resour... | Close a managed connection | 124 | 4 |
14,857 | private Object openConnection ( ManagedConnection mc , Subject s ) throws ResourceException { if ( plugin == null ) return null ; log . debugf ( "Open connection (%s, %s)" , mc , s ) ; return mc . getConnection ( s , null ) ; } | Open a connection | 58 | 3 |
14,858 | private boolean closeConnection ( Object c ) { if ( plugin == null ) return false ; log . debugf ( "Closing connection for recovery check (%s)" , c ) ; boolean forceClose = false ; if ( c != null ) { try { forceClose = ! plugin . isValid ( c ) ; } catch ( ResourceException re ) { log . debugf ( "Error during recovery p... | Close a connection | 159 | 3 |
14,859 | protected boolean isCommandAvailable ( String command ) throws Throwable { Socket socket = null ; try { socket = new Socket ( host , port ) ; ObjectOutputStream output = new ObjectOutputStream ( socket . getOutputStream ( ) ) ; output . writeUTF ( "getcommand" ) ; output . writeInt ( 1 ) ; output . writeUTF ( command )... | Is a command available | 170 | 4 |
14,860 | void registerConnection ( ConnectionManager cm , ConnectionListener cl , Object c ) { if ( cmToCl == null ) cmToCl = new HashMap < ConnectionManager , List < ConnectionListener > > ( ) ; List < ConnectionListener > l = cmToCl . get ( cm ) ; if ( l == null ) l = new ArrayList < ConnectionListener > ( 1 ) ; l . add ( cl ... | Register a connection | 176 | 3 |
14,861 | boolean unregisterConnection ( ConnectionManager cm , ConnectionListener cl , Object c ) { if ( clToC != null && clToC . get ( cl ) != null ) { List < Object > l = clToC . get ( cl ) ; return l . remove ( c ) ; } return false ; } | Unregister a connection | 66 | 4 |
14,862 | Set < ConnectionManager > getConnectionManagers ( ) { if ( cmToCl == null ) return Collections . unmodifiableSet ( Collections . emptySet ( ) ) ; return Collections . unmodifiableSet ( cmToCl . keySet ( ) ) ; } | Get the connection managers | 55 | 4 |
14,863 | List < ConnectionListener > getConnectionListeners ( ConnectionManager cm ) { if ( cmToCl == null ) return Collections . unmodifiableList ( Collections . emptyList ( ) ) ; List < ConnectionListener > l = cmToCl . get ( cm ) ; if ( l == null ) l = Collections . emptyList ( ) ; return Collections . unmodifiableList ( l )... | Get the connection listeners for a connection manager | 82 | 8 |
14,864 | List < Object > getConnections ( ConnectionListener cl ) { List < Object > l = null ; if ( clToC != null ) l = clToC . get ( cl ) ; if ( l == null ) l = Collections . emptyList ( ) ; return Collections . unmodifiableList ( l ) ; } | Get the connections for a connection listener | 67 | 7 |
14,865 | void switchConnectionListener ( Object c , ConnectionListener from , ConnectionListener to ) { if ( clToC != null && clToC . get ( from ) != null && clToC . get ( to ) != null ) { clToC . get ( from ) . remove ( c ) ; clToC . get ( to ) . add ( c ) ; } } | Switch the connection listener for a connection | 78 | 7 |
14,866 | void removeConnectionListener ( ConnectionManager cm , ConnectionListener cl ) { if ( cmToCl != null && cmToCl . get ( cm ) != null ) { cmToCl . get ( cm ) . remove ( cl ) ; clToC . remove ( cl ) ; } } | Remove a connection listener | 59 | 4 |
14,867 | public synchronized void forceConfigProperties ( List < ConfigProperty > newContents ) { if ( newContents != null ) { this . configProperties = new ArrayList < ConfigProperty > ( newContents ) ; } else { this . configProperties = new ArrayList < ConfigProperty > ( 0 ) ; } } | Force configProperties with new content . This method is thread safe | 65 | 13 |
14,868 | public String getMessage ( ) { String msg = super . getMessage ( ) ; String ec = getErrorCode ( ) ; if ( ( msg == null ) && ( ec == null ) ) { return null ; } if ( ( msg != null ) && ( ec != null ) ) { return ( msg + ", error code: " + ec ) ; } return ( ( msg != null ) ? msg : ( "error code: " + ec ) ) ; } | Returns a detailed message string describing this exception . | 96 | 9 |
14,869 | void writeClassComment ( Definition def , Writer out ) throws IOException { out . write ( "/**\n" ) ; out . write ( " * " + getClassName ( def ) ) ; writeEol ( out ) ; out . write ( " *\n" ) ; out . write ( " * @version $Revision: $\n" ) ; out . write ( " */\n" ) ; } | Output class comment | 89 | 3 |
14,870 | protected void writeSimpleMethodSignature ( Writer out , int indent , String javadoc , String signature ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeIndent ( out , indent ) ; out . write ( javadoc ) ; writeEol ( out ) ; writeWithIndent ( out , indent , " */\n" ) ; writeIndent ( out , indent ... | write a simple method signature | 102 | 5 |
14,871 | protected void writeMethodSignature ( Writer out , int indent , MethodForConnection method ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * " + method . getMethodName ( ) ) ; writeEol ( out ) ; for ( MethodParam param : method . getParams ( ) ) { writeIndent ( out... | Write method signature for given | 480 | 5 |
14,872 | void writeLeftCurlyBracket ( Writer out , int indent ) throws IOException { writeEol ( out ) ; writeWithIndent ( out , indent , "{\n" ) ; } | Output left curly bracket | 41 | 4 |
14,873 | void writeRightCurlyBracket ( Writer out , int indent ) throws IOException { writeEol ( out ) ; writeWithIndent ( out , indent , "}\n" ) ; } | Output right curly bracket | 41 | 4 |
14,874 | void writeDefaultConstructor ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * Default constructor\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; //constructor writeWithIndent ( out , indent , "public " + getClassName... | Output Default Constructor | 129 | 4 |
14,875 | 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 | 73 | 4 |
14,876 | public int getInitialSize ( ) { if ( initialSize == null ) return getMinSize ( ) ; if ( initialSize . intValue ( ) > maxSize ) return maxSize ; return initialSize . intValue ( ) ; } | Get initial - pool - size | 49 | 6 |
14,877 | private String dumpQueuedThread ( Thread t ) { StringBuilder sb = new StringBuilder ( ) ; // Header sb = sb . append ( "Queued thread: " ) ; sb = sb . append ( t . getName ( ) ) ; sb = sb . append ( newLine ) ; // Body StackTraceElement [ ] stes = SecurityActions . getStackTrace ( t ) ; if ( stes != null ) { for ( Stac... | Dump a thread | 222 | 4 |
14,878 | 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 | 109 | 3 |
14,879 | 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 | 354 | 5 |
14,880 | 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 | 94 | 4 |
14,881 | 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 | 123 | 4 |
14,882 | 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 | 96 | 4 |
14,883 | 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 | 72 | 3 |
14,884 | private synchronized void removeDistributedStatistics ( ) { if ( distributedStatistics != null ) { listeners . remove ( ( NotificationListener ) distributedStatistics ) ; distributedStatistics . setTransport ( null ) ; distributedStatistics = null ; } } | Remove distributed statistics | 47 | 3 |
14,885 | Address getLocalAddress ( ) { if ( localAddress == null ) localAddress = new Address ( getId ( ) , getName ( ) , transport != null ? transport . getId ( ) : null ) ; return localAddress ; } | Get local address | 49 | 3 |
14,886 | 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 | 108 | 8 |
14,887 | 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 | 108 | 8 |
14,888 | 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 | 110 | 7 |
14,889 | void addWorkWrapper ( WorkWrapper ww ) { synchronized ( activeWorkWrappers ) { activeWorkWrappers . add ( ww ) ; if ( statisticsEnabled ) statistics . setWorkActive ( activeWorkWrappers . size ( ) ) ; } } | Add work wrapper to active set | 55 | 6 |
14,890 | void removeWorkWrapper ( WorkWrapper ww ) { synchronized ( activeWorkWrappers ) { activeWorkWrappers . remove ( ww ) ; if ( statisticsEnabled ) statistics . setWorkActive ( activeWorkWrappers . size ( ) ) ; } } | Remove work wrapper from active set | 55 | 6 |
14,891 | private BlockingExecutor getExecutor ( Work work ) { BlockingExecutor executor = shortRunningExecutor ; if ( longRunningExecutor != null && WorkManagerUtil . isLongRunning ( work ) ) { executor = longRunningExecutor ; } fireHintsComplete ( work ) ; return executor ; } | Get the executor | 69 | 4 |
14,892 | 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 | 179 | 6 |
14,893 | private void checkAndVerifyWork ( Work work , ExecutionContext executionContext ) throws WorkException { if ( specCompliant ) { verifyWork ( work ) ; } if ( work instanceof WorkContextProvider && executionContext != null ) { //Implements WorkContextProvider and not-null ExecutionContext throw new WorkRejectedException ... | Check and verify work before submitting . | 89 | 7 |
14,894 | 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 . | 140 | 7 |
14,895 | 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 ) { //Neve... | Checks if Work implementation class method is synchronized | 95 | 9 |
14,896 | 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 . | 84 | 6 |
14,897 | 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 . | 160 | 8 |
14,898 | @ SuppressWarnings ( "unchecked" ) private < T extends WorkContext > Class < T > getSupportedWorkContextClass ( Class < T > adaptorWorkContext ) { for ( Class < ? extends WorkContext > supportedWorkContext : SUPPORTED_WORK_CONTEXT_CLASSES ) { // Assignable or not if ( supportedWorkContext . isAssignableFrom ( adaptorWo... | Returns work context class if given work context is supported by server returns null instance otherwise . | 148 | 17 |
14,899 | 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 . | 69 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.