public abstract class AbstractZKServiceController extends AbstractExecutionServiceController
ServiceController using ZooKeeper as a means for
communicating with the remote service. This is designed to work in pair with the AbstractTwillService.ServiceController.TerminationStatus| Modifier | Constructor and Description |
|---|---|
protected |
AbstractZKServiceController(RunId runId,
ZKClient zkClient) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
doShutDown()
Called during shutdown.
|
protected abstract void |
doStartUp()
Called during startup.
|
protected void |
forceShutDown() |
protected String |
getInstancePath()
Returns the zookeeper node path for the ephemeral instance node for this runId.
|
protected com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State> |
getStopMessageFuture() |
protected abstract void |
instanceNodeFailed(Throwable cause)
Called when failed to fetch from live instance node.
|
protected abstract void |
instanceNodeUpdated(NodeData nodeData)
Called when an update on the live instance node is detected.
|
com.google.common.util.concurrent.ListenableFuture<Command> |
sendCommand(Command command)
Sends a user command to the running application.
|
com.google.common.util.concurrent.ListenableFuture<Command> |
sendCommand(String runnableName,
Command command)
Sends a user command to the given runnable of the running application.
|
protected <V> com.google.common.util.concurrent.ListenableFuture<V> |
sendMessage(org.apache.twill.internal.state.Message message,
V result)
Sends a
Message to the remote service. |
protected void |
shutDown() |
protected void |
startUp() |
protected void |
watchInstanceNode() |
addListener, awaitTerminated, awaitTerminated, executor, getRunId, getTerminationStatus, isRunning, onRunning, onTerminated, setTerminationStatus, start, startAndWait, state, stop, stopAndWait, terminateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitkillprotected final ZKClient zkClient
public final com.google.common.util.concurrent.ListenableFuture<Command> sendCommand(Command command)
ServiceControllercommand - The command to send.Future that will be completed when the command is successfully processed
by the target application.public final com.google.common.util.concurrent.ListenableFuture<Command> sendCommand(String runnableName, Command command)
ServiceControllerrunnableName - Name of the TwillRunnable.command - The command to send.Future that will be completed when the command is successfully processed
by the target runnable.protected final void startUp()
startUp in class AbstractExecutionServiceControllerprotected final void shutDown()
shutDown in class AbstractExecutionServiceControllerprotected final <V> com.google.common.util.concurrent.ListenableFuture<V> sendMessage(org.apache.twill.internal.state.Message message,
V result)
Message to the remote service. Returns a future that will be completed when the message
has been processed.V - Type of the result.message - The message to send.result - Object to set into the future when message is being processed.ListenableFuture that will be completed when the message has been processed.protected final com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State> getStopMessageFuture()
protected abstract void doStartUp()
protected abstract void doShutDown()
protected abstract void instanceNodeUpdated(NodeData nodeData)
nodeData - The updated live instance node data or null if there is an error when fetching
the node data.protected abstract void instanceNodeFailed(Throwable cause)
cause - The cause of failure of null if cause is unknown.protected void forceShutDown()
protected final void watchInstanceNode()
protected final String getInstancePath()
Copyright © 2013-2020 The Apache Software Foundation. All rights reserved.