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 Address
coord
Deprecated.protected ResponseCollector<Locking.LockInfoResponse>
lock_info_responses
Deprecated.protected long
lock_reconciliation_timeout
Deprecated.protected Runner
req_handler
Deprecated.protected java.util.concurrent.BlockingQueue<Locking.Request>
req_queue
Deprecated.-
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.LockInfoResponse
createLockInfoResponse()
Deprecated.java.lang.String
getCoordinator()
Deprecated.protected Owner
getOwner()
Deprecated.protected void
handleLockInfoRequest(Address requester)
Deprecated.protected void
handleLockInfoResponse(Address sender, Locking.Request rsp)
Deprecated.protected void
handleLockRevoked(Locking.Request rsp)
Deprecated.void
handleView(View v)
Deprecated.boolean
isCoord()
Deprecated.boolean
isRequestHandlerRunning()
Deprecated.protected void
processQueue()
Deprecated.int
requestQueueSize()
Deprecated.protected void
requestReceived(Locking.Request req)
Deprecated.void
runReconciliation()
Deprecated.Grabs information about locks held and pending lock/unlock requests from all membersprotected void
sendAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected void
sendDeleteAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected void
sendGrantLockRequest(java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)
Deprecated.protected void
sendLockInfoRequestTo(Locking.Request req, Address[] mbrs, Address exclude)
Deprecated.protected void
sendReleaseLockRequest(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.protected void
sendSignalConditionRequest(java.lang.String lock_name, boolean all)
Deprecated.void
stop()
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:Protocol
Called 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:
handleView
in classLocking
-
requestReceived
protected void requestReceived(Locking.Request req)
Deprecated.- Overrides:
requestReceived
in classLocking
-
processQueue
protected void processQueue()
Deprecated.
-
handleLockInfoRequest
protected void handleLockInfoRequest(Address requester)
Deprecated.- Overrides:
handleLockInfoRequest
in classLocking
-
handleLockInfoResponse
protected void handleLockInfoResponse(Address sender, Locking.Request rsp)
Deprecated.- Overrides:
handleLockInfoResponse
in classLocking
-
handleLockRevoked
protected void handleLockRevoked(Locking.Request rsp)
Deprecated.- Overrides:
handleLockRevoked
in 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:
sendGrantLockRequest
in classLocking
-
sendReleaseLockRequest
protected void sendReleaseLockRequest(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.- Specified by:
sendReleaseLockRequest
in classLocking
-
sendAwaitConditionRequest
protected void sendAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.- Specified by:
sendAwaitConditionRequest
in classLocking
-
sendSignalConditionRequest
protected void sendSignalConditionRequest(java.lang.String lock_name, boolean all)
Deprecated.- Specified by:
sendSignalConditionRequest
in classLocking
-
sendDeleteAwaitConditionRequest
protected void sendDeleteAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.- Specified by:
sendDeleteAwaitConditionRequest
in classLocking
-
createLockInfoResponse
protected Locking.LockInfoResponse createLockInfoResponse()
Deprecated.
-
-