org.rhq.enterprise.server.plugin.pc
Class ConcurrentJobWrapper

java.lang.Object
  extended by org.rhq.enterprise.server.plugin.pc.ConcurrentJobWrapper
All Implemented Interfaces:
org.quartz.Job

public class ConcurrentJobWrapper
extends Object

The actual quartz job that the plugin container will submit when it needs to invoke a concurrent scheduled job on behalf of a plugin. This is a normal non-stateful "job" which tells quartz that it can run multiple jobs concurrently. Note that server plugin developers do not extend this class. Instead, developers have their plugin components or their job class POJOs implement no-arg methods, or methods that take ScheduledJobInvocationContext as a single argument.

Author:
John Mazzitelli

Field Summary
static String DATAMAP_IS_CLUSTERED
          Key to the job data map that indicates if the job is clustered or not.
static String DATAMAP_IS_CONCURRENT
          Key to the job data map that indicates if the job is concurrent or not.
static String DATAMAP_JOB_CLASS
          Key to the job data map that indicates which plugin component class should be instantiated in order to process the job.
static String DATAMAP_JOB_ID
          Key to the job data map that indicates the ID of the job.
static String DATAMAP_JOB_METHOD_NAME
          Key to the job data map that indicates which method on the job class should be invoked to run the job.
static String DATAMAP_PLUGIN_NAME
          Key to the job data map that indicates the plugin that scheduled the job.
static String DATAMAP_PLUGIN_TYPE
          Key to the job data map that indicates the type of plugin that scheduled the job.
static String DATAMAP_SCHEDULE_TRIGGER
          Key to the job data map that indicates how the schedule is triggered.
static String DATAMAP_SCHEDULE_TYPE
          Key to the job data map that indicates what kind of schedule triggered the job
 
Constructor Summary
ConcurrentJobWrapper()
           
 
Method Summary
protected  ScheduledJobInvocationContext createContext(ScheduledJobDefinition jobDefinition, ServerPluginContext pluginContext, ServerPluginComponent serverPluginComponent, Map<String,String> jobData)
           
 void execute(org.quartz.JobExecutionContext context)
          This is the method that quartz calls when the schedule has triggered.
protected  String logMsg(String pluginName, Object pluginType, String jobId, String msg, Throwable t)
           
protected  void throwJobExecutionException(String pluginName, Object pluginType, String jobId, String errorMsg, Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATAMAP_PLUGIN_NAME

public static final String DATAMAP_PLUGIN_NAME
Key to the job data map that indicates the plugin that scheduled the job.

See Also:
Constant Field Values

DATAMAP_PLUGIN_TYPE

public static final String DATAMAP_PLUGIN_TYPE
Key to the job data map that indicates the type of plugin that scheduled the job.

See Also:
Constant Field Values

DATAMAP_JOB_ID

public static final String DATAMAP_JOB_ID
Key to the job data map that indicates the ID of the job. This ID is passed to the plugin container when the job was scheduled, see: AbstractTypeServerPluginContainer#scheduleJob(ScheduledJobDefinition, String)

See Also:
Constant Field Values

DATAMAP_JOB_CLASS

public static final String DATAMAP_JOB_CLASS
Key to the job data map that indicates which plugin component class should be instantiated in order to process the job. If not specified, the main plugin component instance is used.

See Also:
Constant Field Values

DATAMAP_JOB_METHOD_NAME

public static final String DATAMAP_JOB_METHOD_NAME
Key to the job data map that indicates which method on the job class should be invoked to run the job.

See Also:
Constant Field Values

DATAMAP_SCHEDULE_TYPE

public static final String DATAMAP_SCHEDULE_TYPE
Key to the job data map that indicates what kind of schedule triggered the job

See Also:
Constant Field Values

DATAMAP_SCHEDULE_TRIGGER

public static final String DATAMAP_SCHEDULE_TRIGGER
Key to the job data map that indicates how the schedule is triggered. The value of the trigger datamap entry depends on the type of schedule. For example, a cron schedule type has a schedule trigger that is a cron expression. A periodic schedule type has a schedule trigger that is a time period, in milliseconds.

See Also:
Constant Field Values

DATAMAP_IS_CONCURRENT

public static final String DATAMAP_IS_CONCURRENT
Key to the job data map that indicates if the job is concurrent or not. The value does not necessarily mean any currently executing job is concurrently running with another; this just indicates if the job is allowed to run concurrently with another.

See Also:
Constant Field Values

DATAMAP_IS_CLUSTERED

public static final String DATAMAP_IS_CLUSTERED
Key to the job data map that indicates if the job is clustered or not. If this job is clustered, the job may be executing on a machine that did not originally schedule the job.

See Also:
Constant Field Values
Constructor Detail

ConcurrentJobWrapper

public ConcurrentJobWrapper()
Method Detail

createContext

protected ScheduledJobInvocationContext createContext(ScheduledJobDefinition jobDefinition,
                                                      ServerPluginContext pluginContext,
                                                      ServerPluginComponent serverPluginComponent,
                                                      Map<String,String> jobData)

execute

public void execute(org.quartz.JobExecutionContext context)
             throws org.quartz.JobExecutionException
This is the method that quartz calls when the schedule has triggered. This method will delegate to the plugin component that is responsible to do work for the plugin.

Specified by:
execute in interface org.quartz.Job
Throws:
org.quartz.JobExecutionException
See Also:
ScheduledJob#execute(String, Properties)

throwJobExecutionException

protected void throwJobExecutionException(String pluginName,
                                          Object pluginType,
                                          String jobId,
                                          String errorMsg,
                                          Throwable t)
                                   throws org.quartz.JobExecutionException
Throws:
org.quartz.JobExecutionException

logMsg

protected String logMsg(String pluginName,
                        Object pluginType,
                        String jobId,
                        String msg,
                        Throwable t)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.