Java Code Examples for org.hibernate.ConnectionReleaseMode#AFTER_STATEMENT
The following examples show how to use
org.hibernate.ConnectionReleaseMode#AFTER_STATEMENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcCoordinatorImpl.java From lams with GNU General Public License v2.0 | 6 votes |
private ConnectionReleaseMode determineConnectionReleaseMode( JdbcConnectionAccess jdbcConnectionAccess, boolean isUserSuppliedConnection, ConnectionReleaseMode connectionReleaseMode) { if ( isUserSuppliedConnection ) { return ConnectionReleaseMode.ON_CLOSE; } else if ( connectionReleaseMode == ConnectionReleaseMode.AFTER_STATEMENT && ! jdbcConnectionAccess.supportsAggressiveRelease() ) { LOG.debug( "Connection provider reports to not support aggressive release; overriding" ); return ConnectionReleaseMode.AFTER_TRANSACTION; } else { return connectionReleaseMode; } }
Example 2
Source File: ConnectionManager.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * Will connections be released after each statement execution? * <p/> * Connections will be released after each statement if either:<ul> * <li>the defined release-mode is {@link ConnectionReleaseMode#AFTER_STATEMENT}; or * <li>the defined release-mode is {@link ConnectionReleaseMode#AFTER_TRANSACTION} but * we are in auto-commit mode. * <p/> * release-mode = {@link ConnectionReleaseMode#ON_CLOSE} should [b]never[/b] release * a connection. * * @return True if the connections will be released after each statement; false otherwise. */ public boolean isAggressiveRelease() { if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { return true; } else if ( releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION ) { boolean inAutoCommitState; try { inAutoCommitState = isAutoCommit()&& !callback.isTransactionInProgress(); } catch( SQLException e ) { // assume we are in an auto-commit state inAutoCommitState = true; } return inAutoCommitState; } return false; }
Example 3
Source File: ConnectionManager.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * Modified version of {@link #isAggressiveRelease} which does not force a * transaction check. This is solely used from our {@link #afterTransaction} * callback, so no need to do the check; plus it seems to cause problems on * websphere (god i love websphere ;) * </p> * It uses this information to decide if an aggressive release was skipped * do to open resources, and if so forces a release. * * @return True if the connections will be released after each statement; false otherwise. */ private boolean isAggressiveReleaseNoTransactionCheck() { if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { return true; } else { boolean inAutoCommitState; try { inAutoCommitState = isAutoCommit(); } catch( SQLException e ) { // assume we are in an auto-commit state inAutoCommitState = true; } return releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION && inAutoCommitState; } }
Example 4
Source File: LogicalConnectionManagedImpl.java From lams with GNU General Public License v2.0 | 5 votes |
private PhysicalConnectionHandlingMode determineConnectionHandlingMode( PhysicalConnectionHandlingMode connectionHandlingMode, JdbcConnectionAccess jdbcConnectionAccess) { if ( connectionHandlingMode.getReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT && !jdbcConnectionAccess.supportsAggressiveRelease() ) { return PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION; } return connectionHandlingMode; }
Example 5
Source File: LogicalConnectionManagedImpl.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void afterStatement() { super.afterStatement(); if ( connectionHandlingMode.getReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT ) { if ( getResourceRegistry().hasRegisteredResources() ) { log.debug( "Skipping aggressive release of JDBC Connection after-statement due to held resources" ); } else { log.debug( "Initiating JDBC connection release from afterStatement" ); releaseConnection(); } } }
Example 6
Source File: JdbcCoordinatorImpl.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void afterStatementExecution() { LOG.tracev( "Starting after statement execution processing [{0}]", getConnectionReleaseMode() ); if ( getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT ) { if ( ! releasesEnabled ) { LOG.debug( "Skipping aggressive release due to manual disabling" ); return; } if ( hasRegisteredResources() ) { LOG.debug( "Skipping aggressive release due to registered resources" ); return; } getLogicalConnection().afterStatement(); } }
Example 7
Source File: JdbcCoordinatorImpl.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void afterTransaction() { transactionTimeOutInstant = -1; if ( getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT || getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_TRANSACTION ) { this.logicalConnection.afterTransaction(); } }
Example 8
Source File: SessionFactoryImpl.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public org.hibernate.classic.Session openTemporarySession() throws HibernateException { return new SessionImpl( null, this, true, settings.getCacheProvider().nextTimestamp(), interceptor, settings.getDefaultEntityMode(), false, false, ConnectionReleaseMode.AFTER_STATEMENT ); }
Example 9
Source File: JTATransactionFactory.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public ConnectionReleaseMode getDefaultReleaseMode() { return ConnectionReleaseMode.AFTER_STATEMENT; }
Example 10
Source File: CMTTransactionFactory.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public ConnectionReleaseMode getDefaultReleaseMode() { return ConnectionReleaseMode.AFTER_STATEMENT; }
Example 11
Source File: DummyJTAStyleTransationFactory.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public ConnectionReleaseMode getDefaultReleaseMode() { return ConnectionReleaseMode.AFTER_STATEMENT; }
Example 12
Source File: JTASessionContext.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Mainly for subclass usage. This impl always returns after_statement. * * @return The connection release mode for any built sessions. */ protected ConnectionReleaseMode getConnectionReleaseMode() { return ConnectionReleaseMode.AFTER_STATEMENT; }
Example 13
Source File: JTASessionContext.java From cacheonix-core with GNU Lesser General Public License v2.1 | 2 votes |
/** * Mainly for subclass usage. This impl always returns after_statement. * * @return The connection release mode for any built sessions. */ protected ConnectionReleaseMode getConnectionReleaseMode() { return ConnectionReleaseMode.AFTER_STATEMENT; }