Class MultiStoreResult

java.lang.Object
i5.las2peer.persistency.helper.MultiStoreResult
All Implemented Interfaces:
StorageExceptionHandler, StorageStoreResultHandler

public class MultiStoreResult extends Object implements StorageStoreResultHandler, StorageExceptionHandler
This class is used to handle the multiple store results generated from a parted artifact insert. It provides the result handlers for the insert process itself and methods to wait for the result or an exception. Both can be retrieved via methods, too.
  • Constructor Details

    • MultiStoreResult

      public MultiStoreResult(int parts)
      Initiates the store result container for the given number of parts.
      Parameters:
      parts - The number of parts that must be stored to complete this store operation.
  • Method Details

    • onResult

      public void onResult(Serializable serializable, int successfulOperations)
      Description copied from interface: StorageStoreResultHandler
      This method is called in its own thread to handle the result of a store operation.
      Specified by:
      onResult in interface StorageStoreResultHandler
      Parameters:
      serializable - The serializable that was stored in the network.
      successfulOperations - The number of successful insert operations (replications).
    • onException

      public void onException(Exception e)
      Description copied from interface: StorageExceptionHandler
      This method is called in its own thread to handle the given exception.
      Specified by:
      onException in interface StorageExceptionHandler
      Parameters:
      e - An execption that occurred during a network operation. Usually the reason or metadata should be known from the surrounding context and should be provided to this handler, too.
    • isDone

      public boolean isDone()
      Checks if the underlying store result is completed or not.
      Returns:
      Returns true if the store operation is finished.
    • getMinSuccessfulOperations

      public int getMinSuccessfulOperations()
      Gets the minimal number of successful operations for any part of this store operation.
      Returns:
      Returns the minimal number of replications.
    • getException

      public Exception getException()
      Gets the exception from this store operation.
      Returns:
      Returns an exception or null if there is none.