Package i5.las2peer.persistency.helper
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
NetworkArtifact
s. 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 Summary
ConstructorDescriptionMultiArtifactHandler
(int numberOfParts, StoragePartsHandler partsHandler, StorageExceptionHandler exceptionHandler) Initiates this lookup result collection with the given first part. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called in its own thread to handle the given exception.void
onReceive
(AbstractArtifact artifact)
-
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
- Specified by:
onReceive
in interfaceStorageArtifactHandler
-
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.
-