Class LatestArtifactVersionFinder

java.lang.Object
i5.las2peer.persistency.helper.LatestArtifactVersionFinder
All Implemented Interfaces:
StorageExceptionHandler, StorageLookupHandler, Runnable

public class LatestArtifactVersionFinder extends Object implements Runnable, StorageLookupHandler, StorageExceptionHandler
This class is used to manage the process in order to find the latest version for a given identifier. It uses binary search if the latest version is requested.
  • Constructor Details

    • LatestArtifactVersionFinder

      public LatestArtifactVersionFinder(String identifier, long startVersion, StorageLookupHandler nodeLookupHandler, rice.pastry.commonapi.PastryIdFactory artifactIdFactory, rice.p2p.past.Past pastStorage, int maxHandles, ExecutorService threadpool)
      constructor
      Parameters:
      identifier - A textual or hash identifier for this envelope.
      startVersion - A version number to start the search from. Usually the last known version.
      nodeLookupHandler - A StorageLookupHandler implementation that is provided with handles to the latest found version.
      artifactIdFactory - An id factory to generate network ids during the search process.
      pastStorage - A past storage that should be request for version handles.
      maxHandles - The maximum number of handles to be queried from the network.
      threadpool - A executor service to perform subtasks.
  • Method Details

    • onLookup

      public void onLookup(ArrayList<rice.p2p.past.PastContentHandle> metadataHandles)
      Specified by:
      onLookup in interface StorageLookupHandler
    • 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.
    • run

      public void run()
      Specified by:
      run in interface Runnable