Package org.jgroups.protocols
Class Locking
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.Locking
-
- All Implemented Interfaces:
Lifecycle
- Direct Known Subclasses:
CENTRAL_LOCK
,CENTRAL_LOCK2
@Deprecated public abstract class Locking extends Protocol
Deprecated.See http://belaban.blogspot.com/2020/11/i-hate-distributed-locks.html.Base locking protocol, handling most of the protocol communication with other instances. To use distributed locking,LockService
is placed on a channel. LockService talks to a subclass of Locking via events.- Since:
- 2.12
- Author:
- Bela Ban
- See Also:
CENTRAL_LOCK
,CENTRAL_LOCK2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Locking.ClientCondition
Deprecated.protected class
Locking.ClientLock
Deprecated.Implementation ofLock
.protected class
Locking.ClientLockTable
Deprecated.Manages access to client locksprotected static class
Locking.LockInfoResponse
Deprecated.static class
Locking.LockingHeader
Deprecated.static class
Locking.Request
Deprecated.protected static class
Locking.Response
Deprecated.A response to a request, to be sent back to the requester as a messageprotected class
Locking.ServerCondition
Deprecated.protected class
Locking.ServerLock
Deprecated.Server side queue for handling of lock requests (lock, release).static class
Locking.Type
Deprecated.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
bypass_bundling
Deprecated.protected Locking.ClientLockTable
client_lock_table
Deprecated.protected static java.util.concurrent.atomic.AtomicInteger
current_lock_id
Deprecated.protected java.util.Set<LockNotification>
lock_listeners
Deprecated.protected java.util.concurrent.locks.Lock[]
lock_stripes
Deprecated.protected int
lock_striping_size
Deprecated.protected java.util.concurrent.ConcurrentMap<java.lang.String,Locking.ServerLock>
server_locks
Deprecated.protected boolean
use_thread_id_for_lock_owner
Deprecated.protected View
view
Deprecated.-
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 Locking()
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.util.concurrent.locks.Lock
_getLock(java.lang.String lock_name)
Deprecated.Gets a lock from locks based on the hash of the lock namevoid
addLockListener(LockNotification listener)
Deprecated.boolean
bypassBundling()
Deprecated.Locking
bypassBundling(boolean b)
Deprecated.protected Locking.ClientLock
createLock(java.lang.String lock_name, Owner owner)
Deprecated.java.lang.Object
down(Event evt)
Deprecated.An event is to be sent down the stack.protected Locking.ClientLock
getLock(java.lang.String name)
Deprecated.protected Locking.ClientLock
getLock(java.lang.String name, boolean create_if_absent)
Deprecated.int
getLockStripingSize()
Deprecated.int
getNumClientLocks()
Deprecated.int
getNumServerLocks()
Deprecated.protected Owner
getOwner()
Deprecated.java.lang.String
getView()
Deprecated.protected void
handleAwaitRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected void
handleCreateAwaitingRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected void
handleCreateLockRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected void
handleDeleteAwaitingRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected void
handleDeleteAwaitRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected void
handleDeleteLockRequest(java.lang.String lock_name)
Deprecated.protected void
handleLockDeniedResponse(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.protected void
handleLockGrantedResponse(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.protected void
handleLockInfoRequest(Address requester)
Deprecated.protected void
handleLockInfoResponse(Address sender, Locking.Request rsp)
Deprecated.protected void
handleLockReleasedResponse(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.protected void
handleLockRequest(Locking.Request req)
Deprecated.protected void
handleLockRevoked(Locking.Request rsp)
Deprecated.protected void
handleRequest(Locking.Request req)
Deprecated.protected void
handleSignalRequest(Locking.Request req)
Deprecated.protected void
handleSignalResponse(java.lang.String lock_name, Owner owner)
Deprecated.protected void
handleView(View view)
Deprecated.void
init()
Deprecated.Called after a protocol has been created and before the protocol is started.protected void
notifyAwaited(java.lang.String lock_name, Owner owner)
Deprecated.protected void
notifyAwaiting(java.lang.String lock_name, Owner owner)
Deprecated.protected void
notifyLockCreated(java.lang.String lock_name)
Deprecated.protected void
notifyLockDeleted(java.lang.String lock_name)
Deprecated.protected void
notifyLocked(java.lang.String lock_name, Owner owner)
Deprecated.protected void
notifyLockRevoked(java.lang.String lock_name, Owner current_owner)
Deprecated.protected void
notifyUnlocked(java.lang.String lock_name, Owner owner)
Deprecated.java.lang.String
printLocks()
Deprecated.java.lang.Object
printServerLocks()
Deprecated.void
removeLockListener(LockNotification listener)
Deprecated.protected void
requestReceived(Locking.Request req)
Deprecated.protected void
send(Address dest, Locking.Request req)
Deprecated.protected abstract void
sendAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected abstract void
sendDeleteAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.protected abstract void
sendGrantLockRequest(java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)
Deprecated.protected void
sendLockResponse(Locking.Type type, Owner dest, java.lang.String lock_name, int lock_id)
Deprecated.protected abstract void
sendReleaseLockRequest(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.protected void
sendRequest(Address dest, Locking.Type type, java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)
Deprecated.protected void
sendRequest(Address dest, Locking.Type type, java.lang.String lock_name, Owner owner, long timeout, boolean is_trylock)
Deprecated.protected abstract void
sendSignalConditionRequest(java.lang.String lock_name, boolean all)
Deprecated.protected void
sendSignalResponse(Owner dest, java.lang.String lock_name)
Deprecated.Locking
setLockStripingSize(int l)
Deprecated.void
unlockAll()
Deprecated.void
unlockForce(java.lang.String lock_name)
Deprecated.java.lang.Object
up(Event evt)
Deprecated.An event was received from the protocol below.java.lang.Object
up(Message msg)
Deprecated.A single message was received.boolean
useThreadIdForLockOwner()
Deprecated.Locking
useThreadIdForLockOwner(boolean u)
Deprecated.-
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, stop, toString, up
-
-
-
-
Field Detail
-
bypass_bundling
protected boolean bypass_bundling
Deprecated.
-
lock_striping_size
protected int lock_striping_size
Deprecated.
-
use_thread_id_for_lock_owner
protected boolean use_thread_id_for_lock_owner
Deprecated.
-
view
protected View view
Deprecated.
-
server_locks
protected final java.util.concurrent.ConcurrentMap<java.lang.String,Locking.ServerLock> server_locks
Deprecated.
-
lock_stripes
protected java.util.concurrent.locks.Lock[] lock_stripes
Deprecated.
-
client_lock_table
protected final Locking.ClientLockTable client_lock_table
Deprecated.
-
lock_listeners
protected final java.util.Set<LockNotification> lock_listeners
Deprecated.
-
current_lock_id
protected static final java.util.concurrent.atomic.AtomicInteger current_lock_id
Deprecated.
-
-
Method Detail
-
bypassBundling
public boolean bypassBundling()
Deprecated.
-
bypassBundling
public Locking bypassBundling(boolean b)
Deprecated.
-
getLockStripingSize
public int getLockStripingSize()
Deprecated.
-
setLockStripingSize
public Locking setLockStripingSize(int l)
Deprecated.
-
useThreadIdForLockOwner
public boolean useThreadIdForLockOwner()
Deprecated.
-
useThreadIdForLockOwner
public Locking useThreadIdForLockOwner(boolean u)
Deprecated.
-
addLockListener
public void addLockListener(LockNotification listener)
Deprecated.
-
removeLockListener
public void removeLockListener(LockNotification listener)
Deprecated.
-
getView
public java.lang.String getView()
Deprecated.
-
getNumServerLocks
public int getNumServerLocks()
Deprecated.
-
getNumClientLocks
public int getNumClientLocks()
Deprecated.
-
init
public void init() throws java.lang.Exception
Deprecated.Description copied from class:Protocol
Called after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
-
down
public java.lang.Object down(Event evt)
Deprecated.Description copied from class:Protocol
An event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_prot.down()
.
-
up
public java.lang.Object up(Event evt)
Deprecated.Description copied from class:Protocol
An event was received from the protocol below. Usually the current protocol will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally, the event is either a) discarded, or b) an event is sent down the stack usingdown_prot.down()
or c) the event (or another event) is sent up the stack usingup_prot.up()
.
-
up
public java.lang.Object up(Message msg)
Deprecated.Description copied from class:Protocol
A single message was received. Protocols may examine the message and do something (e.g. add a header) with it before passing it up.
-
requestReceived
protected void requestReceived(Locking.Request req)
Deprecated.
-
handleRequest
protected void handleRequest(Locking.Request req)
Deprecated.
-
getLock
protected Locking.ClientLock getLock(java.lang.String name)
Deprecated.
-
getLock
protected Locking.ClientLock getLock(java.lang.String name, boolean create_if_absent)
Deprecated.
-
unlockAll
public void unlockAll()
Deprecated.
-
unlockForce
public void unlockForce(java.lang.String lock_name)
Deprecated.
-
printLocks
public java.lang.String printLocks()
Deprecated.
-
printServerLocks
public java.lang.Object printServerLocks()
Deprecated.
-
handleView
protected void handleView(View view)
Deprecated.
-
createLock
protected Locking.ClientLock createLock(java.lang.String lock_name, Owner owner)
Deprecated.
-
_getLock
protected java.util.concurrent.locks.Lock _getLock(java.lang.String lock_name)
Deprecated.Gets a lock from locks based on the hash of the lock name
-
getOwner
protected Owner getOwner()
Deprecated.
-
sendGrantLockRequest
protected abstract void sendGrantLockRequest(java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)
Deprecated.
-
sendReleaseLockRequest
protected abstract void sendReleaseLockRequest(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.
-
sendAwaitConditionRequest
protected abstract void sendAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.
-
sendSignalConditionRequest
protected abstract void sendSignalConditionRequest(java.lang.String lock_name, boolean all)
Deprecated.
-
sendDeleteAwaitConditionRequest
protected abstract void sendDeleteAwaitConditionRequest(java.lang.String lock_name, Owner owner)
Deprecated.
-
sendRequest
protected void sendRequest(Address dest, Locking.Type type, java.lang.String lock_name, Owner owner, long timeout, boolean is_trylock)
Deprecated.
-
sendRequest
protected void sendRequest(Address dest, Locking.Type type, java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)
Deprecated.
-
sendLockResponse
protected void sendLockResponse(Locking.Type type, Owner dest, java.lang.String lock_name, int lock_id)
Deprecated.
-
sendSignalResponse
protected void sendSignalResponse(Owner dest, java.lang.String lock_name)
Deprecated.
-
send
protected void send(Address dest, Locking.Request req)
Deprecated.
-
handleLockRequest
protected void handleLockRequest(Locking.Request req)
Deprecated.
-
handleLockGrantedResponse
protected void handleLockGrantedResponse(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.
-
handleLockReleasedResponse
protected void handleLockReleasedResponse(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.
-
handleLockDeniedResponse
protected void handleLockDeniedResponse(java.lang.String lock_name, int lock_id, Owner owner)
Deprecated.
-
handleLockInfoRequest
protected void handleLockInfoRequest(Address requester)
Deprecated.
-
handleLockInfoResponse
protected void handleLockInfoResponse(Address sender, Locking.Request rsp)
Deprecated.
-
handleLockRevoked
protected void handleLockRevoked(Locking.Request rsp)
Deprecated.
-
handleAwaitRequest
protected void handleAwaitRequest(java.lang.String lock_name, Owner owner)
Deprecated.
-
handleDeleteAwaitRequest
protected void handleDeleteAwaitRequest(java.lang.String lock_name, Owner owner)
Deprecated.
-
handleSignalResponse
protected void handleSignalResponse(java.lang.String lock_name, Owner owner)
Deprecated.
-
handleSignalRequest
protected void handleSignalRequest(Locking.Request req)
Deprecated.
-
handleCreateLockRequest
protected void handleCreateLockRequest(java.lang.String lock_name, Owner owner)
Deprecated.
-
handleDeleteLockRequest
protected void handleDeleteLockRequest(java.lang.String lock_name)
Deprecated.
-
handleCreateAwaitingRequest
protected void handleCreateAwaitingRequest(java.lang.String lock_name, Owner owner)
Deprecated.
-
handleDeleteAwaitingRequest
protected void handleDeleteAwaitingRequest(java.lang.String lock_name, Owner owner)
Deprecated.
-
notifyLockCreated
protected void notifyLockCreated(java.lang.String lock_name)
Deprecated.
-
notifyLockDeleted
protected void notifyLockDeleted(java.lang.String lock_name)
Deprecated.
-
notifyLockRevoked
protected void notifyLockRevoked(java.lang.String lock_name, Owner current_owner)
Deprecated.
-
notifyLocked
protected void notifyLocked(java.lang.String lock_name, Owner owner)
Deprecated.
-
notifyUnlocked
protected void notifyUnlocked(java.lang.String lock_name, Owner owner)
Deprecated.
-
notifyAwaiting
protected void notifyAwaiting(java.lang.String lock_name, Owner owner)
Deprecated.
-
notifyAwaited
protected void notifyAwaited(java.lang.String lock_name, Owner owner)
Deprecated.
-
-