public final class ObjectStoreRetryUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
retryClose(StoreOutputStream storeOutputStream)
calls StoreOutputStream.close(), retries in case of
IOException . |
static void |
retryCreateStore(ObjectStoreService objectStore,
java.lang.String storeName,
AnyMap storeProperties,
boolean storeExistsException)
Prepares a store and retries on
ServiceUnavailableException . |
static void |
retryEnsureStore(ObjectStoreService objectStore,
java.lang.String storeName)
Ensures that a store exists.
|
static boolean |
retryExistsObject(ObjectStoreService objectStore,
java.lang.String storeName,
java.lang.String objectId)
Checks if an object in a store exists.
|
static boolean |
retryExistsStore(ObjectStoreService objectStore,
java.lang.String storeName)
Checks if a store exists.
|
static byte[] |
retryGetObject(ObjectStoreService objectStore,
java.lang.String storeName,
java.lang.String objectId)
Open a store and gets data to an object.
|
static java.util.Collection<StoreObject> |
retryGetStoreObjectInfos(ObjectStoreService objectStore,
java.lang.String storeName,
java.lang.String objectIdPrefix)
Retries listing object infos from a store.
|
static void |
retryPutObject(ObjectStoreService objectStore,
java.lang.String storeName,
java.lang.String objectId,
byte[] data)
Open a store and puts data to an object.
|
static java.io.InputStream |
retryReadObject(ObjectStoreService objectStore,
java.lang.String storeName,
java.lang.String objectId)
Open a store and open an object for read.
|
static StoreOutputStream |
retryWriteObject(ObjectStoreService objectStore,
java.lang.String storeName,
java.lang.String objectId)
Open a store and open an object for write.
|
public static java.io.InputStream retryReadObject(ObjectStoreService objectStore, java.lang.String storeName, java.lang.String objectId) throws ObjectStoreException
ServiceUnavailableException
.objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeobjectId
- name of object to read.InputStream
to read from the store.ObjectStoreException
- error reading object.public static StoreOutputStream retryWriteObject(ObjectStoreService objectStore, java.lang.String storeName, java.lang.String objectId) throws ObjectStoreException
ServiceUnavailableException
.objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeobjectId
- name of object to read.StoreOutputStream
to the objectObjectStoreException
- error opening object in the ObjectStoreService
.public static void retryPutObject(ObjectStoreService objectStore, java.lang.String storeName, java.lang.String objectId, byte[] data) throws ObjectStoreException
ServiceUnavailableException
.objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeobjectId
- name of object to write.data
- the data to write to the objectObjectStoreException
- error opening object in the ObjectStoreService
.public static byte[] retryGetObject(ObjectStoreService objectStore, java.lang.String storeName, java.lang.String objectId) throws ObjectStoreException
ServiceUnavailableException
.objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeobjectId
- name of object to read.ObjectStoreException
- error opening object in the ObjectStoreService
.public static void retryCreateStore(ObjectStoreService objectStore, java.lang.String storeName, AnyMap storeProperties, boolean storeExistsException) throws ObjectStoreException
ServiceUnavailableException
.objectStore
- ObjectStoreService reference to use.storeName
- the name of the storestoreProperties
- the properties of the storestoreExistsException
- 'true': throw exception if store existsObjectStoreException
- error preparing store (even after retrying if it is an ServiceUnavailableException
).public static void retryEnsureStore(ObjectStoreService objectStore, java.lang.String storeName) throws ObjectStoreException
objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeObjectStoreException
- error preparing store (even after retrying if it is an ServiceUnavailableException
).public static boolean retryExistsStore(ObjectStoreService objectStore, java.lang.String storeName) throws ObjectStoreException
objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeObjectStoreException
- error checking store existence (even after retrying if it is an ServiceUnavailableException
).public static java.util.Collection<StoreObject> retryGetStoreObjectInfos(ObjectStoreService objectStore, java.lang.String storeName, java.lang.String objectIdPrefix) throws ObjectStoreException
objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeobjectIdPrefix
- the prefix for the ids of the objects to list.ObjectStoreException
- error reading info (even after retrying if it is an ServiceUnavailableException
).public static boolean retryExistsObject(ObjectStoreService objectStore, java.lang.String storeName, java.lang.String objectId) throws ObjectStoreException
objectStore
- ObjectStoreService reference to use.storeName
- the name of the storeobjectId
- the id of the objectObjectStoreException
- error checking store existence (even after retrying if it is an ServiceUnavailableException
).public static void retryClose(StoreOutputStream storeOutputStream) throws java.io.IOException
IOException
.java.io.IOException
- could not successfully close StoreOutputStream
even after retrying.