public class ConnectionManager extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
ConnectionManager.Callback |
Constructor and Description |
---|
ConnectionManager(SessionFactoryImplementor factory,
ConnectionManager.Callback callback,
ConnectionReleaseMode releaseMode,
Connection connection,
Interceptor interceptor)
Constructs a ConnectionManager.
|
Modifier and Type | Method and Description |
---|---|
void |
afterStatement()
To be called after execution of each JDBC statement.
|
void |
afterTransaction()
To be called after local transaction completion.
|
Connection |
borrowConnection() |
Connection |
close()
To be called after Session completion.
|
static ConnectionManager |
deserialize(ObjectInputStream ois,
SessionFactoryImplementor factory,
Interceptor interceptor,
ConnectionReleaseMode connectionReleaseMode,
JDBCContext jdbcContext) |
void |
flushBeginning()
Callback to let us know that a flush is beginning.
|
void |
flushEnding()
Callback to let us know that a flush is ending.
|
Batcher |
getBatcher()
The batcher managed by this ConnectionManager.
|
Connection |
getConnection()
Retrieves the connection currently managed by this ConnectionManager.
|
SessionFactoryImplementor |
getFactory()
The session factory.
|
boolean |
hasBorrowedConnection() |
boolean |
isAggressiveRelease()
Will connections be released after each statement execution?
Connections will be released after each statement if either:
the defined release-mode is
ConnectionReleaseMode.AFTER_STATEMENT ; or
the defined release-mode is ConnectionReleaseMode.AFTER_TRANSACTION but
we are in auto-commit mode. |
boolean |
isAutoCommit()
Is the connection considered "auto-commit"?
|
boolean |
isCurrentlyConnected()
Is this ConnectionManager instance "logically" connected.
|
boolean |
isReadyForSerialization() |
boolean |
isSuppliedConnection()
Was the connection being used here supplied by the user?
|
Connection |
manualDisconnect()
Manually disconnect the underlying JDBC Connection.
|
void |
manualReconnect()
Manually reconnect the underlying JDBC Connection.
|
void |
manualReconnect(Connection suppliedConnection)
Manually reconnect the underlying JDBC Connection.
|
void |
releaseBorrowedConnection() |
void |
serialize(ObjectOutputStream oos) |
public ConnectionManager(SessionFactoryImplementor factory, ConnectionManager.Callback callback, ConnectionReleaseMode releaseMode, Connection connection, Interceptor interceptor)
factory
- The SessionFactory.callback
- An observer for internal state change.releaseMode
- The mode by which to release JDBC connections.connection
- An externally supplied connection.public SessionFactoryImplementor getFactory()
public Batcher getBatcher()
public boolean isSuppliedConnection()
public Connection getConnection() throws HibernateException
HibernateException
- Indicates a connection is currently not
available (we are currently manually disconnected).public boolean hasBorrowedConnection()
public Connection borrowConnection()
public void releaseBorrowedConnection()
public boolean isAutoCommit() throws SQLException
SQLException
- Can be thrown by the Connection.isAutoCommit() check.public boolean isAggressiveRelease()
ConnectionReleaseMode.AFTER_STATEMENT
; or
ConnectionReleaseMode.AFTER_TRANSACTION
but
we are in auto-commit mode.
release-mode = ConnectionReleaseMode.ON_CLOSE
should [b]never[/b] release
a connection.public boolean isCurrentlyConnected()
public void afterStatement()
public void afterTransaction()
public Connection close()
public Connection manualDisconnect()
public void manualReconnect()
public void manualReconnect(Connection suppliedConnection)
public void flushBeginning()
flushEnding()
public void flushEnding()
public boolean isReadyForSerialization()
public void serialize(ObjectOutputStream oos) throws IOException
IOException
public static ConnectionManager deserialize(ObjectInputStream ois, SessionFactoryImplementor factory, Interceptor interceptor, ConnectionReleaseMode connectionReleaseMode, JDBCContext jdbcContext) throws IOException
IOException
Copyright © 2002-2015 Red Hat Middleware, LLC. All Rights Reserved