Class BHive.Operation<T>

java.lang.Object
io.bdeploy.bhive.BHive.Operation<T>
All Implemented Interfaces:
BHiveExecution, Callable<T>
Direct Known Subclasses:
AwaitDirectoryLockOperation, BHive.TransactedOperation, CopyOperation, ExportOperation, ExportTreeOperation, FsckOperation, InsertManifestOperation, LockDirectoryOperation, ManifestConsistencyCheckOperation, ManifestDeleteOldByIdOperation, ManifestDeleteOperation, ManifestExistsOperation, ManifestLexicalMaxTagOperation, ManifestListOperation, ManifestLoadOperation, ManifestMaxIdOperation, ManifestNextIdOperation, ManifestRefLoadOperation, ManifestRefScanOperation, ObjectConsistencyCheckOperation, ObjectExistsOperation, ObjectListOperation, ObjectLoadOperation, ObjectSizeOperation, ObjectWriteOperation, PruneOperation, ReleaseDirectoryLockOperation, RemoteOperation, ScanOperation, TreeEntryLoadOperation, TreeLoadOperation
Enclosing class:
BHive

public abstract static class BHive.Operation<T> extends Object implements Callable<T>, BHiveExecution
Base class for all operations that need to access internals of the BHive they are executed on.
  • Constructor Details

    • Operation

      public Operation()
  • Method Details

    • getObjectManager

      protected ObjectManager getObjectManager()
      Returns:
      the ObjectManager to use when operating on the underlying ObjectDatabase.
    • getManifestDatabase

      protected ManifestDatabase getManifestDatabase()
      Returns:
      the underlying ManifestDatabase
    • getMarkerRoot

      protected Path getMarkerRoot()
      Returns:
      the root path for marker databases which contribute to protected objects.
    • getActivityReporter

      protected ActivityReporter getActivityReporter()
      Returns:
      the ActivityReporter to manage ActivityReporter.Activitys with.
    • getAuditor

      protected Auditor getAuditor()
      Returns:
      the Auditor associated with the current BHive.
    • getLockContentValidator

      protected Predicate<String> getLockContentValidator()
      Returns the validator to check is a given lock file is still valid.
    • getLockContentSupplier

      protected Supplier<String> getLockContentSupplier()
      Returns the supplier that provide the content to be written to the lock file.
    • getTransactions

      public BHiveTransactions getTransactions()
      Specified by:
      getTransactions in interface BHiveExecution
      Returns:
      the transactions manager for this BHiveExecution
    • submitFileOperation

      protected Future<?> submitFileOperation(Runnable op)
      Submit a Runnable performing a file operation to the pool managing those operations.
      Parameters:
      op - the operation to run
      Returns:
      a Future which can awaited, see FutureHelper.awaitAll(java.util.Collection).
    • execute

      public <X> X execute(BHive.Operation<X> other)
      Execute another BHive.Operation on the BHive which is currently associated with this BHive.Operation.
      Specified by:
      execute in interface BHiveExecution
      Parameters:
      other - the BHive.Operation to execute
      Returns:
      the BHive.Operations declared return type.
    • setRetryCount

      public BHive.Operation<T> setRetryCount(int retryCount)
      Sets the number of times the operation should be retried in case of an exception. The default value is '0' which means that the operation is not retried on failure. A retry count of '4' means that the operation is executed up to 5 times before giving up (First run + 4 retries).

      The default value is '0' which means an operation is not retried in case of an exception.

      Parameters:
      retryCount - the number of times to retry the operation