Package org.jgroups.protocols
Class Locking
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Locking
- Direct Known Subclasses:
CENTRAL_LOCK,PEER_LOCK
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classstatic classprotected static classprotected classprotected classServer side queue for handling of lock requests (lock, release).protected static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final Map<String, Map<Owner, Locking.ClientLock>> protected Addressprotected final Set<LockNotification> protected final ConcurrentMap<String, Locking.ServerLock> protected View -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLockListener(LockNotification listener) protected Locking.ClientLockcreateLock(String lock_name) An event is to be sent down the stack.booleanprotected Locking.ClientLockprotected Locking.ClientLockprotected Locking.ClientLockprotected OwnergetOwner()getView()protected voidhandleAwaitRequest(String lock_name, Owner owner) protected voidhandleCreateAwaitingRequest(String lock_name, Owner owner) protected voidhandleCreateLockRequest(String lock_name, Owner owner) protected voidhandleDeleteAwaitingRequest(String lock_name, Owner owner) protected voidhandleDeleteAwaitRequest(String lock_name, Owner owner) protected voidhandleDeleteLockRequest(String lock_name) protected voidhandleLockDeniedResponse(String lock_name, Owner owner) protected voidhandleLockGrantedResponse(String lock_name, Owner owner, Address sender) protected voidprotected voidprotected voidhandleSignalResponse(String lock_name, Owner owner) protected voidhandleView(View view) protected voidnotifyAwaited(String lock_name, Owner owner) protected voidnotifyAwaiting(String lock_name, Owner owner) protected voidnotifyLockCreated(String lock_name) protected voidnotifyLockDeleted(String lock_name) protected voidnotifyLocked(String lock_name, Owner owner) protected voidnotifyUnlocked(String lock_name, Owner owner) protected voidremoveClientLock(String lock_name, Owner owner) voidremoveLockListener(LockNotification listener) protected abstract voidsendAwaitConditionRequest(String lock_name, Owner owner) protected abstract voidsendDeleteAwaitConditionRequest(String lock_name, Owner owner) protected abstract voidsendGrantLockRequest(String lock_name, Owner owner, long timeout, boolean is_trylock) protected voidsendLockResponse(Locking.Type type, Owner dest, String lock_name) protected abstract voidsendReleaseLockRequest(String lock_name, Owner owner) protected voidsendRequest(Address dest, Locking.Type type, String lock_name, Owner owner, long timeout, boolean is_trylock) protected abstract voidsendSignalConditionRequest(String lock_name, boolean all) protected voidsendSignalResponse(Owner dest, String lock_name) voidsetBypassBundling(boolean bypass_bundling) voidAn event was received from the layer below.Methods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, init, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled, stop, upThreadEnabled
-
Field Details
-
bypass_bundling
protected boolean bypass_bundling -
local_addr
-
view
-
server_locks
-
client_locks
-
lock_listeners
-
-
Constructor Details
-
Locking
public Locking()
-
-
Method Details
-
getBypassBundling
public boolean getBypassBundling() -
setBypassBundling
public void setBypassBundling(boolean bypass_bundling) -
addLockListener
-
removeLockListener
-
getAddress
-
getView
-
down
Description copied from class:ProtocolAn event is to be sent down the stack. The layer 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 layer may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_prot.down(). In case of a GET_ADDRESS event (which tries to retrieve the stack's address from one of the bottom layers), the layer may need to send a new response event back up the stack usingup_prot.up(). -
up
Description copied from class:ProtocolAn event was received from the layer below. Usually the current layer 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(). -
getLock
-
getLock
-
unlockAll
public void unlockAll() -
printLocks
-
handleView
-
createLock
-
getOwner
-
sendGrantLockRequest
-
sendReleaseLockRequest
-
sendAwaitConditionRequest
-
sendSignalConditionRequest
-
sendDeleteAwaitConditionRequest
-
sendRequest
protected void sendRequest(Address dest, Locking.Type type, String lock_name, Owner owner, long timeout, boolean is_trylock) -
sendLockResponse
-
sendSignalResponse
-
handleLockRequest
-
handleLockGrantedResponse
-
handleLockDeniedResponse
-
handleAwaitRequest
-
handleDeleteAwaitRequest
-
handleSignalResponse
-
handleSignalRequest
-
handleCreateLockRequest
-
handleDeleteLockRequest
-
handleCreateAwaitingRequest
-
handleDeleteAwaitingRequest
-
getLock
-
removeClientLock
-
notifyLockCreated
-
notifyLockDeleted
-
notifyLocked
-
notifyUnlocked
-
notifyAwaiting
-
notifyAwaited
-