public class DistributedLockManager extends Object implements LockManager, LockCommandContext, Stateful, MembershipListener
Constructor and Description |
---|
DistributedLockManager(DatabaseCluster<Z,D> cluster,
CommandDispatcherFactory dispatcherFactory) |
Modifier and Type | Method and Description |
---|---|
void |
added(Member member)
Indicates that the specified member was added to the group.
|
Lock |
getDistibutedLock(RemoteLockDescriptor descriptor) |
Lock |
getLock(LockDescriptor lock) |
Map<LockDescriptor,Lock> |
getRemoteLocks(Remote remote) |
Lock |
readLock(String id)
Obtains a named read lock.
|
void |
readState(ObjectInput input)
Returns the state of this object.
|
void |
removed(Member member)
Indicates the the specified member was removed from the group.
|
void |
start()
Called upon database cluster start.
|
void |
stop()
Called when database cluster is stopped.
|
Lock |
writeLock(String id)
Obtains a named write lock.
|
void |
writeState(ObjectOutput output)
Sets the state of this object.
|
public DistributedLockManager(DatabaseCluster<Z,D> cluster, CommandDispatcherFactory dispatcherFactory) throws Exception
Exception
public Lock readLock(String id)
readLock
in interface LockManager
id
- an object to lockLockManager.readLock(java.lang.String)
public Lock writeLock(String id)
writeLock
in interface LockManager
id
- an object to lockLockManager.writeLock(java.lang.String)
public Lock getLock(LockDescriptor lock)
getLock
in interface LockCommandContext
LockCommandContext.getLock(net.sf.hajdbc.lock.distributed.LockDescriptor)
public Lock getDistibutedLock(RemoteLockDescriptor descriptor)
getDistibutedLock
in interface LockCommandContext
LockCommandContext.getDistibutedLock(net.sf.hajdbc.lock.distributed.RemoteLockDescriptor)
public void start() throws Exception
start
in interface Lifecycle
Exception
- if this service fails to start.Lifecycle.start()
public void stop()
stop
in interface Lifecycle
Lifecycle.stop()
public Map<LockDescriptor,Lock> getRemoteLocks(Remote remote)
getRemoteLocks
in interface LockCommandContext
LockCommandContext.getRemoteLocks(net.sf.hajdbc.distributed.Remote)
public void writeState(ObjectOutput output) throws IOException
writeState
in interface Stateful
IOException
Stateful.writeState(java.io.ObjectOutput)
public void readState(ObjectInput input) throws IOException
readState
in interface Stateful
IOException
Stateful.readState(java.io.ObjectInput)
public void added(Member member)
added
in interface MembershipListener
member
- the added memberMembershipListener.added(net.sf.hajdbc.distributed.Member)
public void removed(Member member)
removed
in interface MembershipListener
member
- the removed memberMembershipListener.removed(net.sf.hajdbc.distributed.Member)
Copyright © 2004–2014 Paul Ferraro. All rights reserved.