org.rhq.core.pc.operation
Class OperationInvocation

java.lang.Object
  extended by org.rhq.core.pc.operation.OperationInvocation
All Implemented Interfaces:
Runnable

public class OperationInvocation
extends Object
implements Runnable

The runnable that is actually responsible for invoking an operation on a plugin's OperationFacet.

Author:
John Mazzitelli

Nested Class Summary
static class OperationInvocation.Status
          Indicates the current status of this invocation (QUEUED, RUNNING or FINISHED).
 
Constructor Summary
OperationInvocation(int resourceId, long invocationTime, TimerTask timerTask, org.rhq.core.domain.configuration.Configuration parameterConfig, String jobId, String operationName, OperationFacet operationComponent, OperationServerService operationServerService, OperationThreadPoolGateway operationThreadPoolGateway, org.rhq.core.domain.operation.OperationDefinition operationDefinition)
           
 
Method Summary
 String getJobId()
          Returns the job ID that identifies this specific operation invocation.
 int getResourceId()
          Identifies the resource that this invocation will operate on.
 EnumSet<OperationInvocation.Status> getStatus()
           
 EnumSet<OperationInvocation.Status> markAsCanceled()
          Flags this operation as being canceled.
 void markAsTimedOut()
          Flags this operation as being canceled due to a time out.
 void run()
          This actually invokes the plugin's operation facet and executes the operation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OperationInvocation

public OperationInvocation(int resourceId,
                           long invocationTime,
                           TimerTask timerTask,
                           org.rhq.core.domain.configuration.Configuration parameterConfig,
                           String jobId,
                           String operationName,
                           OperationFacet operationComponent,
                           OperationServerService operationServerService,
                           OperationThreadPoolGateway operationThreadPoolGateway,
                           org.rhq.core.domain.operation.OperationDefinition operationDefinition)
Method Detail

getResourceId

public int getResourceId()
Identifies the resource that this invocation will operate on.

Returns:
the resource's ID

getJobId

public String getJobId()
Returns the job ID that identifies this specific operation invocation.

Returns:
unique job identification string

toString

public String toString()
Overrides:
toString in class Object

getStatus

public EnumSet<OperationInvocation.Status> getStatus()

markAsCanceled

public EnumSet<OperationInvocation.Status> markAsCanceled()
Flags this operation as being canceled. This will also interrupt the thread running the operation, if it is in the running state. Note that if the operation has already completed, this method does nothing since it is too late to cancel the operation.

Returns:
the current state of the operation when it was canceled

markAsTimedOut

public void markAsTimedOut()
Flags this operation as being canceled due to a time out. This will also interrupt the thread running the operation, if it is in the running state. Note that if the operation has already completed, this method does nothing since it is too late to time out the operation.


run

public void run()
This actually invokes the plugin's operation facet and executes the operation. If it does not finish before the timeout expires, the timer task will markAsTimedOut() interrupt this thread}. This thread will also be interrupted if the operation was canceled.

Specified by:
run in interface Runnable
See Also:
Runnable.run()


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