com.amazon.carbonado.spi
Class BelatedStorageCreator<S extends Storable>
java.lang.Object
com.amazon.carbonado.util.BelatedCreator<Storage<S>,SupportException>
com.amazon.carbonado.spi.BelatedStorageCreator<S>
public class BelatedStorageCreator<S extends Storable>
- extends BelatedCreator<Storage<S>,SupportException>
Generic one-shot Storage creator which supports late object creation. If
getting the Storage results in an exception or is taking too long, the
Storage produced instead is a bogus one. Many operations result in an
IllegalStateException. After retrying, if the real Storage is accessed, then
the bogus Storage turns into a wrapper to the real Storage.
- Author:
- Brian S O'Neill
- See Also:
BelatedRepositoryCreator
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BelatedStorageCreator
public BelatedStorageCreator(org.apache.commons.logging.Log log,
Repository repo,
Class<S> storableType,
int minRetryDelayMillis)
- Parameters:
log - error reporting logrepo - Repository to get Storage fromstorableType - type of Storable to get Storage forminRetryDelayMillis - minimum milliseconds to wait before retrying
to create object after failure; if negative, never retry
createReal
protected Storage<S> createReal()
throws SupportException
- Description copied from class:
BelatedCreator
- Create instance of real object. If there is a recoverable error creating
the object, return null. Any error logging must be performed by the
implementation of this method. If null is returned, expect this method
to be called again in the future.
- Specified by:
createReal in class BelatedCreator<Storage<S extends Storable>,SupportException>
- Returns:
- real object, or null if there was a recoverable error
- Throws:
SupportException
createBogus
protected Storage<S> createBogus()
- Description copied from class:
BelatedCreator
- Create instance of bogus object.
- Specified by:
createBogus in class BelatedCreator<Storage<S extends Storable>,SupportException>
timedOutNotification
protected void timedOutNotification(long timedOutMillis)
- Description copied from class:
BelatedCreator
- Notification that createReal is taking too long. This can be used to log
a message.
- Specified by:
timedOutNotification in class BelatedCreator<Storage<S extends Storable>,SupportException>
- Parameters:
timedOutMillis - milliseconds waited before giving up
Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.