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 Details

    • threadBound

      public static Connection threadBound​(Connection conn)
      Create the wrapper.
      Parameters:
      conn - The connection that is being protected.
      Returns:
      The wrapped connection.
    • uncloseableThreadBound

      public static Connection uncloseableThreadBound​(Connection conn)
      Create the wrapper. This wrapper cannot be closed (the Connection.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.