@InterfaceAudience.Private public abstract class ZKProcedureUtil extends ZKListener implements Closeable
Modifier and Type | Field and Description |
---|---|
static String |
ABORT_ZNODE_DEFAULT |
protected String |
abortZnode |
static String |
ACQUIRED_BARRIER_ZNODE_DEFAULT |
protected String |
acquiredZnode |
String |
baseZNode |
static String |
REACHED_BARRIER_ZNODE_DEFAULT |
protected String |
reachedZnode |
watcher
Constructor and Description |
---|
ZKProcedureUtil(ZKWatcher watcher,
String procDescription)
Top-level watcher/controller for procedures across the cluster.
|
Modifier and Type | Method and Description |
---|---|
void |
clearChildZNodes() |
void |
clearZNodes(String procedureName) |
void |
close() |
static String |
getAbortNode(ZKProcedureUtil controller,
String opInstanceName)
Get the full znode path for the node used by the coordinator or member to trigger an abort
of the global barrier acquisition or execution in subprocedures.
|
String |
getAbortZnode() |
String |
getAbortZNode(String opInstanceName) |
static String |
getAcquireBarrierNode(ZKProcedureUtil controller,
String opInstanceName)
Get the full znode path for the node used by the coordinator to trigger a global barrier
acquire on each subprocedure.
|
String |
getAcquiredBarrier() |
String |
getAcquiredBarrierNode(String opInstanceName) |
String |
getBaseZnode() |
String |
getReachedBarrierNode(String opInstanceName) |
static String |
getReachedBarrierNode(ZKProcedureUtil controller,
String opInstanceName)
Get the full znode path for the node used by the coordinator to trigger a global barrier
execution and release on each subprocedure.
|
ZKWatcher |
getWatcher() |
boolean |
isAbortPathNode(String path)
Is this in the procedure barrier abort znode path
|
protected void |
logZKTree(String root,
String prefix)
Helper method to print the current state of the ZK tree.
|
nodeChildrenChanged, nodeCreated, nodeDataChanged, nodeDeleted
public static final String ACQUIRED_BARRIER_ZNODE_DEFAULT
public static final String REACHED_BARRIER_ZNODE_DEFAULT
public static final String ABORT_ZNODE_DEFAULT
public final String baseZNode
protected final String acquiredZnode
protected final String reachedZnode
protected final String abortZnode
public ZKProcedureUtil(ZKWatcher watcher, String procDescription) throws org.apache.zookeeper.KeeperException
On instantiation, this ensures the procedure znodes exist. This however requires the passed in watcher has been started.
watcher
- watcher for the cluster ZK. Owned by this and closed via
close()
procDescription
- name of the znode describing the procedure to runorg.apache.zookeeper.KeeperException
- when the procedure znodes cannot be createdpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public String getAbortZnode()
public String getBaseZnode()
public String getAcquiredBarrier()
public static String getAcquireBarrierNode(ZKProcedureUtil controller, String opInstanceName)
controller
- controller running the procedureopInstanceName
- name of the running procedure instance (not the procedure description).public static String getReachedBarrierNode(ZKProcedureUtil controller, String opInstanceName)
controller
- controller running the procedureopInstanceName
- name of the running procedure instance (not the procedure description).public static String getAbortNode(ZKProcedureUtil controller, String opInstanceName)
controller
- controller running the procedureopInstanceName
- name of the running procedure instance (not the procedure description).public ZKWatcher getWatcher()
getWatcher
in class ZKListener
public boolean isAbortPathNode(String path)
protected void logZKTree(String root, String prefix) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
- if an unexpected exception occurslogZKTree(String)
public void clearChildZNodes() throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
public void clearZNodes(String procedureName) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
Copyright © 2007–2019 Cloudera. All rights reserved.