public abstract class Locking extends Protocol
LockService
is placed on a channel. LockService talks to a subclass of Locking
via events.CENTRAL_LOCK
限定符和类型 | 类和说明 |
---|---|
protected class |
Locking.ClientCondition |
protected class |
Locking.ClientLock
Implementation of
Lock . |
protected class |
Locking.ClientLockTable
Manages access to client locks
|
static class |
Locking.LockingHeader |
protected static class |
Locking.Request |
protected static class |
Locking.Response
A response to a request, to be sent back to the requester as a message
|
protected class |
Locking.ServerCondition |
protected class |
Locking.ServerLock
Server side queue for handling of lock requests (lock, release).
|
protected static class |
Locking.Type |
限定符和类型 | 字段和说明 |
---|---|
protected boolean |
bypass_bundling |
protected Locking.ClientLockTable |
client_lock_table |
protected static java.util.concurrent.atomic.AtomicInteger |
current_lock_id |
protected Address |
local_addr |
protected java.util.Set<LockNotification> |
lock_listeners |
protected java.util.concurrent.locks.Lock[] |
lock_stripes |
protected int |
lock_striping_size |
protected java.util.concurrent.ConcurrentMap<java.lang.String,Locking.ServerLock> |
server_locks |
protected View |
view |
构造器和说明 |
---|
Locking() |
限定符和类型 | 方法和说明 |
---|---|
protected java.util.concurrent.locks.Lock |
_getLock(java.lang.String lock_name)
Gets a lock from locks based on the hash of the lock name
|
void |
addLockListener(LockNotification listener) |
protected Locking.ClientLock |
createLock(java.lang.String lock_name,
Owner owner) |
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
java.lang.String |
getAddress() |
boolean |
getBypassBundling() |
protected Locking.ClientLock |
getLock(java.lang.String name) |
protected Locking.ClientLock |
getLock(java.lang.String name,
boolean create_if_absent) |
protected Owner |
getOwner() |
java.lang.String |
getView() |
protected void |
handleAwaitRequest(java.lang.String lock_name,
Owner owner) |
protected void |
handleCreateAwaitingRequest(java.lang.String lock_name,
Owner owner) |
protected void |
handleCreateLockRequest(java.lang.String lock_name,
Owner owner) |
protected void |
handleDeleteAwaitingRequest(java.lang.String lock_name,
Owner owner) |
protected void |
handleDeleteAwaitRequest(java.lang.String lock_name,
Owner owner) |
protected void |
handleDeleteLockRequest(java.lang.String lock_name) |
protected void |
handleLockDeniedResponse(java.lang.String lock_name,
int lock_id,
Owner owner) |
protected void |
handleLockGrantedResponse(java.lang.String lock_name,
int lock_id,
Owner owner) |
protected void |
handleLockRequest(Locking.Request req) |
protected void |
handleSignalRequest(Locking.Request req) |
protected void |
handleSignalResponse(java.lang.String lock_name,
Owner owner) |
protected void |
handleView(View view) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
protected void |
notifyAwaited(java.lang.String lock_name,
Owner owner) |
protected void |
notifyAwaiting(java.lang.String lock_name,
Owner owner) |
protected void |
notifyLockCreated(java.lang.String lock_name) |
protected void |
notifyLockDeleted(java.lang.String lock_name) |
protected void |
notifyLocked(java.lang.String lock_name,
Owner owner) |
protected void |
notifyUnlocked(java.lang.String lock_name,
Owner owner) |
java.lang.String |
printLocks() |
void |
removeLockListener(LockNotification listener) |
protected void |
send(Address dest,
Locking.Request req) |
protected abstract void |
sendAwaitConditionRequest(java.lang.String lock_name,
Owner owner) |
protected abstract void |
sendDeleteAwaitConditionRequest(java.lang.String lock_name,
Owner owner) |
protected abstract void |
sendGrantLockRequest(java.lang.String lock_name,
int lock_id,
Owner owner,
long timeout,
boolean is_trylock) |
protected void |
sendLockResponse(Locking.Type type,
Owner dest,
java.lang.String lock_name,
int lock_id) |
protected abstract void |
sendReleaseLockRequest(java.lang.String lock_name,
Owner owner) |
protected void |
sendRequest(Address dest,
Locking.Type type,
java.lang.String lock_name,
int lock_id,
Owner owner,
long timeout,
boolean is_trylock) |
protected void |
sendRequest(Address dest,
Locking.Type type,
java.lang.String lock_name,
Owner owner,
long timeout,
boolean is_trylock) |
protected abstract void |
sendSignalConditionRequest(java.lang.String lock_name,
boolean all) |
protected void |
sendSignalResponse(Owner dest,
java.lang.String lock_name) |
void |
setBypassBundling(boolean bypass_bundling) |
void |
unlockAll() |
java.lang.Object |
up(Event evt)
An event was received from the layer below.
|
accept, destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled, stop, up
protected boolean bypass_bundling
protected int lock_striping_size
protected Address local_addr
protected View view
protected final java.util.concurrent.ConcurrentMap<java.lang.String,Locking.ServerLock> server_locks
protected java.util.concurrent.locks.Lock[] lock_stripes
protected final Locking.ClientLockTable client_lock_table
protected final java.util.Set<LockNotification> lock_listeners
protected static final java.util.concurrent.atomic.AtomicInteger current_lock_id
public boolean getBypassBundling()
public void setBypassBundling(boolean bypass_bundling)
public void addLockListener(LockNotification listener)
public void removeLockListener(LockNotification listener)
public java.lang.String getAddress()
public java.lang.String getView()
public void init() throws java.lang.Exception
Protocol
public java.lang.Object down(Event evt)
Protocol
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()
.public java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.protected Locking.ClientLock getLock(java.lang.String name)
protected Locking.ClientLock getLock(java.lang.String name, boolean create_if_absent)
public void unlockAll()
public java.lang.String printLocks()
protected void handleView(View view)
protected Locking.ClientLock createLock(java.lang.String lock_name, Owner owner)
protected java.util.concurrent.locks.Lock _getLock(java.lang.String lock_name)
protected Owner getOwner()
protected abstract void sendGrantLockRequest(java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)
protected abstract void sendReleaseLockRequest(java.lang.String lock_name, Owner owner)
protected abstract void sendAwaitConditionRequest(java.lang.String lock_name, Owner owner)
protected abstract void sendSignalConditionRequest(java.lang.String lock_name, boolean all)
protected abstract void sendDeleteAwaitConditionRequest(java.lang.String lock_name, Owner owner)
protected void sendRequest(Address dest, Locking.Type type, java.lang.String lock_name, Owner owner, long timeout, boolean is_trylock)
protected void sendRequest(Address dest, Locking.Type type, java.lang.String lock_name, int lock_id, Owner owner, long timeout, boolean is_trylock)
protected void sendLockResponse(Locking.Type type, Owner dest, java.lang.String lock_name, int lock_id)
protected void sendSignalResponse(Owner dest, java.lang.String lock_name)
protected void send(Address dest, Locking.Request req)
protected void handleLockRequest(Locking.Request req)
protected void handleLockGrantedResponse(java.lang.String lock_name, int lock_id, Owner owner)
protected void handleLockDeniedResponse(java.lang.String lock_name, int lock_id, Owner owner)
protected void handleAwaitRequest(java.lang.String lock_name, Owner owner)
protected void handleDeleteAwaitRequest(java.lang.String lock_name, Owner owner)
protected void handleSignalResponse(java.lang.String lock_name, Owner owner)
protected void handleSignalRequest(Locking.Request req)
protected void handleCreateLockRequest(java.lang.String lock_name, Owner owner)
protected void handleDeleteLockRequest(java.lang.String lock_name)
protected void handleCreateAwaitingRequest(java.lang.String lock_name, Owner owner)
protected void handleDeleteAwaitingRequest(java.lang.String lock_name, Owner owner)
protected void notifyLockCreated(java.lang.String lock_name)
protected void notifyLockDeleted(java.lang.String lock_name)
protected void notifyLocked(java.lang.String lock_name, Owner owner)
protected void notifyUnlocked(java.lang.String lock_name, Owner owner)
protected void notifyAwaiting(java.lang.String lock_name, Owner owner)
protected void notifyAwaited(java.lang.String lock_name, Owner owner)