@InterfaceAudience.Private public class ZKProcedureCoordinator extends Object implements ProcedureCoordinatorRpcs
ProcedureCoordinatorRpcs
for a ProcedureCoordinator
Modifier and Type | Field and Description |
---|---|
protected ProcedureCoordinator |
coordinator |
(package private) String |
coordName |
private static org.slf4j.Logger |
LOG |
(package private) String |
procedureType |
(package private) ZKWatcher |
watcher |
private ZKProcedureUtil |
zkProc |
Constructor and Description |
---|
ZKProcedureCoordinator(ZKWatcher watcher,
String procedureClass,
String coordName) |
Modifier and Type | Method and Description |
---|---|
protected void |
abort(String abortNode)
Receive a notification and propagate it to the local coordinator
|
void |
close() |
(package private) ZKProcedureUtil |
getZkProcedureUtil()
Used in testing
|
void |
resetMembers(Procedure proc)
Delete znodes that are no longer in use.
|
void |
sendAbortToMembers(Procedure proc,
ForeignException ee)
This is the abort message being sent by the coordinator to member TODO this code isn't actually
used but can be used to issue a cancellation from the coordinator.
|
void |
sendGlobalBarrierAcquire(Procedure proc,
byte[] info,
List<String> nodeNames)
The "acquire" phase.
|
void |
sendGlobalBarrierReached(Procedure proc,
List<String> nodeNames)
Notify members that all members have acquired their parts of the barrier and that they can now
execute under the global barrier.
|
boolean |
start(ProcedureCoordinator coordinator)
Start monitoring znodes in ZK - subclass hook to start monitoring znodes they are about.
|
private static final org.slf4j.Logger LOG
private ZKProcedureUtil zkProc
protected ProcedureCoordinator coordinator
String procedureType
public ZKProcedureCoordinator(ZKWatcher watcher, String procedureClass, String coordName)
watcher
- zookeeper watcher. Owned by this and closed via close()
procedureClass
- procedure type name is a category for when there are multiple kinds of
procedures.-- this becomes a znode so be aware of the naming restrictionscoordName
- name of the node running the coordinatororg.apache.zookeeper.KeeperException
- if an unexpected zk error occurspublic final void sendGlobalBarrierAcquire(Procedure proc, byte[] info, List<String> nodeNames) throws IOException, IllegalArgumentException
sendGlobalBarrierAcquire
in interface ProcedureCoordinatorRpcs
proc
- the Procedureinfo
- data to be stored in the acquire nodenodeNames
- children of the acquire phaseIOException
- if any failure occurs.IllegalArgumentException
- if the procedure was already marked as failedpublic void sendGlobalBarrierReached(Procedure proc, List<String> nodeNames) throws IOException
ProcedureCoordinatorRpcs
ProcedureCoordinatorRpcs.sendGlobalBarrierAcquire(Procedure, byte[], List)
sendGlobalBarrierReached
in interface ProcedureCoordinatorRpcs
proc
- name of the procedure to startnodeNames
- members to tell we have reached in-barrier phaseIOException
- if we can't reach the remote notification mechanismpublic final void resetMembers(Procedure proc) throws IOException
resetMembers
in interface ProcedureCoordinatorRpcs
proc
- name of the procedure to resetIOException
- if the remote notification mechanism cannot be reachedpublic final boolean start(ProcedureCoordinator coordinator)
start
in interface ProcedureCoordinatorRpcs
public final void sendAbortToMembers(Procedure proc, ForeignException ee)
sendAbortToMembers
in interface ProcedureCoordinatorRpcs
proc
- name of the procedure that was abortedee
- the reason why the procedure needs to be abortedprotected void abort(String abortNode)
abortNode
- full znode path to the failed procedure informationpublic final void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
final ZKProcedureUtil getZkProcedureUtil()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.