Package i5.las2peer.persistency.helper
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 Summary
ConstructorDescriptionLatestArtifactVersionFinder
(String identifier, long startVersion, StorageLookupHandler nodeLookupHandler, rice.pastry.commonapi.PastryIdFactory artifactIdFactory, rice.p2p.past.Past pastStorage, int maxHandles, ExecutorService threadpool) constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called in its own thread to handle the given exception.void
void
run()
-
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
- AStorageLookupHandler
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
- Specified by:
onLookup
in interfaceStorageLookupHandler
-
onException
Description copied from interface:StorageExceptionHandler
This method is called in its own thread to handle the given exception.- Specified by:
onException
in interfaceStorageExceptionHandler
- 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()
-