public abstract class AbstractTwillController extends AbstractZKServiceController implements TwillController
TwillController implementation that uses Zookeeper to controller a
running twill application.ServiceController.TerminationStatuszkClient| Constructor and Description |
|---|
AbstractTwillController(String appName,
RunId runId,
ZKClient zkClient,
boolean logCollectionEnabled,
Iterable<LogHandler> logHandlers) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLogHandler(LogHandler handler)
Adds a
LogHandler for receiving application log. |
com.google.common.util.concurrent.ListenableFuture<Integer> |
changeInstances(String runnable,
int newCount)
Changes the number of running instances of a given runnable.
|
ServiceDiscovered |
discoverService(String serviceName)
Discovers the set of
Discoverable endpoints that provides service for the given service name. |
protected void |
doShutDown()
Called during shutdown.
|
protected void |
doStartUp()
Called during startup.
|
protected void |
resetLogHandler()
Reset the log handler to poll from the beginning of Kafka.
|
Future<String[]> |
resetLogLevels(String... loggerNames)
Reset the log levels of all runnables.
|
Future<String[]> |
resetRunnableLogLevels(String runnableName,
String... loggerNames)
Reset the log levels of the given runnable.
|
com.google.common.util.concurrent.ListenableFuture<String> |
restartAllInstances(String runnableName)
Restart all instances of a particular
TwillRunnable. |
com.google.common.util.concurrent.ListenableFuture<Set<String>> |
restartInstances(Map<String,? extends Set<Integer>> runnableToInstanceIds)
Restart instances of some
TwillRunnable. |
com.google.common.util.concurrent.ListenableFuture<String> |
restartInstances(String runnable,
int instanceId,
int... moreInstanceIds)
Restart instances of some
TwillRunnable. |
com.google.common.util.concurrent.ListenableFuture<String> |
restartInstances(String runnable,
Set<Integer> instanceIds)
Restart instances of some
TwillRunnable. |
Future<Map<String,LogEntry.Level>> |
updateLogLevels(Map<String,LogEntry.Level> logLevels)
Update the log levels for requested logger names for Twill applications running in a container.
|
Future<Map<String,LogEntry.Level>> |
updateLogLevels(String runnableName,
Map<String,LogEntry.Level> runnableLogLevels)
Update the log levels for requested logger names for a
TwillRunnable. |
forceShutDown, getInstancePath, getStopMessageFuture, instanceNodeFailed, instanceNodeUpdated, sendCommand, sendCommand, sendMessage, shutDown, startUp, watchInstanceNodeaddListener, awaitTerminated, awaitTerminated, executor, getRunId, getTerminationStatus, isRunning, onRunning, onTerminated, setTerminationStatus, start, startAndWait, state, stop, stopAndWait, terminateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetResourceReportawaitTerminated, awaitTerminated, getRunId, getTerminationStatus, kill, onRunning, onTerminated, sendCommand, sendCommand, terminatepublic AbstractTwillController(String appName, RunId runId, ZKClient zkClient, boolean logCollectionEnabled, Iterable<LogHandler> logHandlers)
protected void doStartUp()
AbstractZKServiceControllerdoStartUp in class AbstractZKServiceControllerprotected void doShutDown()
AbstractZKServiceControllerdoShutDown in class AbstractZKServiceControllerpublic final void addLogHandler(LogHandler handler)
TwillControllerLogHandler for receiving application log.addLogHandler in interface TwillControllerhandler - The handler to add.public final ServiceDiscovered discoverService(String serviceName)
TwillControllerDiscoverable endpoints that provides service for the given service name.discoverService in interface TwillControllerserviceName - Name of the service to discovery.ServiceDiscovered object representing the result.public final com.google.common.util.concurrent.ListenableFuture<Integer> changeInstances(String runnable, int newCount)
TwillControllerchangeInstances in interface TwillControllerrunnable - The name of the runnable.newCount - Number of instances for the given runnable.Future that will be completed when the number running instances has been
successfully changed. The future will carry the new count as the result. If there is any error
while changing instances, it'll be reflected in the future.public final com.google.common.util.concurrent.ListenableFuture<String> restartAllInstances(String runnableName)
TwillControllerTwillRunnable.restartAllInstances in interface TwillControllerrunnableName - The name of the runnable to restart.Future that will be completed when the restart operation has been done.public final com.google.common.util.concurrent.ListenableFuture<Set<String>> restartInstances(Map<String,? extends Set<Integer>> runnableToInstanceIds)
TwillControllerTwillRunnable.restartInstances in interface TwillControllerrunnableToInstanceIds - A map of runnable ID to list of instance IDs to be restarted.Future that will be completed when the restart operation has been done.public com.google.common.util.concurrent.ListenableFuture<String> restartInstances(String runnable, int instanceId, int... moreInstanceIds)
TwillControllerTwillRunnable.restartInstances in interface TwillControllerrunnable - The name of the runnable to restart.instanceId - The main instance id to be restarted.moreInstanceIds - The optional instance ids.Future that will be completed when the restart operation has been done.public com.google.common.util.concurrent.ListenableFuture<String> restartInstances(String runnable, Set<Integer> instanceIds)
TwillControllerTwillRunnable.restartInstances in interface TwillControllerrunnable - The name of the runnable to restart.instanceIds - Instances to be restartedFuture that will be completed when the restart operation has been done.public Future<Map<String,LogEntry.Level>> updateLogLevels(Map<String,LogEntry.Level> logLevels)
TwillControllernull except for the root logger, which will reset the log level for
the specified logger.updateLogLevels in interface TwillControllerlogLevels - The Map contains the requested logger names and log levels that need to be updated.Future that will be completed when the log level update has been done. It will carry the
Map of log levels as the result.public Future<Map<String,LogEntry.Level>> updateLogLevels(String runnableName, Map<String,LogEntry.Level> runnableLogLevels)
TwillControllerTwillRunnable.
The log level for a logger name can be null except for the root logger,
which will reset the log level for
the specified logger.updateLogLevels in interface TwillControllerrunnableName - The name of the runnable to update the log level.runnableLogLevels - The Map contains the requested logger name and log level that
need to be updated.Future that will be completed when the log level update has been done. It will carry the
Map of log levels as the result.public Future<String[]> resetLogLevels(String... loggerNames)
TwillControllerresetLogLevels in interface TwillControllerloggerNames - The optional logger names to be reset for all runnables, if not provided, all log levels will
be reset.Future that will be completed when the set log level operation has been done. The future result
is the logger names provided in the parameter.public Future<String[]> resetRunnableLogLevels(String runnableName, String... loggerNames)
TwillControllerresetRunnableLogLevels in interface TwillControllerloggerNames - The optional logger names to be reset for the runnable, if not provided, all log levels will
be reset.Future that will be completed when the set log level operation has been done. The future result
is the logger names provided in the parameter.protected final void resetLogHandler()
Copyright © 2013-2020 The Apache Software Foundation. All rights reserved.