Package i5.las2peer.persistency.helper
Class MultiStoreResult
java.lang.Object
i5.las2peer.persistency.helper.MultiStoreResult
- All Implemented Interfaces:
StorageExceptionHandler,StorageStoreResultHandler
public class MultiStoreResult
extends Object
implements StorageStoreResultHandler, StorageExceptionHandler
This class is used to handle the multiple store results generated from a parted artifact insert. It provides the
result handlers for the insert process itself and methods to wait for the result or an exception. Both can be
retrieved via methods, too.
-
Constructor Summary
ConstructorsConstructorDescriptionMultiStoreResult(int parts) Initiates the store result container for the given number of parts. -
Method Summary
Modifier and TypeMethodDescriptionGets the exception from this store operation.intGets the minimal number of successful operations for any part of this store operation.booleanisDone()Checks if the underlying store result is completed or not.voidThis method is called in its own thread to handle the given exception.voidonResult(Serializable serializable, int successfulOperations) This method is called in its own thread to handle the result of a store operation.
-
Constructor Details
-
MultiStoreResult
public MultiStoreResult(int parts) Initiates the store result container for the given number of parts.- Parameters:
parts- The number of parts that must be stored to complete this store operation.
-
-
Method Details
-
onResult
Description copied from interface:StorageStoreResultHandlerThis method is called in its own thread to handle the result of a store operation.- Specified by:
onResultin interfaceStorageStoreResultHandler- Parameters:
serializable- The serializable that was stored in the network.successfulOperations- The number of successful insert operations (replications).
-
onException
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.
-
isDone
public boolean isDone()Checks if the underlying store result is completed or not.- Returns:
- Returns
trueif the store operation is finished.
-
getMinSuccessfulOperations
public int getMinSuccessfulOperations()Gets the minimal number of successful operations for any part of this store operation.- Returns:
- Returns the minimal number of replications.
-
getException
Gets the exception from this store operation.- Returns:
- Returns an exception or
nullif there is none.
-