public class InitializationProtector extends Object
| Constructor and Description |
|---|
InitializationProtector() |
| Modifier and Type | Method and Description |
|---|---|
void |
protect(Object protectedKey,
IgniteThrowableRunner initializationCode)
It method allows to avoid simultaneous initialization from various threads.
|
<T> T |
protect(Object protectedKey,
Supplier<T> initializedVal,
IgniteThrowableRunner initializationCode) |
public <T> T protect(Object protectedKey, Supplier<T> initializedVal, IgniteThrowableRunner initializationCode) throws IgniteCheckedException
T - Type of initialization value.protectedKey - Unique value by which initialization code should be run only one time.initializedVal - Supplier for given already initialized value if it exist or null as sign that
initialization required.initializationCode - Code for initialization value corresponding protectedKey. Should be idempotent.IgniteCheckedException - if initialization was failed.public void protect(Object protectedKey, IgniteThrowableRunner initializationCode) throws IgniteCheckedException
protectedKey - Unique value by which initialization code should be run only from one thread in one time.initializationCode - Code for initialization value corresponding protectedKey. Should be idempotent.IgniteCheckedException - if initialization was failed.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.8.0 Release Date : February 27 2020