public class DistributedLock extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_RETRY_DELAY |
| Constructor and Description |
|---|
DistributedLock(org.infinispan.AdvancedCache<String,String> locksCache,
String key) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
lock()
Returns true if the cache is local; otherwise, return true if the lock is acquired.
|
void |
lockAndThen(long retryDelay,
Runnable runnable)
Blocks until the lock is acquired and then execute runnable.
|
void |
lockAndThen(Runnable runnable)
Blocks until the lock is acquired and then execute runnable.
|
boolean |
release()
Returns true if the cache is local.
|
void |
viewChanged(org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent event) |
public static final long DEFAULT_RETRY_DELAY
public boolean lock()
release() is called or the owning process goes down. If the owner goes down, the rest of
the cluster will clear the lock such that other cluster members can acquire it.public boolean release()
public void lockAndThen(Runnable runnable)
DEFAULT_RETRY_DELAY ms between successive attempts at acquiring the lock.public void lockAndThen(long retryDelay,
Runnable runnable)
public void viewChanged(org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent event)
Copyright © 2014–2018 Red Hat, Inc.. All rights reserved.