Class TransactionCallbacks

java.lang.Object
io.meeds.common.TransactionCallbacks

public class TransactionCallbacks extends Object
Callbacks run once the JPA transaction of the current thread completes
  • Method Details

    • afterCompletion

      public static boolean afterCompletion(Runnable callback)
      Registers a callback run once the JPA transaction active on the current thread completes, whether it's committed or rolled back. A cache eviction made inside a transaction is repeated this way: a concurrent read made before the commit caches the previous state again.
      Parameters:
      callback - the callback to run, its errors are logged
      Returns:
      true when the callback is registered, false when no JPA transaction is active on the thread: the callback isn't run then