|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.backends.task.Task
public abstract class Task
This class defines a task that may be executed by the task backend within the Directory Server.
Constructor Summary | |
---|---|
Task()
|
Method Summary | |
---|---|
void |
addLogMessage(Message message)
Adds a log message to the set of messages logged by this task. |
int |
compareTo(Task task)
Compares this task with the provided task for the purposes of ordering in a sorted list. |
TaskState |
execute()
Begins execution for this task. |
long |
getActualStartTime()
Retrieves the time that this task actually started running, if it has started. |
Message |
getAttributeDisplayName(java.lang.String name)
Given an attribute type name returns and locale sensitive representation. |
long |
getCompletionTime()
Retrieves the time that this task completed all of its associated processing (regardless of whether it was successful), if it has completed. |
java.util.LinkedList<java.lang.String> |
getDependencyIDs()
Retrieves the set of task IDs for any tasks on which this task is dependent. |
Message |
getDisplayName()
Gets a message that identifies this type of task suitable for presentation to humans in monitoring tools. |
FailedDependencyAction |
getFailedDependencyAction()
Retrieves the action that should be taken if any of the dependencies for this task do not complete successfully. |
protected TaskState |
getFinalTaskState()
Returns a state for this task after processing has completed. |
java.util.List<Message> |
getLogMessages()
Retrieves the set of messages that were logged by this task. |
java.util.LinkedList<java.lang.String> |
getNotifyOnCompletionAddresses()
Retrieves the set of e-mail addresses for the users that should receive a notification message when processing for this task has completed. |
java.util.LinkedList<java.lang.String> |
getNotifyOnErrorAddresses()
Retrieves the set of e-mail addresses for the users that should receive a notification message if processing for this task does not complete successfully. |
Operation |
getOperation()
Retrieves the operation used to create this task in the server. |
java.lang.String |
getRecurringTaskID()
Retrieves the unique identifier assigned to the recurring task that is associated with this task, if there is one. |
long |
getScheduledStartTime()
Retrieves the scheduled start time for this task, if there is one. |
Entry |
getTaskEntry()
Retrieves the entry containing the definition for this task. |
DN |
getTaskEntryDN()
Retrieves the DN of the entry containing the definition for this task. |
java.lang.String |
getTaskID()
Retrieves the unique identifier assigned to this task. |
protected TaskState |
getTaskInterruptState()
Gets the interrupt state for this task that was set as a result of a call to interruptTask(TaskState,
org.opends.messages.Message) . |
TaskState |
getTaskState()
Retrieves the current state for this task. |
void |
initializeTask()
Performs any task-specific initialization that may be required before processing can start. |
void |
initializeTaskInternal(TaskScheduler taskScheduler,
Entry taskEntry)
Performs generic initialization for this task based on the information in the provided task entry. |
void |
interruptTask(TaskState interruptState,
Message interruptReason)
Performs any necessary processing to prematurely interrupt the execution of this task. |
boolean |
isCancelled()
Indicates whether or not this task has been cancelled. |
boolean |
isInterruptable()
Indicates whether or not this task is interruptable or not. |
protected void |
logError(Message message)
Writes a message to the error log using the provided information. |
protected void |
replaceAttributeValue(java.lang.String name,
java.lang.String value)
Replaces an attribute values of the task entry. |
protected abstract TaskState |
runTask()
Performs the actual core processing for this task. |
void |
setOperation(Operation operation)
Specifies the operation used to create this task in the server. |
protected void |
setTaskInterruptState(TaskState state)
Sets a state for this task that is the result of a call to interruptTask(TaskState, org.opends.messages.Message) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Task()
Method Detail |
---|
public Message getDisplayName()
public Message getAttributeDisplayName(java.lang.String name)
name
- of an attribute type associated with the object
class that represents this entry in the directory
public final void initializeTaskInternal(TaskScheduler taskScheduler, Entry taskEntry) throws InitializationException
taskScheduler
- The scheduler with which this task is associated.taskEntry
- The entry containing the task configuration.
InitializationException
- If a problem occurs while performing the
initialization.public final DN getTaskEntryDN()
public final Entry getTaskEntry()
public final Operation getOperation()
initializeTask
method (and even that method should not depend on it always being
available, since it will not be available if the server is restarted and
the task needs to be reinitialized).
null
if it is not available.public final void setOperation(Operation operation)
operation
- The operation used to create this task in the server.public final java.lang.String getTaskID()
public final java.lang.String getRecurringTaskID()
null
if it is not
associated with any recurring task.public final TaskState getTaskState()
public boolean isCancelled()
protected void setTaskInterruptState(TaskState state)
interruptTask(TaskState, org.opends.messages.Message)
.
It may take this task some time to actually cancel to that
actual state may differ until quiescence.
state
- for this task once it has canceled whatever it is doingprotected TaskState getTaskInterruptState()
interruptTask(TaskState,
org.opends.messages.Message)
.
protected TaskState getFinalTaskState()
interruptTask(TaskState, org.opends.messages.Message)
then that method's interruptState is returned here. Otherwse
this method returns TaskState.COMPLETED_SUCCESSFULLY. It is
assumed that if there were errors during task processing that
task state will have been derived in some other way.
protected void replaceAttributeValue(java.lang.String name, java.lang.String value) throws DirectoryException
name
- The name of the attribute that must be replaced.value
- The value that must replace the previous values of the
attribute.
DirectoryException
- When an error occurs.public final long getScheduledStartTime()
System.currentTimeMillis()
. Any value representing a time in
the past, or any negative value, should be taken to mean that the task
should be considered eligible for immediate execution.
public final long getActualStartTime()
System.currentTimeMillis()
.
public final long getCompletionTime()
System.currentTimeMillis()
.
public final java.util.LinkedList<java.lang.String> getDependencyIDs()
public final FailedDependencyAction getFailedDependencyAction()
public final java.util.LinkedList<java.lang.String> getNotifyOnCompletionAddresses()
public final java.util.LinkedList<java.lang.String> getNotifyOnErrorAddresses()
public final java.util.List<Message> getLogMessages()
protected void logError(Message message)
org.opends.server.loggers.Error
to ensure the
messages are included in the ds-task-log-message attribute.
message
- The message to be logged.public void addLogMessage(Message message)
ErrorLog.logError
methods. It does not
automatically persist the updated task information to disk.
message
- he log messagepublic final int compareTo(Task task)
compareTo
in interface java.lang.Comparable<Task>
task
- The task to compare with this task.
public final TaskState execute()
runTask
method that performs the appropriate set-up and
tear-down. It should only be invoked by a task thread.
public void initializeTask() throws DirectoryException
DirectoryException
- If a problem occurs during initialization that
should be returned to the client.protected abstract TaskState runTask()
public void interruptTask(TaskState interruptState, Message interruptReason)
setTaskInterruptState(TaskState)
if the interruption is accepted
by this task.
interruptState
- The state to use for the task if it is
successfully interrupted.interruptReason
- A human-readable explanation for the cancellation.public boolean isInterruptable()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |