Package i5.las2peer.persistency.helper
Class MultiArtifactHandler
java.lang.Object
i5.las2peer.persistency.helper.MultiArtifactHandler
- All Implemented Interfaces:
StorageArtifactHandler,StorageExceptionHandler
public class MultiArtifactHandler extends java.lang.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 Summary
Constructors Constructor Description MultiArtifactHandler(int numberOfParts, StoragePartsHandler partsHandler, StorageExceptionHandler exceptionHandler)Initiates this lookup result collection with the given first part. -
Method Summary
Modifier and Type Method Description voidonException(java.lang.Exception e)This method is called in its own thread to handle the given exception.voidonReceive(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:
onReceivein interfaceStorageArtifactHandler
-
onException
public void onException(java.lang.Exception e)Description copied from interface:StorageExceptionHandlerThis method is called in its own thread to handle the given exception.- Specified by:
onExceptionin 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.
-