public class JobMonitorApp
extends java.lang.Object
The application listens on JobRegistry events and resubmits jobs for which
an event has been emitted because the job is unhealthy. The monitored
applications must be registered with an ApplicationService
prior to submission, otherwise the monitor application cannot restart
them.
The monitoring application must be submitted within a context which provides the following services:
ApplicationServiceMXBean
control
registered by this service is used to resubmit failed applications.ApplicationServiceMXBean
control, which is then used for
restarting failed applications.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APP_NAME
Job monitoring application name.
|
Constructor and Description |
---|
JobMonitorApp(TopologyProvider provider,
DirectSubmitter<Topology,Job> submitter,
java.lang.String name)
Constructs a
JobMonitorApp with the specified name in the
context of the specified provider. |
Modifier and Type | Method and Description |
---|---|
static void |
closeJob(java.lang.String jobName,
ControlService controlService)
Closes a job using a
JobMXBean control registered with the
specified ControlService . |
protected Topology |
declareTopology(java.lang.String name)
Declares the following topology:
|
static void |
declareTopology(Topology t)
Populates the following topology:
|
Job |
submit()
Submits the application topology.
|
static void |
submitApplication(java.lang.String applicationName,
ControlService controlService)
Submits an application using an
ApplicationServiceMXBean control
registered with the specified ControlService . |
public static final java.lang.String APP_NAME
public JobMonitorApp(TopologyProvider provider, DirectSubmitter<Topology,Job> submitter, java.lang.String name)
JobMonitorApp
with the specified name in the
context of the specified provider.provider
- the topology providersubmitter
- a DirectSubmitter
which provides required
services and submits the applicationname
- the application namejava.lang.IllegalArgumentException
- if the submitter does not provide
access to the required servicespublic Job submit() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
java.lang.InterruptedException
- if the operation was interruptedjava.util.concurrent.ExecutionException
- on task execution exceptionpublic static void submitApplication(java.lang.String applicationName, ControlService controlService)
ApplicationServiceMXBean
control
registered with the specified ControlService
.applicationName
- the name of the application to submitcontrolService
- the control servicepublic static void closeJob(java.lang.String jobName, ControlService controlService)
JobMXBean
control registered with the
specified ControlService
.jobName
- the name of the jobcontrolService
- the control serviceprotected Topology declareTopology(java.lang.String name)
JobEvents source --> Filter (health == unhealthy) --> Restart application
name
- the topology namepublic static void declareTopology(Topology t)
JobEvents source --> Filter (health == unhealthy) --> Restart application
t
- TopologyCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641