Interface TransactionHandler

    • Method Detail

      • begin

        void begin​(Handle handle)
        Begin a transaction.
        Parameters:
        handle - the handle the transaction is being started on
      • commit

        void commit​(Handle handle)
        Commit the transaction.
        Parameters:
        handle - the handle the commit is being performed on
      • rollback

        void rollback​(Handle handle)
        Roll back the transaction.
        Parameters:
        handle - the handle the rollback is being performed on
      • isInTransaction

        boolean isInTransaction​(Handle handle)
        Returns whether a given Handle is in the transaction.
        Parameters:
        handle - the handle to test
        Returns:
        whether the given handle is in a transaction
      • savepoint

        void savepoint​(Handle handle,
                       java.lang.String savepointName)
        Create a new savepoint.
        Parameters:
        handle - the handle on which the transaction is being savepointed
        savepointName - The name of the savepoint, used to rollback to or release later
      • rollbackToSavepoint

        void rollbackToSavepoint​(Handle handle,
                                 java.lang.String savepointName)
        Roll back to a named savepoint.
        Parameters:
        handle - the handle the rollback is being performed on
        savepointName - the name of the savepoint to rollback to
      • releaseSavepoint

        void releaseSavepoint​(Handle handle,
                              java.lang.String savepointName)
        Release a previously created savepoint.
        Parameters:
        handle - the handle on which the savepoint is being released
        savepointName - the savepoint to release
      • inTransaction

        <R,​X extends java.lang.Exception> R inTransaction​(Handle handle,
                                                                HandleCallback<R,​X> callback)
                                                         throws X extends java.lang.Exception
        Run a transaction.
        Type Parameters:
        R - the callback return type
        X - the exception type thrown by the callback, if any
        Parameters:
        handle - the handle to the database
        callback - a callback which will receive the open handle, in a transaction.
        Returns:
        the value returned by the callback.
        Throws:
        X - any exception thrown by the callback.
        X extends java.lang.Exception
        See Also:
        Handle.inTransaction(HandleCallback)
      • inTransaction

        <R,​X extends java.lang.Exception> R inTransaction​(Handle handle,
                                                                TransactionIsolationLevel level,
                                                                HandleCallback<R,​X> callback)
                                                         throws X extends java.lang.Exception
        Run a transaction.
        Type Parameters:
        R - the callback return type
        X - the exception type thrown by the callback, if any
        Parameters:
        handle - the handle to the database
        level - the isolation level for the transaction
        callback - a callback which will receive the open handle, in a transaction.
        Returns:
        the value returned by the callback.
        Throws:
        X - any exception thrown by the callback.
        X extends java.lang.Exception
        See Also:
        Handle.inTransaction(TransactionIsolationLevel, HandleCallback)
      • specialize

        default TransactionHandler specialize​(Handle handle)
                                       throws java.sql.SQLException
        Bind a TransactionHandler to a Handle, to allow it to track handle-local state.
        Parameters:
        handle - the handle to bind to
        Returns:
        the bound TransactionHandler
        Throws:
        java.sql.SQLException - bad things happened