public class CENTRAL_LOCK extends Locking implements LockNotification
CENTRAL_LOCK has all members send lock and unlock requests to a central coordinator. The coordinator has a queue for incoming requests, and grants locks based on order of arrival. To prevent all acquired locks from being forgotten when the coordinator crashes, setting num_backups lets the coordinator backup lock information to a number of backup nodes. Valid values for num_backups are 0 (no backup) to N-1, e.g. in a cluster of 4, we can have only 3 backup nodes.
Say we have a cluster of {A,B,C,D,E} and num_backups=1. A is the coordinator, and A updates all locks (and released locks) in B as well. When A crashes, everybody falls over to B for sending lock and unlock requests. B in turn copies all existing locks over to C and - when locks are acquired or released - forwards this information to C as well. An alternative is also thePEER_LOCK protocol.Locking.ClientCondition, Locking.ClientLock, Locking.LockingHeader, Locking.Request, Locking.ServerCondition, Locking.ServerLock, Locking.Type| Modifier and Type | Field and Description |
|---|---|
protected List<Address> |
backups |
protected Address |
coord |
protected boolean |
is_coord |
protected int |
num_backups |
bypass_bundling, client_locks, local_addr, lock_listeners, server_locks, view| Constructor and Description |
|---|
CENTRAL_LOCK() |
| Modifier and Type | Method and Description |
|---|---|
void |
awaited(String lock_name,
Owner owner) |
void |
awaiting(String lock_name,
Owner owner) |
protected void |
copyLocksTo(List<Address> new_joiners) |
String |
getBackups() |
Address |
getCoord() |
String |
getCoordinator() |
int |
getNumberOfBackups() |
void |
handleView(View view) |
boolean |
isCoord() |
void |
lockCreated(String name) |
void |
lockDeleted(String name) |
void |
locked(String lock_name,
Owner owner) |
protected void |
sendAwaitConditionRequest(String lock_name,
Owner owner) |
protected void |
sendCreateLockRequest(Address dest,
String lock_name,
Owner owner) |
protected void |
sendDeleteAwaitConditionRequest(String lock_name,
Owner owner) |
protected void |
sendDeleteLockRequest(Address dest,
String lock_name) |
protected void |
sendGrantLockRequest(String lock_name,
Owner owner,
long timeout,
boolean is_trylock) |
protected void |
sendReleaseLockRequest(String lock_name,
Owner owner) |
protected void |
sendSignalConditionRequest(String lock_name,
boolean all) |
void |
setNumberOfBackups(int num_backups) |
void |
unlocked(String lock_name,
Owner owner) |
protected void |
updateBackups(Locking.Type type,
String lock_name,
Owner owner) |
addLockListener, createLock, down, getAddress, getBypassBundling, getLock, getLock, getLock, getOwner, getView, handleAwaitRequest, handleCreateAwaitingRequest, handleCreateLockRequest, handleDeleteAwaitingRequest, handleDeleteAwaitRequest, handleDeleteLockRequest, handleLockDeniedResponse, handleLockGrantedResponse, handleLockRequest, handleSignalRequest, handleSignalResponse, notifyAwaited, notifyAwaiting, notifyLockCreated, notifyLockDeleted, notifyLocked, notifyUnlocked, printLocks, removeClientLock, removeLockListener, sendLockResponse, sendRequest, sendSignalResponse, setBypassBundling, unlockAll, updestroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, init, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled, stopprotected int num_backups
protected Address coord
protected boolean is_coord
public Address getCoord()
public boolean isCoord()
public String getCoordinator()
public int getNumberOfBackups()
public void setNumberOfBackups(int num_backups)
public String getBackups()
protected void sendGrantLockRequest(String lock_name, Owner owner, long timeout, boolean is_trylock)
sendGrantLockRequest in class Lockingprotected void sendReleaseLockRequest(String lock_name, Owner owner)
sendReleaseLockRequest in class Lockingprotected void sendCreateLockRequest(Address dest, String lock_name, Owner owner)
protected void sendAwaitConditionRequest(String lock_name, Owner owner)
sendAwaitConditionRequest in class Lockingprotected void sendSignalConditionRequest(String lock_name, boolean all)
sendSignalConditionRequest in class Lockingprotected void sendDeleteAwaitConditionRequest(String lock_name, Owner owner)
sendDeleteAwaitConditionRequest in class Lockingpublic void handleView(View view)
handleView in class Lockingpublic void lockCreated(String name)
lockCreated in interface LockNotificationpublic void lockDeleted(String name)
lockDeleted in interface LockNotificationpublic void locked(String lock_name, Owner owner)
locked in interface LockNotificationpublic void unlocked(String lock_name, Owner owner)
unlocked in interface LockNotificationpublic void awaiting(String lock_name, Owner owner)
awaiting in interface LockNotificationpublic void awaited(String lock_name, Owner owner)
awaited in interface LockNotificationprotected void updateBackups(Locking.Type type, String lock_name, Owner owner)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.