Package org.jgroups.protocols
Class CENTRAL_LOCK2
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.Locking
-
- org.jgroups.protocols.CENTRAL_LOCK2
-
- All Implemented Interfaces:
Lifecycle
@Deprecated public class CENTRAL_LOCK2 extends Locking
Deprecated.See http://belaban.blogspot.com/2020/11/i-hate-distributed-locks.html.Implementation of a locking protocol which acquires locks by asking the coordinator.
Because the coordinator maintains all locks, no total ordering of requests is required.
CENTRAL_LOCK2 has all members send lock and unlock requests to the current coordinator. The coordinator has a queue for incoming requests, and grants locks based on order of arrival.
Contrary toCENTRAL_LOCK, CENTRAL_LOCK2 has no members who act as backups for lock information. Instead, when the coord leaves or on a merge, the new coordinator runs a reconciliation protocol in which it fetches information from all members about acquired locks and pending lock and unlock requests, and then creates its lock table accordingly. During this phase, all regular request handling is paused.
This protocol requires less traffic thanCENTRAL_LOCK(each request also has to be sent to the backup(s)), but introduces communication between the new coord and all members (and thus a small pause) on coord change.
The JIRA issue is https://issues.redhat.com/browse/JGRP-2249.- Since:
- 4.0.13
- Author:
- Bela Ban
- See Also:
Locking,CENTRAL_LOCK
-
-
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
Fields Modifier and Type Field Description protected AddresscoordDeprecated.protected ResponseCollector<Locking.LockInfoResponse>lock_info_responsesDeprecated.protected longlock_reconciliation_timeoutDeprecated.protected Runnerreq_handlerDeprecated.protected java.util.concurrent.BlockingQueue<Locking.Request>req_queueDeprecated.-
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, view
-
Fields 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 Constructor Description CENTRAL_LOCK2()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Locking.LockInfoResponsecreateLockInfoResponse()Deprecated.java.lang.StringgetCoordinator()Deprecated.protected OwnergetOwner()Deprecated.protected voidhandleLockInfoRequest(Address requester)Deprecated.protected voidhandleLockInfoResponse(Address sender, Locking.Request rsp)Deprecated.protected voidhandleLockRevoked(Locking.Request rsp)Deprecated.voidhandleView(View v)Deprecated.booleanisCoord()Deprecated.booleanisRequestHandlerRunning()Deprecated.protected voidprocessQueue()Deprecated.intrequestQueueSize()Deprecated.protected voidrequestReceived(Locking.Request req)Deprecated.voidrunReconciliation()Deprecated.Grabs information about locks held and pending lock/unlock requests from all membersprotected voidsendAwaitConditionRequest(java.lang.String lock_name, Owner owner)Deprecated.protected voidsendDeleteAwaitConditionRequest(java.lang.String lock_name, Owner owner)Deprecated.protected voidsendGrantLockRequest(java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)Deprecated.protected voidsendLockInfoRequestTo(Locking.Request req, Address[] mbrs, Address exclude)Deprecated.protected voidsendReleaseLockRequest(java.lang.String lock_name, int lock_id, Owner owner)Deprecated.protected voidsendSignalConditionRequest(java.lang.String lock_name, boolean all)Deprecated.voidstop()Deprecated.Called on aJChannel.disconnect(); stops work (e.g.-
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, handleLockReleasedResponse, handleLockRequest, handleRequest, handleSignalRequest, handleSignalResponse, init, notifyAwaited, notifyAwaiting, notifyLockCreated, notifyLockDeleted, notifyLocked, notifyLockRevoked, notifyUnlocked, printLocks, printServerLocks, removeLockListener, send, sendLockResponse, sendRequest, sendRequest, sendSignalResponse, setLockStripingSize, unlockAll, unlockForce, up, up, useThreadIdForLockOwner, useThreadIdForLockOwner
-
Methods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, 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, toString, up
-
-
-
-
Field Detail
-
lock_reconciliation_timeout
protected long lock_reconciliation_timeout
Deprecated.
-
coord
protected Address coord
Deprecated.
-
lock_info_responses
protected final ResponseCollector<Locking.LockInfoResponse> lock_info_responses
Deprecated.
-
req_queue
protected final java.util.concurrent.BlockingQueue<Locking.Request> req_queue
Deprecated.
-
req_handler
protected final Runner req_handler
Deprecated.
-
-
Method Detail
-
isCoord
public boolean isCoord()
Deprecated.
-
getCoordinator
public java.lang.String getCoordinator()
Deprecated.
-
isRequestHandlerRunning
public boolean isRequestHandlerRunning()
Deprecated.
-
requestQueueSize
public int requestQueueSize()
Deprecated.
-
stop
public void stop()
Deprecated.Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom.
-
handleView
public void handleView(View v)
Deprecated.- Overrides:
handleViewin classLocking
-
requestReceived
protected void requestReceived(Locking.Request req)
Deprecated.- Overrides:
requestReceivedin classLocking
-
processQueue
protected void processQueue()
Deprecated.
-
handleLockInfoRequest
protected void handleLockInfoRequest(Address requester)
Deprecated.- Overrides:
handleLockInfoRequestin classLocking
-
handleLockInfoResponse
protected void handleLockInfoResponse(Address sender, Locking.Request rsp)
Deprecated.- Overrides:
handleLockInfoResponsein classLocking
-
handleLockRevoked
protected void handleLockRevoked(Locking.Request rsp)
Deprecated.- Overrides:
handleLockRevokedin classLocking
-
runReconciliation
public void runReconciliation()
Deprecated.Grabs information about locks held and pending lock/unlock requests from all members
-
sendLockInfoRequestTo
protected void sendLockInfoRequestTo(Locking.Request req, Address[] mbrs, Address exclude)
Deprecated.
-
sendGrantLockRequest
protected void sendGrantLockRequest(java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)Deprecated.- Specified by:
sendGrantLockRequestin classLocking
-
sendReleaseLockRequest
protected void sendReleaseLockRequest(java.lang.String lock_name, int lock_id, Owner owner)Deprecated.- Specified by:
sendReleaseLockRequestin classLocking
-
sendAwaitConditionRequest
protected void sendAwaitConditionRequest(java.lang.String lock_name, Owner owner)Deprecated.- Specified by:
sendAwaitConditionRequestin classLocking
-
sendSignalConditionRequest
protected void sendSignalConditionRequest(java.lang.String lock_name, boolean all)Deprecated.- Specified by:
sendSignalConditionRequestin classLocking
-
sendDeleteAwaitConditionRequest
protected void sendDeleteAwaitConditionRequest(java.lang.String lock_name, Owner owner)Deprecated.- Specified by:
sendDeleteAwaitConditionRequestin classLocking
-
createLockInfoResponse
protected Locking.LockInfoResponse createLockInfoResponse()
Deprecated.
-
-