public class CommandProcessor extends Object implements Startable, org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
Constructor and Description |
---|
CommandProcessor(org.apache.curator.framework.CuratorFramework client,
ClusterPaths clusterPaths)
Constructor of CommandProcessor.
|
Modifier and Type | Method and Description |
---|---|
void |
childEvent(org.apache.curator.framework.CuratorFramework client,
org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event) |
(package private) org.apache.curator.framework.recipes.cache.ChildData |
getArchivedCommand(int version)
Get the command corresponding to a specific command version.
|
(package private) org.apache.curator.framework.recipes.cache.ChildData |
getCommand(int version)
Get the command corresponding to a specific command version.
|
(package private) Map<Integer,org.apache.curator.framework.recipes.cache.ChildData> |
getCommands(int from,
int to)
Fetches the commands from a given zookeeper cluster version to another.
|
String |
getCommandsZNodePath() |
(package private) int |
getCommandVersion() |
(package private) void |
retryCommand(int commandVersion)
Retries a given command.
|
(package private) void |
setCommandVersion(int commandVersion)
Since zookeeper ZNode's CVersion(Child version) are 1-based and the sequential path sequence numbers are 0-based,
there's always a difference of 1 unit between the
|
void |
start() |
void |
stop() |
public CommandProcessor(org.apache.curator.framework.CuratorFramework client, ClusterPaths clusterPaths)
PathChildrenCache
instance to be used throughout the lifetime
of the command processor to get the events related to commands ZNodes. The PathChildrenCache
will use
a single thread to process events in this implementation.client
- CuratorFramework
instance being used by the cluster managerclusterPaths
- ClusterPaths
instance used by the cluster managerpublic void childEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event) throws Exception
childEvent
in interface org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
Exception
Map<Integer,org.apache.curator.framework.recipes.cache.ChildData> getCommands(int from, int to)
from
- starting version numberto
- ending version numberorg.apache.curator.framework.recipes.cache.ChildData getCommand(int version) throws Exception
version
- CVersion (child version) of the expected commandException
- zookeeper errorsorg.apache.curator.framework.recipes.cache.ChildData getArchivedCommand(int version) throws Exception
version
- CVersion (child version) of the expected commandException
- zookeeper errorsvoid retryCommand(int commandVersion)
commandVersion
- command version to be retriedCuratorClusterManager.retryCommand(int)
void setCommandVersion(int commandVersion)
commands/currentnode's CVersion and the CommandProcessor's
commandVersion
commandVersion
- the command version to be set.public String getCommandsZNodePath()
int getCommandVersion()
setCommandVersion(int)
Copyright © 2016–2019 AdroitLogic. All rights reserved.