idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
14,800 | void generateRaXml ( Definition def , String outputDir ) { if ( ! def . isUseAnnotation ( ) ) { try { outputDir = outputDir + File . separatorChar + "src" + File . separatorChar + "main" + File . separatorChar + "resources" ; FileWriter rafw = Utils . createFile ( "ra.xml" , outputDir + File . separatorChar + "META-INF" ) ; RaXmlGen raGen = getRaXmlGen ( def ) ; raGen . generate ( def , rafw ) ; rafw . close ( ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } } } | generate ra . xml |
14,801 | void generateIronjacamarXml ( Definition def , String outputDir ) { try { String resourceDir = outputDir + File . separatorChar + "src" + File . separatorChar + "main" + File . separatorChar + "resources" ; writeIronjacamarXml ( def , resourceDir ) ; if ( def . getBuild ( ) . equals ( "maven" ) ) { String rarDir = outputDir + File . separatorChar + "src" + File . separatorChar + "main" + File . separatorChar + "rar" ; writeIronjacamarXml ( def , rarDir ) ; } } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } } | generate ant ironjacamar . xml |
14,802 | void generateMbeanXml ( Definition def , String outputDir ) { String mbeanName = def . getDefaultValue ( ) . toLowerCase ( Locale . US ) ; if ( def . getRaPackage ( ) != null && ! def . getRaPackage ( ) . equals ( "" ) ) { if ( def . getRaPackage ( ) . indexOf ( '.' ) >= 0 ) { mbeanName = def . getRaPackage ( ) . substring ( def . getRaPackage ( ) . lastIndexOf ( '.' ) + 1 ) ; } else mbeanName = def . getRaPackage ( ) ; } try { outputDir = outputDir + File . separatorChar + "src" + File . separatorChar + "main" + File . separatorChar + "resources" + File . separatorChar + "jca" ; FileWriter mbfw = Utils . createFile ( mbeanName + ".xml" , outputDir ) ; MbeanXmlGen mbGen = new MbeanXmlGen ( ) ; mbGen . generate ( def , mbfw ) ; mbfw . close ( ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } } | generate mbean deployment xml |
14,803 | void generatePackageInfo ( Definition def , String outputDir , String subDir ) { try { FileWriter fw ; PackageInfoGen phGen ; if ( outputDir . equals ( "test" ) ) { fw = Utils . createTestFile ( "package-info.java" , def . getRaPackage ( ) , def . getOutputDir ( ) ) ; phGen = new PackageInfoGen ( ) ; } else { if ( subDir == null ) { fw = Utils . createSrcFile ( "package-info.java" , def . getRaPackage ( ) , def . getOutputDir ( ) ) ; phGen = new PackageInfoGen ( ) ; } else { fw = Utils . createSrcFile ( "package-info.java" , def . getRaPackage ( ) + "." + subDir , def . getOutputDir ( ) ) ; phGen = new PackageInfoGen ( subDir ) ; } } phGen . generate ( def , fw ) ; fw . close ( ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } } | generate package . html |
14,804 | void generateEisCode ( Definition def ) { try { String clazzName = this . getClass ( ) . getPackage ( ) . getName ( ) + ".code.TestEisCodeGen" ; String javaFile = def . getDefaultValue ( ) + "Handler.java" ; FileWriter fw = Utils . createTestFile ( javaFile , def . getRaPackage ( ) , def . getOutputDir ( ) ) ; Class < ? > clazz = Class . forName ( clazzName , true , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; AbstractCodeGen codeGen = ( AbstractCodeGen ) clazz . newInstance ( ) ; codeGen . generate ( def , fw ) ; fw . flush ( ) ; fw . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } | generate Eis test server |
14,805 | static void setThreadContextClassLoader ( final ClassLoader cl ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; return null ; } } ) ; } | Set the thread context class loader |
14,806 | static void closeURLClassLoader ( final URLClassLoader cl ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { if ( cl != null ) { try { cl . close ( ) ; } catch ( IOException ioe ) { } } return null ; } } ) ; } | Close an URLClassLoader |
14,807 | private static void outputRaDesc ( RaImpl raImpl , PrintStream out ) throws ParserConfigurationException , SAXException , IOException , TransformerFactoryConfigurationError , TransformerConfigurationException , TransformerException { String raString = "<resource-adapters>" + raImpl . toString ( ) + "</resource-adapters>" ; DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder db = dbf . newDocumentBuilder ( ) ; Document doc = db . parse ( new InputSource ( new StringReader ( raString ) ) ) ; out . println ( ) ; out . println ( "Deployment descriptor:" ) ; out . println ( "----------------------" ) ; TransformerFactory tfactory = TransformerFactory . newInstance ( ) ; Transformer serializer ; serializer = tfactory . newTransformer ( ) ; serializer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; serializer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , "2" ) ; serializer . transform ( new DOMSource ( doc ) , new StreamResult ( out ) ) ; } | Output Resource Adapter XML description |
14,808 | private static boolean scanArchive ( Connector cmd ) { if ( cmd == null ) return true ; if ( cmd . getVersion ( ) == Version . V_16 || cmd . getVersion ( ) == Version . V_17 ) { if ( ! cmd . isMetadataComplete ( ) ) return true ; } return false ; } | Should the archive be scanned for annotations |
14,809 | private static Map < String , String > getIntrospectedProperties ( String clz , URLClassLoader cl , PrintStream error ) { Map < String , String > result = null ; try { Class < ? > c = Class . forName ( clz , true , cl ) ; result = new TreeMap < String , String > ( ) ; Method [ ] methods = c . getMethods ( ) ; for ( Method m : methods ) { if ( m . getName ( ) . startsWith ( "set" ) && m . getParameterTypes ( ) . length == 1 && isValidType ( m . getParameterTypes ( ) [ 0 ] ) ) { String name = m . getName ( ) . substring ( 3 ) ; if ( name . length ( ) == 1 ) { name = name . toLowerCase ( Locale . US ) ; } else { name = name . substring ( 0 , 1 ) . toLowerCase ( Locale . US ) + name . substring ( 1 ) ; } String type = m . getParameterTypes ( ) [ 0 ] . getName ( ) ; result . put ( name , type ) ; } } } catch ( Throwable t ) { t . printStackTrace ( error ) ; } return result ; } | Get the introspected properties for a class |
14,810 | private static void removeIntrospectedValue ( Map < String , String > m , String name ) { if ( m != null ) { m . remove ( name ) ; if ( name . length ( ) == 1 ) { name = name . toUpperCase ( Locale . US ) ; } else { name = name . substring ( 0 , 1 ) . toUpperCase ( Locale . US ) + name . substring ( 1 ) ; } m . remove ( name ) ; if ( name . length ( ) == 1 ) { name = name . toLowerCase ( Locale . US ) ; } else { name = name . substring ( 0 , 1 ) . toLowerCase ( Locale . US ) + name . substring ( 1 ) ; } m . remove ( name ) ; } } | Remove introspected value |
14,811 | private static String getValueString ( XsdString value ) { if ( value == null || value == XsdString . NULL_XSDSTRING ) return "" ; else return value . getValue ( ) ; } | get correct value string |
14,812 | public static synchronized void getConnectionListener ( String poolName , Object mcp , Object cl , boolean pooled , boolean interleaving , Throwable callstack ) { if ( ! interleaving ) { if ( pooled ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . GET_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . GET_CONNECTION_LISTENER_NEW , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } } else { if ( pooled ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER_NEW , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } } } | Get connection listener |
14,813 | public static synchronized void returnConnectionListener ( String poolName , Object mcp , Object cl , boolean kill , boolean interleaving , Throwable callstack ) { if ( ! interleaving ) { if ( ! kill ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . RETURN_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . RETURN_CONNECTION_LISTENER_WITH_KILL , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } } else { if ( ! kill ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } } } | Return connection listener |
14,814 | public static synchronized void clearConnectionListener ( String poolName , Object mcp , Object cl ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CLEAR_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) ) ) ; } | Clear connection listener |
14,815 | public static synchronized void enlistConnectionListener ( String poolName , Object mcp , Object cl , String tx , boolean success , boolean interleaving ) { if ( ! interleaving ) { if ( success ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . ENLIST_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . ENLIST_CONNECTION_LISTENER_FAILED , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } } else { if ( success ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . ENLIST_INTERLEAVING_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . ENLIST_INTERLEAVING_CONNECTION_LISTENER_FAILED , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } } } | Enlist connection listener |
14,816 | public static synchronized void delistConnectionListener ( String poolName , Object mcp , Object cl , String tx , boolean success , boolean rollbacked , boolean interleaving ) { if ( ! rollbacked ) { if ( ! interleaving ) { if ( success ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DELIST_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DELIST_CONNECTION_LISTENER_FAILED , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } } else { if ( success ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DELIST_INTERLEAVING_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DELIST_INTERLEAVING_CONNECTION_LISTENER_FAILED , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } } } else { if ( success ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DELIST_ROLLEDBACK_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } else { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DELIST_ROLLEDBACK_CONNECTION_LISTENER_FAILED , Integer . toHexString ( System . identityHashCode ( cl ) ) , tx . replace ( '-' , '_' ) ) ) ; } } } | Delist connection listener |
14,817 | public static synchronized void createConnectionListener ( String poolName , Object mcp , Object cl , Object mc , boolean get , boolean prefill , boolean incrementer , Throwable callstack ) { if ( get ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CREATE_CONNECTION_LISTENER_GET , Integer . toHexString ( System . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( mc ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( prefill ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CREATE_CONNECTION_LISTENER_PREFILL , Integer . toHexString ( System . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( mc ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( incrementer ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CREATE_CONNECTION_LISTENER_INCREMENTER , Integer . toHexString ( System . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( mc ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } } | Create connection listener |
14,818 | public static synchronized void destroyConnectionListener ( String poolName , Object mcp , Object cl , boolean ret , boolean idle , boolean invalid , boolean flush , boolean error , boolean prefill , boolean incrementer , Throwable callstack ) { if ( ret ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DESTROY_CONNECTION_LISTENER_RETURN , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( idle ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DESTROY_CONNECTION_LISTENER_IDLE , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( invalid ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DESTROY_CONNECTION_LISTENER_INVALID , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( flush ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DESTROY_CONNECTION_LISTENER_FLUSH , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( error ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DESTROY_CONNECTION_LISTENER_ERROR , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( prefill ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DESTROY_CONNECTION_LISTENER_PREFILL , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } else if ( incrementer ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . DESTROY_CONNECTION_LISTENER_INCREMENTER , Integer . toHexString ( System . identityHashCode ( cl ) ) , ! confidential && callstack != null ? toString ( callstack ) : "" ) ) ; } } | Destroy connection listener |
14,819 | public static synchronized void createManagedConnectionPool ( String poolName , Object mcp ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . MANAGED_CONNECTION_POOL_CREATE , "NONE" ) ) ; } | Create managed connection pool |
14,820 | public static synchronized void destroyManagedConnectionPool ( String poolName , Object mcp ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . MANAGED_CONNECTION_POOL_DESTROY , "NONE" ) ) ; } | Destroy managed connection pool |
14,821 | public static synchronized void pushCCMContext ( String key , Throwable callstack ) { log . tracef ( "%s" , new TraceEvent ( "CachedConnectionManager" , "NONE" , TraceEvent . PUSH_CCM_CONTEXT , "NONE" , key , callstack != null ? toString ( callstack ) : "" ) ) ; } | Push CCM context |
14,822 | public static synchronized void popCCMContext ( String key , Throwable callstack ) { log . tracef ( "%s" , new TraceEvent ( "CachedConnectionManager" , "NONE" , TraceEvent . POP_CCM_CONTEXT , "NONE" , key , callstack != null ? toString ( callstack ) : "" ) ) ; } | Pop CCM context |
14,823 | public static synchronized void registerCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . REGISTER_CCM_CONNECTION , Integer . toHexString ( System . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( connection ) ) , key ) ) ; } | Register CCM connection |
14,824 | public static synchronized void unregisterCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . UNREGISTER_CCM_CONNECTION , Integer . toHexString ( System . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( connection ) ) , key ) ) ; } | Unregister CCM connection |
14,825 | 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 . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( connection ) ) , key ) ) ; } | Unknown CCM connection |
14,826 | 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 . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( connection ) ) , key ) ) ; } | Close CCM connection |
14,827 | 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 . identityHashCode ( cl ) ) , Integer . toHexString ( System . identityHashCode ( connection ) ) , key ) ) ; } | CCM user transaction |
14,828 | 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 started" ) ; return kernel . getBean ( name , expectedType ) ; } | Lookup a bean |
14,829 | 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 ( deployment ) ; if ( shrinkwrapDeployments . isEmpty ( ) ) shrinkwrapDeployments = null ; recursiveDelete ( deployment ) ; } } | Remove ShrinkWrap deployment |
14,830 | public String getValue ( ) { return StringUtils . isEmptyTrimmed ( resolvedValue ) ? ( StringUtils . isEmptyTrimmed ( defaultValue ) ? "" : defaultValue ) : resolvedValue ; } | Resolves the expression |
14,831 | private Context currentContext ( ) { LinkedList < Context > stack = threadContexts . get ( ) ; if ( stack != null && ! stack . isEmpty ( ) ) { return stack . getLast ( ) ; } return null ; } | Look at the current context |
14,832 | 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 . connectionmanager . listener . ConnectionListener cl : context . getConnectionListeners ( cm ) ) { for ( Object c : context . getConnections ( cl ) ) { if ( ccs == null ) { unclosed = true ; if ( Tracer . isEnabled ( ) ) { Tracer . closeCCMConnection ( cl . getManagedConnectionPool ( ) . getPool ( ) . getConfiguration ( ) . getId ( ) , cl . getManagedConnectionPool ( ) , cl , c , context . toString ( ) ) ; } closeConnection ( c ) ; } else { ccs . add ( c ) ; } } } } return unclosed ; } | Close all connections for a context |
14,833 | private CloseConnectionSynchronization getCloseConnectionSynchronization ( boolean createIfNotFound ) { try { Transaction tx = null ; if ( transactionIntegration != null ) tx = transactionIntegration . getTransactionManager ( ) . getTransaction ( ) ; if ( tx != null && TxUtils . isActive ( tx ) ) { CloseConnectionSynchronization ccs = ( CloseConnectionSynchronization ) transactionIntegration . getTransactionSynchronizationRegistry ( ) . getResource ( CLOSE_CONNECTION_SYNCHRONIZATION ) ; if ( ccs == null && createIfNotFound ) { ccs = new CloseConnectionSynchronization ( ) ; transactionIntegration . getTransactionSynchronizationRegistry ( ) . putResource ( CLOSE_CONNECTION_SYNCHRONIZATION , ccs ) ; transactionIntegration . getTransactionSynchronizationRegistry ( ) . registerInterposedSynchronization ( ccs ) ; } return ccs ; } } catch ( Throwable t ) { log . debug ( "Unable to synchronize with transaction" , t ) ; } return null ; } | Get the CloseConnectionSynchronization instance |
14,834 | 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 ( exception != null ) { log . closingConnection ( connectionHandle , exception ) ; } else { log . closingConnection ( connectionHandle ) ; } m . invoke ( connectionHandle , new Object [ ] { } ) ; } catch ( Throwable t ) { log . closingConnectionThrowable ( t ) ; } } catch ( NoSuchMethodException nsme ) { log . closingConnectionNoClose ( connectionHandle . getClass ( ) . getName ( ) ) ; } } | Close connection handle |
14,835 | 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 |
14,836 | 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 |
14,837 | 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 ( "Error during isCompleted()" , error ) ; } } | Is the transaction completed |
14,838 | 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 |
14,839 | 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 ( a . getId ( ) != null ) writer . writeAttribute ( XML . ATTRIBUTE_ID , a . getValue ( XML . ATTRIBUTE_ID , a . getId ( ) ) ) ; writer . writeStartElement ( XML . ELEMENT_ARCHIVE ) ; writer . writeCharacters ( a . getValue ( XML . ELEMENT_ARCHIVE , a . getArchive ( ) ) ) ; writer . writeEndElement ( ) ; storeCommon ( a , writer ) ; writer . writeEndElement ( ) ; } writer . writeEndElement ( ) ; } } | Store a - ra . xml file |
14,840 | 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 . getCanonicalKeyPropertyListString ( ) ; compare = p1 . compareTo ( p2 ) ; } return compare ; } | Compares MBeanData based on the ObjectName domain name and canonical key properties |
14,841 | public static ConnectionManager createConnectionManager ( TransactionSupportEnum tse , ManagedConnectionFactory mcf , CachedConnectionManager ccm , ConnectionManagerConfiguration cmc , TransactionIntegration ti ) { if ( tse == TransactionSupportEnum . NoTransaction ) { return new NoTransactionConnectionManager ( mcf , ccm , cmc ) ; } else if ( tse == TransactionSupportEnum . LocalTransaction ) { return new LocalTransactionConnectionManager ( mcf , ccm , cmc , ti ) ; } else { return new XATransactionConnectionManager ( mcf , ccm , cmc , ti ) ; } } | Create a connection manager |
14,842 | 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 ) ) { return ms ; } } } } } } catch ( SecurityException se ) { } return null ; } | Get the MBeanServer instance |
14,843 | 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 |
14,844 | 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 |
14,845 | 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 ( ) ; } catch ( JMException e ) { value = e . getMessage ( ) ; } return value ; } | Get MBean attribute |
14,846 | 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 . getName ( ) ; String attrType = attrInfo . getType ( ) ; Object value = null ; Throwable throwable = null ; if ( attrInfo . isReadable ( ) ) { try { value = server . getAttribute ( objName , attrName ) ; } catch ( Throwable t ) { throwable = t ; } } Class typeClass = null ; try { typeClass = Classes . getPrimitiveTypeForName ( attrType ) ; if ( typeClass == null ) typeClass = loader . loadClass ( attrType ) ; } catch ( ClassNotFoundException cnfe ) { } PropertyEditor editor = null ; if ( typeClass != null ) editor = PropertyEditorManager . findEditor ( typeClass ) ; return new AttrResultInfo ( attrName , editor , value , throwable ) ; } | Get MBean attribute result info |
14,847 | 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 ( ) ; AttributeList newAttributes = new AttributeList ( ) ; for ( int a = 0 ; a < attributesInfo . length ; a ++ ) { MBeanAttributeInfo attrInfo = attributesInfo [ a ] ; String attrName = attrInfo . getName ( ) ; if ( ! attributes . containsKey ( attrName ) ) continue ; String value = ( String ) attributes . get ( attrName ) ; if ( value . equals ( "null" ) && server . getAttribute ( objName , attrName ) == null ) { if ( trace ) log . trace ( "ignoring 'null' for " + attrName ) ; continue ; } String attrType = attrInfo . getType ( ) ; Attribute attr = null ; try { Object realValue = PropertyEditors . convertValue ( value , attrType ) ; attr = new Attribute ( attrName , realValue ) ; } catch ( ClassNotFoundException e ) { if ( trace ) log . trace ( "Failed to load class for attribute: " + attrType , e ) ; throw new ReflectionException ( e , "Failed to load class for attribute: " + attrType ) ; } catch ( IntrospectionException e ) { if ( trace ) log . trace ( "Skipped setting attribute: " + attrName + ", cannot find PropertyEditor for type: " + attrType ) ; continue ; } server . setAttribute ( objName , attr ) ; newAttributes . add ( attr ) ; } return newAttributes ; } | Set MBean attributes |
14,848 | 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 ( ) ; MBeanOperationInfo op = opInfo [ index ] ; MBeanParameterInfo [ ] paramInfo = op . getSignature ( ) ; String [ ] argTypes = new String [ paramInfo . length ] ; for ( int p = 0 ; p < paramInfo . length ; p ++ ) argTypes [ p ] = paramInfo [ p ] . getType ( ) ; return invokeOpByName ( name , op . getName ( ) , argTypes , args ) ; } | Invoke an operation |
14,849 | 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 [ length ] ; for ( int p = 0 ; p < typedArgs . length ; p ++ ) { String arg = args [ p ] ; try { Object argValue = PropertyEditors . convertValue ( arg , argTypes [ p ] ) ; typedArgs [ p ] = argValue ; } catch ( ClassNotFoundException e ) { if ( trace ) log . trace ( "Failed to load class for arg" + p , e ) ; throw new ReflectionException ( e , "Failed to load class for arg" + p ) ; } catch ( java . beans . IntrospectionException e ) { if ( ! argTypes [ p ] . equals ( "java.lang.Object" ) ) throw new javax . management . IntrospectionException ( "Failed to find PropertyEditor for type: " + argTypes [ p ] ) ; typedArgs [ p ] = arg ; continue ; } } Object opReturn = server . invoke ( objName , opName , typedArgs , argTypes ) ; return new OpResultInfo ( opName , argTypes , args , opReturn ) ; } | Invoke an operation by name |
14,850 | public List < ConnectionDefinition > getConnectionDefinitions ( ) { if ( connectionDefinitions == null ) return null ; return Collections . unmodifiableList ( connectionDefinitions ) ; } | Get the connectionFactories . |
14,851 | public List < AdminObject > getAdminObjects ( ) { return adminObjects == null ? null : Collections . unmodifiableList ( adminObjects ) ; } | Get the adminObjects . |
14,852 | public Map < String , String > getConfigProperties ( ) { return configProperties == null ? null : Collections . unmodifiableMap ( configProperties ) ; } | Get the configProperties . |
14,853 | public List < String > getBeanValidationGroups ( ) { return beanValidationGroups == null ? null : Collections . unmodifiableList ( beanValidationGroups ) ; } | Get the beanValidationGroups . |
14,854 | public void addProvider ( UserTransactionProvider provider ) { UserTransactionProviderImpl impl = new UserTransactionProviderImpl ( provider ) ; delegator . addProvider ( impl ) ; providers . put ( provider , impl ) ; } | Add a provider |
14,855 | public void removeProvider ( UserTransactionProvider provider ) { UserTransactionProviderImpl impl = providers . get ( provider ) ; if ( impl != null ) { delegator . removeProvider ( impl ) ; providers . remove ( provider ) ; } } | Remove a provider |
14,856 | public void setDefaultGroups ( String [ ] value ) { if ( value != null ) { defaultGroups = Arrays . copyOf ( value , value . length ) ; } else { defaultGroups = null ; } } | Set the default groups |
14,857 | 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 ; CapacityDecrementer decrementer = null ; if ( metadata . getIncrementer ( ) != null && metadata . getIncrementer ( ) . getClassName ( ) != null ) { incrementer = loadIncrementer ( metadata . getIncrementer ( ) , classLoaderPlugin ) ; if ( incrementer != null ) { injectProperties ( metadata . getIncrementer ( ) . getConfigPropertiesMap ( ) , incrementer ) ; } else { log . invalidCapacityIncrementer ( metadata . getIncrementer ( ) . getClassName ( ) ) ; } } if ( incrementer == null ) incrementer = DefaultCapacity . DEFAULT_INCREMENTER ; if ( metadata . getDecrementer ( ) != null && metadata . getDecrementer ( ) . getClassName ( ) != null ) { decrementer = loadDecrementer ( metadata . getDecrementer ( ) , classLoaderPlugin ) ; if ( decrementer != null ) { injectProperties ( metadata . getDecrementer ( ) . getConfigPropertiesMap ( ) , decrementer ) ; } else { if ( TimedOutDecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) || TimedOutFIFODecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) || MinPoolSizeDecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) || SizeDecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) ) { decrementer = loadDecrementer ( metadata . getDecrementer ( ) , classLoaderPlugin ) ; injectProperties ( metadata . getDecrementer ( ) . getConfigPropertiesMap ( ) , decrementer ) ; } else { log . invalidCapacityDecrementer ( metadata . getDecrementer ( ) . getClassName ( ) ) ; } } } if ( decrementer == null ) decrementer = DefaultCapacity . DEFAULT_DECREMENTER ; return new ExplicitCapacity ( incrementer , decrementer ) ; } | Create a capacity instance based on the metadata |
14,858 | 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 CapacityIncrementer" , incrementer . getClassName ( ) ) ; return null ; } | Load the incrementer |
14,859 | 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 CapacityDecrementer" , decrementer . getClassName ( ) ) ; return null ; } | Load the decrementer |
14,860 | 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 ( "Throwable while loading %s using own classloader: %s" , extension . getClassName ( ) , t . getMessage ( ) ) ; } return null ; } | Load the class |
14,861 | 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 . append ( "\">" ) ; strProps . append ( props . getValue ( ) ) ; strProps . append ( "</config-property>" ) ; strProps . append ( "\n" ) ; } } | generate properties String |
14,862 | 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" . equalsIgnoreCase ( v ) ) { return TRANSACTION_READ_COMMITTED ; } else if ( "TRANSACTION_REPEATABLE_READ" . equalsIgnoreCase ( v ) || "4" . equalsIgnoreCase ( v ) ) { return TRANSACTION_REPEATABLE_READ ; } else if ( "TRANSACTION_SERIALIZABLE" . equalsIgnoreCase ( v ) || "8" . equalsIgnoreCase ( v ) ) { return TRANSACTION_SERIALIZABLE ; } else if ( "TRANSACTION_NONE" . equalsIgnoreCase ( v ) || "0" . equalsIgnoreCase ( v ) ) { return TRANSACTION_NONE ; } } return null ; } | Static method to get an instance |
14,863 | 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 && options . exists ( ) ) command . add ( "-Dironjacamar.options=" + options . getAbsolutePath ( ) ) ; command . add ( "-Djava.net.preferIPv4Stack=true" ) ; command . add ( "-Djgroups.bind_addr=127.0.0.1" ) ; command . add ( "-Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl" ) ; command . add ( "-Dlog4j.defaultInitOverride=true" ) ; command . add ( "-jar" ) ; command . add ( home + "/bin/ironjacamar-sjc.jar" ) ; ProcessBuilder pb = new ProcessBuilder ( command ) ; pb . redirectErrorStream ( true ) ; Map < String , String > environment = pb . environment ( ) ; environment . put ( "ironjacamar.home" , home ) ; Process p = pb . start ( ) ; instances . put ( home , p ) ; return true ; } catch ( Throwable t ) { } return false ; } | Start an instance |
14,864 | 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 |
14,865 | 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 . getName ( ) ) ) { bootstrapContexts . put ( bc . getName ( ) , bc ) ; } } } | Register bootstrap context |
14,866 | 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 . getName ( ) ) ) { bootstrapContexts . remove ( bc . getName ( ) ) ; } } } | Unregister boostrap context |
14,867 | 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 ) { bootstrapContexts . put ( bc . getName ( ) , bc ) ; } else if ( currentName != null ) { bootstrapContexts . remove ( currentName ) ; } } | Set the default bootstrap context |
14,868 | public synchronized CloneableBootstrapContext createBootstrapContext ( String id , String name ) { if ( id == null || id . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The id of BootstrapContext is invalid: " + id ) ; if ( activeBootstrapContexts . keySet ( ) . contains ( id ) ) { Integer i = refCountBootstrapContexts . get ( id ) ; refCountBootstrapContexts . put ( id , Integer . valueOf ( i . intValue ( ) + 1 ) ) ; return activeBootstrapContexts . get ( id ) ; } try { CloneableBootstrapContext template = null ; if ( name != null ) { template = bootstrapContexts . get ( name ) ; } else { template = defaultBootstrapContext ; } if ( template == null ) throw new IllegalArgumentException ( "The BootstrapContext wasn't found: " + name ) ; CloneableBootstrapContext bc = template . clone ( ) ; bc . setId ( id ) ; org . ironjacamar . core . api . workmanager . WorkManager wm = workManagerCoordinator . createWorkManager ( id , bc . getWorkManagerName ( ) ) ; bc . setWorkManager ( wm ) ; activeBootstrapContexts . put ( id , bc ) ; refCountBootstrapContexts . put ( id , Integer . valueOf ( 1 ) ) ; if ( trace ) log . tracef ( "Created BootstrapContext: %s" , bc ) ; return bc ; } catch ( Throwable t ) { throw new IllegalStateException ( "The BootstrapContext couldn't be created: " + name , t ) ; } } | Get a bootstrap context |
14,869 | 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 ( newValue == 0 ) { CloneableBootstrapContext cbc = activeBootstrapContexts . remove ( id ) ; refCountBootstrapContexts . remove ( id ) ; cbc . shutdown ( ) ; workManagerCoordinator . removeWorkManager ( id ) ; } else { refCountBootstrapContexts . put ( id , Integer . valueOf ( newValue ) ) ; } } } | Remove a bootstrap context |
14,870 | 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 MinimalJanitor ( ) ; } } } | Create a janitor |
14,871 | static Properties getSystemProperties ( ) { return ( Properties ) AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { return System . getProperties ( ) ; } } ) ; } | Get the system properties |
14,872 | 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 |
14,873 | 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 . toString ( ) ; } | Reads the contents of a stream into a string variable . |
14,874 | 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 |
14,875 | 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 path = new File ( outDir , directory ) ; if ( ! path . exists ( ) ) { if ( ! path . mkdirs ( ) ) throw new IOException ( "outdir can't be created" ) ; } File file = new File ( path . getAbsolutePath ( ) + File . separatorChar + name ) ; if ( file . exists ( ) ) { if ( ! file . delete ( ) ) throw new IOException ( "there is exist file, please check" ) ; } return new FileWriter ( file ) ; } | Create file in the package |
14,876 | 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 ) log . tracef ( "Addresses: %s" , result ) ; return Collections . unmodifiableSet ( result ) ; } | Get the addresses |
14,877 | 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 < NotificationListener > ( dwm . getNotificationListeners ( ) ) ; for ( NotificationListener nl : copy ) { nl . deltaDoWorkAccepted ( ) ; } } } | Local delta doWork accepted |
14,878 | 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 |
14,879 | private Subject getSubject ( ) { return AccessController . doPrivileged ( new PrivilegedAction < Subject > ( ) { public Subject run ( ) { try { String domain = recoverSecurityDomain ; if ( domain != null && subjectFactory != null ) { Subject subject = SecurityActions . createSubject ( subjectFactory , domain ) ; Set < PasswordCredential > pcs = SecurityActions . getPasswordCredentials ( subject ) ; if ( ! pcs . isEmpty ( ) ) { for ( PasswordCredential pc : pcs ) { pc . setManagedConnectionFactory ( mcf ) ; } } log . debugf ( "Recovery Subject=%s" , subject ) ; return subject ; } else { log . noCrashRecoverySecurityDomain ( jndiName ) ; } } catch ( Throwable t ) { log . exceptionDuringCrashRecoverySubject ( jndiName , t . getMessage ( ) , t ) ; } return null ; } } ) ; } | This method provide the Subject used for the XA Resource Recovery integration with the XAResourceRecoveryRegistry . |
14,880 | @ 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 = ( ValidatingManagedConnectionFactory ) mcf ; Set connectionSet = new HashSet ( 1 ) ; connectionSet . add ( recoverMC ) ; Set invalid = vmcf . getInvalidConnections ( connectionSet ) ; if ( invalid != null && ! invalid . isEmpty ( ) ) { log . debugf ( "Invalid managed connection: %s" , recoverMC ) ; close ( recoverMC ) ; recoverMC = mcf . createManagedConnection ( s , null ) ; } } catch ( ResourceException re ) { log . debugf ( "Exception during invalid check" , re ) ; close ( recoverMC ) ; recoverMC = mcf . createManagedConnection ( s , null ) ; } } return recoverMC ; } | Open a managed connection |
14,881 | 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 ( ResourceException ire ) { log . debugf ( "Error during recovery destroy" , ire ) ; } } recoverMC = null ; } | Close a managed connection |
14,882 | 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 |
14,883 | 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 plugin isValid()" , re ) ; forceClose = true ; } try { plugin . close ( c ) ; } catch ( ResourceException re ) { log . debugf ( "Error during recovery plugin close()" , re ) ; forceClose = true ; } } log . debugf ( "Force close=%s" , forceClose ) ; return forceClose ; } | Close a connection |
14,884 | 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 ) ; output . flush ( ) ; ObjectInputStream input = new ObjectInputStream ( socket . getInputStream ( ) ) ; Serializable result = ( Serializable ) input . readObject ( ) ; if ( result == null || ! ( result instanceof Throwable ) ) return true ; return false ; } finally { if ( socket != null ) { try { socket . close ( ) ; } catch ( IOException ioe ) { } } } } | Is a command available |
14,885 | 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 ) ; cmToCl . put ( cm , l ) ; if ( clToC == null ) clToC = new HashMap < ConnectionListener , List < Object > > ( ) ; List < Object > connections = clToC . get ( cl ) ; if ( connections == null ) connections = new ArrayList < Object > ( 1 ) ; connections . add ( c ) ; clToC . put ( cl , connections ) ; } | Register a connection |
14,886 | 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 |
14,887 | Set < ConnectionManager > getConnectionManagers ( ) { if ( cmToCl == null ) return Collections . unmodifiableSet ( Collections . emptySet ( ) ) ; return Collections . unmodifiableSet ( cmToCl . keySet ( ) ) ; } | Get the connection managers |
14,888 | 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 |
14,889 | 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 |
14,890 | 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 |
14,891 | 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 |
14,892 | 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 |
14,893 | 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 . |
14,894 | 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 |
14,895 | 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 ) ; out . write ( signature ) ; } | write a simple method signature |
14,896 | 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 , indent ) ; out . write ( " * @param " + param . getName ( ) + " " + param . getName ( ) ) ; writeEol ( out ) ; } if ( ! method . getReturnType ( ) . equals ( "void" ) ) { writeIndent ( out , indent ) ; out . write ( " * @return " + method . getReturnType ( ) ) ; writeEol ( out ) ; } for ( String ex : method . getExceptionType ( ) ) { writeIndent ( out , indent ) ; out . write ( " * @throws " + ex + " " + ex ) ; writeEol ( out ) ; } writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public " + method . getReturnType ( ) + " " + method . getMethodName ( ) + "(" ) ; int paramSize = method . getParams ( ) . size ( ) ; for ( int i = 0 ; i < paramSize ; i ++ ) { MethodParam param = method . getParams ( ) . get ( i ) ; out . write ( param . getType ( ) ) ; out . write ( " " ) ; out . write ( param . getName ( ) ) ; if ( i + 1 < paramSize ) out . write ( ", " ) ; } out . write ( ")" ) ; int exceptionSize = method . getExceptionType ( ) . size ( ) ; for ( int i = 0 ; i < exceptionSize ; i ++ ) { if ( i == 0 ) out . write ( " throws " ) ; String ex = method . getExceptionType ( ) . get ( i ) ; out . write ( ex ) ; if ( i + 1 < exceptionSize ) out . write ( ", " ) ; } } | Write method signature for given |
14,897 | void writeLeftCurlyBracket ( Writer out , int indent ) throws IOException { writeEol ( out ) ; writeWithIndent ( out , indent , "{\n" ) ; } | Output left curly bracket |
14,898 | void writeRightCurlyBracket ( Writer out , int indent ) throws IOException { writeEol ( out ) ; writeWithIndent ( out , indent , "}\n" ) ; } | Output right curly bracket |
14,899 | void writeDefaultConstructor ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * Default constructor\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public " + getClassName ( def ) + "()" ) ; writeLeftCurlyBracket ( out , indent ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; } | Output Default Constructor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.