Class OneThread
java.lang.Object
uk.ac.manchester.spinnaker.storage.threading.OneThread
public final class OneThread extends Object
A wrapper for an SQL connection that enforces that it is only used from its
creating thread.
- Author:
- Donal Fellows
-
Method Summary
Modifier and Type Method Description static Connection
threadBound(Connection conn)
Create the wrapper.static Connection
uncloseableThreadBound(Connection conn)
Create the wrapper.
-
Method Details
-
threadBound
Create the wrapper.- Parameters:
conn
- The connection that is being protected.- Returns:
- The wrapped connection.
-
uncloseableThreadBound
Create the wrapper. This wrapper cannot be closed (theConnection.close()
method fails silently); it is up to the caller to save the wrapped connection and close it at the right time.- Parameters:
conn
- The connection that is being protected.- Returns:
- The wrapped connection.
-