Class PermazenTransactionManager.TransactionSynchronizationCallback

java.lang.Object
io.permazen.spring.PermazenTransactionManager.TransactionSynchronizationCallback
All Implemented Interfaces:
Transaction.Callback
Enclosing class:
PermazenTransactionManager

public static class PermazenTransactionManager.TransactionSynchronizationCallback extends Object implements Transaction.Callback
Adapter class that wraps a Spring TransactionSynchronization in the Transaction.Callback interface.
  • Field Details

  • Constructor Details

    • TransactionSynchronizationCallback

      public TransactionSynchronizationCallback(TransactionSynchronization synchronization)
      Constructor.
      Parameters:
      synchronization - transaction callback
      Throws:
      IllegalArgumentException - if synchronization is null
  • Method Details

    • beforeCommit

      public void beforeCommit(boolean readOnly)
      Description copied from interface: Transaction.Callback
      Invoked before transaction commit (and before Transaction.Callback.beforeCompletion()). This method is invoked when a transaction is intended to be committed; it may however still be rolled back.

      Any exceptions thrown will result in a transaction rollback and be propagated to the caller.

      Specified by:
      beforeCommit in interface Transaction.Callback
      Parameters:
      readOnly - true if the transaction is marked read-only
    • beforeCompletion

      public void beforeCompletion()
      Description copied from interface: Transaction.Callback
      Invoked before transaction completion in any case (but after any beforeCommit()). This method is invoked whether the transaction is going to be committed or rolled back, and is invoked even if beforeCommit() throws an exception. Typically used to clean up resources before transaction completion.

      Any exceptions thrown will be logged but will not propagate to the caller.

      Specified by:
      beforeCompletion in interface Transaction.Callback
    • afterCommit

      public void afterCommit()
      Description copied from interface: Transaction.Callback
      Invoked after successful transaction commit (and before afterCompletion()).

      Any exceptions thrown will propagate to the caller.

      Specified by:
      afterCommit in interface Transaction.Callback
    • afterCompletion

      public void afterCompletion(boolean committed)
      Description copied from interface: Transaction.Callback
      Invoked after transaction completion (but after any Transaction.Callback.afterCommit()). This method is invoked in any case, whether the transaction was committed or rolled back. Typically used to clean up resources after transaction completion.

      Any exceptions thrown will be logged but will not propagate to the caller.

      Specified by:
      afterCompletion in interface Transaction.Callback
      Parameters:
      committed - true if transaction was commited, false if transaction was rolled back
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object