Class MultiArtifactHandler

java.lang.Object
i5.las2peer.persistency.helper.MultiArtifactHandler
All Implemented Interfaces:
StorageArtifactHandler, StorageExceptionHandler

public class MultiArtifactHandler extends Object implements StorageArtifactHandler, StorageExceptionHandler
This class is used to handle the lookup and retrieve process for a bunch of NetworkArtifacts. It gathers all parts till it received the necessary amount specified by the first part given. After that it calls the respective handlers given, same for exceptions.
  • Constructor Details

    • MultiArtifactHandler

      public MultiArtifactHandler(int numberOfParts, StoragePartsHandler partsHandler, StorageExceptionHandler exceptionHandler)
      Initiates this lookup result collection with the given first part. The number of parts is retrieved from the given first part.
      Parameters:
      numberOfParts - The number of artifacts that must be retrieved to consider a full set.
      partsHandler - The result handler that gets all retrieved parts as a list.
      exceptionHandler - The exception handler that should be called, if an exception occurs.
  • Method Details

    • onReceive

      public void onReceive(AbstractArtifact artifact)
      Specified by:
      onReceive in interface StorageArtifactHandler
    • 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.