Class Locking

java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Locking
Direct Known Subclasses:
CENTRAL_LOCK, PEER_LOCK

public abstract class Locking extends Protocol
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:
  • Field Details

  • Constructor Details

    • Locking

      public Locking()
  • Method Details

    • getBypassBundling

      public boolean getBypassBundling()
    • setBypassBundling

      public void setBypassBundling(boolean bypass_bundling)
    • addLockListener

      public void addLockListener(LockNotification listener)
    • removeLockListener

      public void removeLockListener(LockNotification listener)
    • getAddress

      public String getAddress()
    • getView

      public String getView()
    • down

      public Object down(Event evt)
      Description copied from class: Protocol
      An 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 using down_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 using up_prot.up().
      Overrides:
      down in class Protocol
    • up

      public Object up(Event evt)
      Description copied from class: Protocol
      An 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 using down_prot.down() or c) the event (or another event) is sent up the stack using up_prot.up().
      Overrides:
      up in class Protocol
    • getLock

      protected Locking.ClientLock getLock(String name)
    • getLock

      protected Locking.ClientLock getLock(String name, boolean create_if_absent)
    • unlockAll

      public void unlockAll()
    • printLocks

      public String printLocks()
    • handleView

      protected void handleView(View view)
    • createLock

      protected Locking.ClientLock createLock(String lock_name)
    • getOwner

      protected Owner getOwner()
    • sendGrantLockRequest

      protected abstract void sendGrantLockRequest(String lock_name, Owner owner, long timeout, boolean is_trylock)
    • sendReleaseLockRequest

      protected abstract void sendReleaseLockRequest(String lock_name, Owner owner)
    • sendAwaitConditionRequest

      protected abstract void sendAwaitConditionRequest(String lock_name, Owner owner)
    • sendSignalConditionRequest

      protected abstract void sendSignalConditionRequest(String lock_name, boolean all)
    • sendDeleteAwaitConditionRequest

      protected abstract void sendDeleteAwaitConditionRequest(String lock_name, Owner owner)
    • sendRequest

      protected void sendRequest(Address dest, Locking.Type type, String lock_name, Owner owner, long timeout, boolean is_trylock)
    • sendLockResponse

      protected void sendLockResponse(Locking.Type type, Owner dest, String lock_name)
    • sendSignalResponse

      protected void sendSignalResponse(Owner dest, String lock_name)
    • handleLockRequest

      protected void handleLockRequest(Locking.Request req)
    • handleLockGrantedResponse

      protected void handleLockGrantedResponse(String lock_name, Owner owner, Address sender)
    • handleLockDeniedResponse

      protected void handleLockDeniedResponse(String lock_name, Owner owner)
    • handleAwaitRequest

      protected void handleAwaitRequest(String lock_name, Owner owner)
    • handleDeleteAwaitRequest

      protected void handleDeleteAwaitRequest(String lock_name, Owner owner)
    • handleSignalResponse

      protected void handleSignalResponse(String lock_name, Owner owner)
    • handleSignalRequest

      protected void handleSignalRequest(Locking.Request req)
    • handleCreateLockRequest

      protected void handleCreateLockRequest(String lock_name, Owner owner)
    • handleDeleteLockRequest

      protected void handleDeleteLockRequest(String lock_name)
    • handleCreateAwaitingRequest

      protected void handleCreateAwaitingRequest(String lock_name, Owner owner)
    • handleDeleteAwaitingRequest

      protected void handleDeleteAwaitingRequest(String lock_name, Owner owner)
    • getLock

      protected Locking.ClientLock getLock(String name, Owner owner, boolean create_if_absent)
    • removeClientLock

      protected void removeClientLock(String lock_name, Owner owner)
    • notifyLockCreated

      protected void notifyLockCreated(String lock_name)
    • notifyLockDeleted

      protected void notifyLockDeleted(String lock_name)
    • notifyLocked

      protected void notifyLocked(String lock_name, Owner owner)
    • notifyUnlocked

      protected void notifyUnlocked(String lock_name, Owner owner)
    • notifyAwaiting

      protected void notifyAwaiting(String lock_name, Owner owner)
    • notifyAwaited

      protected void notifyAwaited(String lock_name, Owner owner)