Class CENTRAL_LOCK
- All Implemented Interfaces:
LockNotification,Lifecycle
Because the coordinator maintains all locks, no total order configuration is required.
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.
- Since:
- 2.12
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.Locking
Locking.ClientCondition, Locking.ClientLock, Locking.ClientLockTable, Locking.LockInfoResponse, Locking.LockingHeader, Locking.Request, Locking.Response, Locking.ServerCondition, Locking.ServerLock, Locking.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.protected AddressDeprecated.protected booleanDeprecated.protected intDeprecated.Fields inherited from class org.jgroups.protocols.Locking
bypass_bundling, client_lock_table, current_lock_id, lock_listeners, lock_stripes, lock_striping_size, server_locks, use_thread_id_for_lock_owner, viewFields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.voidDeprecated.protected voidcopyLocksTo(List<Address> new_joiners) Deprecated.Deprecated.getCoord()Deprecated.Deprecated.intDeprecated.protected OwnergetOwner()Deprecated.voidhandleView(View view) Deprecated.booleanisCoord()Deprecated.voidlockCreated(String name) Deprecated.voidlockDeleted(String name) Deprecated.voidDeprecated.voidlockRevoked(String lock_name, Owner current_owner) Deprecated.protected voidsendAwaitConditionRequest(String lock_name, Owner owner) Deprecated.protected voidsendCreateLockRequest(Address dest, String lock_name, Owner owner) Deprecated.protected voidsendDeleteAwaitConditionRequest(String lock_name, Owner owner) Deprecated.protected voidsendDeleteLockRequest(Address dest, String lock_name) Deprecated.protected voidsendGrantLockRequest(String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock) Deprecated.protected voidsendReleaseLockRequest(String lock_name, int lock_id, Owner owner) Deprecated.protected voidsendSignalConditionRequest(String lock_name, boolean all) Deprecated.setNumberOfBackups(int num_backups) Deprecated.voidDeprecated.protected voidupdateBackups(Locking.Type type, String lock_name, Owner owner) Deprecated.Methods inherited from class org.jgroups.protocols.Locking
_getLock, addLockListener, bypassBundling, bypassBundling, createLock, down, getLock, getLock, getLockStripingSize, getNumClientLocks, getNumServerLocks, getView, handleAwaitRequest, handleCreateAwaitingRequest, handleCreateLockRequest, handleDeleteAwaitingRequest, handleDeleteAwaitRequest, handleDeleteLockRequest, handleLockDeniedResponse, handleLockGrantedResponse, handleLockInfoRequest, handleLockInfoResponse, handleLockReleasedResponse, handleLockRequest, handleLockRevoked, handleRequest, handleSignalRequest, handleSignalResponse, init, notifyAwaited, notifyAwaiting, notifyLockCreated, notifyLockDeleted, notifyLocked, notifyLockRevoked, notifyUnlocked, printLocks, printServerLocks, removeLockListener, requestReceived, send, sendLockResponse, sendRequest, sendRequest, sendSignalResponse, setLockStripingSize, unlockAll, unlockForce, up, up, useThreadIdForLockOwner, useThreadIdForLockOwnerMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, start, statsEnabled, stop, toString, up
-
Field Details
-
num_backups
protected int num_backupsDeprecated. -
coord
Deprecated. -
is_coord
protected boolean is_coordDeprecated. -
backups
Deprecated.
-
-
Constructor Details
-
CENTRAL_LOCK
public CENTRAL_LOCK()Deprecated.
-
-
Method Details
-
getOwner
Deprecated. -
getCoord
Deprecated. -
isCoord
public boolean isCoord()Deprecated. -
getCoordinator
Deprecated. -
getNumberOfBackups
public int getNumberOfBackups()Deprecated. -
setNumberOfBackups
Deprecated. -
getBackups
Deprecated. -
sendGrantLockRequest
protected void sendGrantLockRequest(String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock) Deprecated.- Specified by:
sendGrantLockRequestin classLocking
-
sendReleaseLockRequest
Deprecated.- Specified by:
sendReleaseLockRequestin classLocking
-
sendCreateLockRequest
Deprecated. -
sendDeleteLockRequest
Deprecated. -
sendAwaitConditionRequest
Deprecated.- Specified by:
sendAwaitConditionRequestin classLocking
-
sendSignalConditionRequest
Deprecated.- Specified by:
sendSignalConditionRequestin classLocking
-
sendDeleteAwaitConditionRequest
Deprecated.- Specified by:
sendDeleteAwaitConditionRequestin classLocking
-
handleView
Deprecated.- Overrides:
handleViewin classLocking
-
lockCreated
Deprecated.- Specified by:
lockCreatedin interfaceLockNotification
-
lockDeleted
Deprecated.- Specified by:
lockDeletedin interfaceLockNotification
-
locked
Deprecated.- Specified by:
lockedin interfaceLockNotification
-
unlocked
Deprecated.- Specified by:
unlockedin interfaceLockNotification
-
lockRevoked
Deprecated.- Specified by:
lockRevokedin interfaceLockNotification
-
awaiting
Deprecated.- Specified by:
awaitingin interfaceLockNotification
-
awaited
Deprecated.- Specified by:
awaitedin interfaceLockNotification
-
updateBackups
Deprecated. -
copyLocksTo
Deprecated.
-