Class LogicalConnectionProvidedImpl
- java.lang.Object
-
- org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor
-
- org.hibernate.resource.jdbc.internal.LogicalConnectionProvidedImpl
-
- All Implemented Interfaces:
LogicalConnection
,LogicalConnectionImplementor
,PhysicalJdbcTransaction
,JdbcResourceTransaction
public class LogicalConnectionProvidedImpl extends AbstractLogicalConnectionImplementor
-
-
Field Summary
-
Fields inherited from class org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor
resourceRegistry
-
-
Constructor Summary
Constructors Constructor Description LogicalConnectionProvidedImpl(Connection providedConnection, ResourceRegistry resourceRegistry)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterCompletion()
Connection
close()
Closes the JdbcSession, making it inactive and forcing release of any held resourcesstatic LogicalConnectionProvidedImpl
deserialize(ObjectInputStream ois)
protected Connection
getConnectionForTransactionManagement()
PhysicalConnectionHandlingMode
getConnectionHandlingMode()
Connection
getPhysicalConnection()
Exposes access to the "real" Connection.boolean
isOpen()
Is this (logical) JDBC Connection still open/active.boolean
isPhysicallyConnected()
Is this JdbcSession currently physically connected (meaning does it currently hold a JDBC Connection)?Connection
manualDisconnect()
Manually disconnect the underlying JDBC Connection.void
manualReconnect(Connection connection)
Manually reconnect the underlying JDBC Connection.void
serialize(ObjectOutputStream oos)
Serialization hook-
Methods inherited from class org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor
afterStatement, afterTransaction, beforeTransactionCompletion, begin, commit, determineInitialAutoCommitMode, doConnectionsFromProviderHaveAutoCommitDisabled, errorIfClosed, getPhysicalJdbcTransaction, getResourceRegistry, getStatus, resetConnection, rollback
-
-
-
-
Constructor Detail
-
LogicalConnectionProvidedImpl
public LogicalConnectionProvidedImpl(Connection providedConnection, ResourceRegistry resourceRegistry)
-
-
Method Detail
-
getConnectionHandlingMode
public PhysicalConnectionHandlingMode getConnectionHandlingMode()
-
isOpen
public boolean isOpen()
Description copied from interface:LogicalConnection
Is this (logical) JDBC Connection still open/active. In other words, hasLogicalConnection.close()
not been called yet?- Returns:
true
if still open (LogicalConnection.close()
has not been called yet);false
if not open (LogicalConnection.close()
has been called).
-
close
public Connection close()
Description copied from interface:LogicalConnection
Closes the JdbcSession, making it inactive and forcing release of any held resources- Returns:
- Legacy :( Returns the JDBC Connection *if* the user passed in a Connection originally.
-
isPhysicallyConnected
public boolean isPhysicallyConnected()
Description copied from interface:LogicalConnection
Is this JdbcSession currently physically connected (meaning does it currently hold a JDBC Connection)?- Returns:
true
if the JdbcSession currently hold a JDBC Connection;false
if it does not.
-
getPhysicalConnection
public Connection getPhysicalConnection()
Description copied from interface:LogicalConnectionImplementor
Exposes access to the "real" Connection.- Returns:
- The connection
-
serialize
public void serialize(ObjectOutputStream oos) throws IOException
Description copied from interface:LogicalConnectionImplementor
Serialization hook- Parameters:
oos
- The stream to write out state to- Throws:
IOException
- Problem accessing stream
-
deserialize
public static LogicalConnectionProvidedImpl deserialize(ObjectInputStream ois) throws IOException, ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
-
manualDisconnect
public Connection manualDisconnect()
Description copied from interface:LogicalConnectionImplementor
Manually disconnect the underlying JDBC Connection. The assumption here is that the manager will be reconnected at a later point in time.- Returns:
- The connection maintained here at time of disconnect.
null
if there was no connection cached internally.
-
manualReconnect
public void manualReconnect(Connection connection)
Description copied from interface:LogicalConnectionImplementor
Manually reconnect the underlying JDBC Connection. Should be called at some point after manualDisconnect().- Parameters:
connection
- For user supplied connection strategy the user needs to hand us the connection with which to reconnect. It is an error to pass a connection in the other strategies.
-
getConnectionForTransactionManagement
protected Connection getConnectionForTransactionManagement()
- Specified by:
getConnectionForTransactionManagement
in classAbstractLogicalConnectionImplementor
-
afterCompletion
protected void afterCompletion()
- Overrides:
afterCompletion
in classAbstractLogicalConnectionImplementor
-
-