Class PoolableManagedConnectionFactory

    • Constructor Detail

      • PoolableManagedConnectionFactory

        public PoolableManagedConnectionFactory​(XAConnectionFactory connFactory,
                                                org.apache.commons.pool.ObjectPool pool,
                                                org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory,
                                                java.lang.String validationQuery,
                                                boolean defaultReadOnly,
                                                boolean defaultAutoCommit)
        Create a PoolableManagedConnectionFactory and attach it to a connection pool.
        Parameters:
        connFactory - XAConnectionFactory
        pool - connection pool
        stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement pooling
        validationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.
        defaultReadOnly - the default "read only" setting for borrowed Connections
        defaultAutoCommit - the default "auto commit" setting for returned Connections
      • PoolableManagedConnectionFactory

        public PoolableManagedConnectionFactory​(XAConnectionFactory connFactory,
                                                org.apache.commons.pool.ObjectPool pool,
                                                org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory,
                                                java.lang.String validationQuery,
                                                int validationQueryTimeout,
                                                java.util.Collection connectionInitSqls,
                                                java.lang.Boolean defaultReadOnly,
                                                boolean defaultAutoCommit,
                                                int defaultTransactionIsolation,
                                                java.lang.String defaultCatalog,
                                                AbandonedConfig config)
        Create a PoolableManagedConnectionFactory and attach it to a connection pool.
        Parameters:
        connFactory - XAConnectionFactory
        pool - connection pool
        stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement pooling
        validationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.
        validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.
        connectionInitSqls - a Collection of SQL statements to initialize Connections. Using null turns off initialization.
        defaultReadOnly - the default "read only" setting for borrowed Connections
        defaultAutoCommit - the default "auto commit" setting for returned Connections
        defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections
        defaultCatalog - the default "catalog" setting for returned Connections
        config - the AbandonedConfig if tracing SQL objects
    • Method Detail

      • makeObject

        public java.lang.Object makeObject()
                                    throws java.lang.Exception
        Uses the configured XAConnectionFactory to create a PoolableManagedConnection. Throws IllegalStateException if the connection factory returns null. Also initializes the connection using configured initialization sql (if provided) and sets up a prepared statement pool associated with the PoolableManagedConnection if statement pooling is enabled.
        Specified by:
        makeObject in interface org.apache.commons.pool.PoolableObjectFactory
        Overrides:
        makeObject in class PoolableConnectionFactory
        Throws:
        java.lang.Exception