Class NucleusConnectionImpl
java.lang.Object
org.datanucleus.store.NucleusConnectionImpl
- All Implemented Interfaces:
NucleusConnection
Representation of a datastore connection.
Provides access to the native connection for the datastore.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNucleusConnectionImpl(Object conn, Runnable onClose) Constructor for a datastore connection holder. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Method to close the connection.Accessor for the native connection for this datastore.booleanAccessor for whether the connection is available.
-
Field Details
-
nativeConnection
Native connection for this datastore. -
onClose
run "onClose" on close call -
isAvailable
private boolean isAvailablewhether this connection is available to the developer
-
-
Constructor Details
-
NucleusConnectionImpl
-
-
Method Details
-
close
public void close()Method to close the connection. Performs whatever action was specified at creation.- Specified by:
closein interfaceNucleusConnection- Throws:
NucleusUserException- Thrown if the connection is no longer available.
-
isAvailable
public boolean isAvailable()Description copied from interface:NucleusConnectionAccessor for whether the connection is available.- Specified by:
isAvailablein interfaceNucleusConnection- Returns:
- Whether it is available
-
getNativeConnection
Accessor for the native connection for this datastore. For RDBMS this would be a java.sql.Connection, or for db4o an ObjectContainer etc.- Specified by:
getNativeConnectionin interfaceNucleusConnection- Returns:
- The native connection
-