Class BHiveTransactions

java.lang.Object
io.bdeploy.bhive.BHiveTransactions

public class BHiveTransactions extends Object
Keeps track of running operations in the JVM.

Uses MarkerDatabase to synchronize with other JVMs which might have operations running as well.

  • Constructor Details

  • Method Details

    • detachThread

      public void detachThread()
      Transactions are inherited by default. If this is not desired, this method can be used to explicitly detach the current Thread from its parent (and potential sibling threads).
    • touchObject

      public void touchObject(ObjectId object)
      Parameters:
      object - the object which should be considered "touched", i.e. inserted.
    • hasTransaction

      public boolean hasTransaction()
      Returns:
      whether the current thread has an associated transaction.
    • begin

      Begins a new transaction on this thread.

      Inserts on the ObjectDatabase of a BHive will use this transaction to keep track of objects inserted.

      Returns:
      a BHiveTransactions.Transaction which will cleanup associated resources when closed.
    • cleanStaleTransactions

      public long cleanStaleTransactions()
      This method can be used to detect and clean stale transactions which may keep (potentially damaged) objects alive.
      Returns:
      the amount of stale transactions found (and removed).