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
ConstructorDescriptionMultiStoreResult
(int parts) Initiates the store result container for the given number of parts. -
Method Summary
Modifier and TypeMethodDescriptionGets the exception from this store operation.int
Gets the minimal number of successful operations for any part of this store operation.boolean
isDone()
Checks if the underlying store result is completed or not.void
This method is called in its own thread to handle the given exception.void
onResult
(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:StorageStoreResultHandler
This method is called in its own thread to handle the result of a store operation.- Specified by:
onResult
in interfaceStorageStoreResultHandler
- Parameters:
serializable
- The serializable that was stored in the network.successfulOperations
- The number of successful insert operations (replications).
-
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.
-
isDone
public boolean isDone()Checks if the underlying store result is completed or not.- Returns:
- Returns
true
if 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
null
if there is none.
-