public class ScheduledJobInvocationContext extends Object
A scheduled job's invocation method can take a single argument of this type. If this is the case, the scheduled job's method will be passed an object of this type enabling the job being invoked to be given information about the invocation.
When a job is not marked for concurrent execution, it can store data in the context in the form of key/value properties. These properties will be persisted across invocations of the job. If the job is marked to as clustered, the job data will persist across server restarts as well. Lastly, if the job is marked to run concurrently, the methods for accessing/updating properties will throw an exception.
| Constructor and Description |
|---|
ScheduledJobInvocationContext(ScheduledJobDefinition jobDefinition,
ServerPluginContext pluginContext,
ServerPluginComponent serverPluginComponent) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(String key)
Checks to see whether or not the property key is stored in the context.
|
String |
get(String key)
Retrieves a property value from the context.
|
Map<String,String> |
getJobData()
Returns a read-only view of the properties stored in the context.
|
ScheduledJobDefinition |
getJobDefinition()
The definition of the triggered job that owns this context object.
|
ServerPluginComponent |
getServerPluginComponent()
If the job's plugin has a plugin component defined, this will return the instance of that component.
|
ServerPluginContext |
getServerPluginContext()
General information for the job's plugin.
|
void |
put(String key,
String value)
Adds a property to the context that is persisted across invocations of the job.
|
String |
remove(String key)
Removes the property value associated with the specified key
|
public ScheduledJobInvocationContext(ScheduledJobDefinition jobDefinition, ServerPluginContext pluginContext, ServerPluginComponent serverPluginComponent)
public ScheduledJobDefinition getJobDefinition()
public ServerPluginContext getServerPluginContext()
public ServerPluginComponent getServerPluginComponent()
null if
there is no plugin component for the pluginpublic void put(String key, String value)
key - The property namevalue - The property valueUnsupportedOperationException - if the job is marked for concurrent executionpublic String get(String key)
key - The property keynull if the key is not foundUnsupportedOperationException - if the job is marked for concurrent executionpublic String remove(String key)
key - The property keynull if the key is present in the contextUnsupportedOperationException - if the job is marked for concurrent executionpublic boolean containsKey(String key)
key - The property keytrue if the key is found, false otherwise.UnsupportedOperationException - if the job is marked for concurrent executionpublic Map<String,String> getJobData()
UnsupportedOperationException - if the job is marked for concurrent executionCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.