public abstract class AbstractQuorumClient<S extends Remote> extends Object implements QuorumClient<S>
QuorumClient
s.Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
log |
Modifier | Constructor and Description |
---|---|
protected |
AbstractQuorumClient(String logicalServiceZPath) |
Modifier and Type | Method and Description |
---|---|
void |
disconnected()
The client has become disconnected from the quorum (for zookeeper this is
only generated if the session has expired rather than if there is a
transient disconnect that can be cured).
|
S |
getLeader(long token)
Return the remote interface used to perform HA operations on the quorum
leader.
|
String |
getLogicalServiceZPath()
The fully qualified identifier of the logical service whose quorum state
will be monitored (for zookeeper, this is the logicalServiceZPath).
|
Quorum<?,?> |
getQuorum()
The quorum that is being monitored.
|
abstract S |
getService(UUID serviceId)
Return the remote interface used to perform HA operations on a member of
quorum.
|
void |
notify(QuorumEvent e)
Notify the client of a quorum event.
|
void |
start(Quorum<?,?> quorum)
Life cycle message sent when the client will begin to receive messages
from the
Quorum . |
void |
terminate()
Life cycle message send when the client will no longer receive messages
from the
Quorum . |
protected AbstractQuorumClient(String logicalServiceZPath)
logicalServiceZPath
- the fully qualified logical service identifier (for zookeeper,
this is the logicalServiceZPath).public final String getLogicalServiceZPath()
QuorumClient
Note: The method was renamed from getLogicalServiceId()
to
QuorumClient.getLogicalServiceZPath()
to avoid confusion with the zookeeper
integration which has both a logicalServiceId (just the last component of
the zpath) and a logicalServiceZPath. The Quorum
and
QuorumClient
interfaces only understand a single logical service
identifier - this is what corresponds to the
for the zookeeper integration.
getLogicalServiceZPath
in interface QuorumClient<S extends Remote>
QuorumMember.getServiceId()
public Quorum<?,?> getQuorum()
getQuorum
in interface QuorumClient<S extends Remote>
QuorumClient.start(Quorum)
public void start(Quorum<?,?> quorum)
QuorumClient
Quorum
. At a minimum, the client should save a reference
to the Quorum
.start
in interface QuorumClient<S extends Remote>
quorum
- The quorum.AbstractQuorum.start(QuorumClient)
public void terminate()
QuorumClient
Quorum
.terminate
in interface QuorumClient<S extends Remote>
AbstractQuorum.terminate()
public void disconnected()
The default implementation is a NOP.
disconnected
in interface QuorumClient<S extends Remote>
public S getLeader(long token)
QuorumClient
getLeader
in interface QuorumClient<S extends Remote>
token
- The quorum token for which the request was made.public abstract S getService(UUID serviceId)
QuorumClient
getService
in interface QuorumClient<S extends Remote>
getService
in interface ServiceLookup<S extends Remote>
serviceId
- The UUID
associated with the service.public void notify(QuorumEvent e)
QuorumListener
The listener MUST NOT take any event that could block. In particular, it
MUST NOT wait on another thread that will access the Quorum
as
that will cause a deadlock around the internal lock maintained by the
Quorum
.
notify
in interface QuorumListener
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.