public abstract class LockingSagaRepository<T> extends Object implements SagaRepository<T>
| Modifier | Constructor and Description |
|---|---|
protected |
LockingSagaRepository(LockFactory lockFactory)
Initializes a saga repository that locks access to a saga while the saga is being operated on.
|
| Modifier and Type | Method and Description |
|---|---|
Saga<T> |
createInstance(String sagaIdentifier,
Supplier<T> factoryMethod)
Creates a new Saga instance.
|
protected abstract Saga<T> |
doCreateInstance(String sagaIdentifier,
Supplier<T> factoryMethod)
Creates a new Saga instance.
|
protected abstract Saga<T> |
doLoad(String sagaIdentifier)
Loads a known Saga instance by its unique identifier.
|
Saga<T> |
load(String sagaIdentifier)
Loads a known Saga instance by its unique identifier.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindprotected LockingSagaRepository(LockFactory lockFactory)
lockFactory - the factory of locks used by this repositorypublic Saga<T> load(String sagaIdentifier)
null in case a Saga doesn't
exists, as opposed to throwing an exception.
This implementation locks access to sagas with the given sagaIdentifier and releases the lock in the
clean-up phase of the current UnitOfWork.
load in interface SagaRepository<T>sagaIdentifier - The unique identifier of the Saga to loadnull if no such saga existspublic Saga<T> createInstance(String sagaIdentifier, Supplier<T> factoryMethod)
factoryMethod.
This implementation locks access to sagas with the given sagaIdentifier and releases the lock in the
clean-up phase of the current UnitOfWork.
createInstance in interface SagaRepository<T>sagaIdentifier - the identifier to use for the new saga instancefactoryMethod - Used to create a new Saga delegateTprotected abstract Saga<T> doLoad(String sagaIdentifier)
null in case a Saga doesn't
exists, as opposed to throwing an exception.sagaIdentifier - The unique identifier of the Saga to loadnull if no such saga existsprotected abstract Saga<T> doCreateInstance(String sagaIdentifier, Supplier<T> factoryMethod)
factoryMethod.sagaIdentifier - the identifier to use for the new saga instancefactoryMethod - Used to create a new Saga delegateTCopyright © 2010–2018. All rights reserved.