org.apache.oodt.cas.workflow.engine
Class NonBlockingThreadPoolWorkflowEngine

java.lang.Object
  extended by org.apache.oodt.cas.workflow.engine.NonBlockingThreadPoolWorkflowEngine
All Implemented Interfaces:
WorkflowEngine, WorkflowStatus

public class NonBlockingThreadPoolWorkflowEngine
extends Object
implements WorkflowEngine, WorkflowStatus

Version:
$Revsion$

This is a non-blocking implementation of the Thread-pool based workflow engine.

Author:
woollard

Field Summary
 Map CONDITION_CACHE
           
 
Fields inherited from interface org.apache.oodt.cas.workflow.engine.WorkflowEngine
X_POINT_ID
 
Fields inherited from interface org.apache.oodt.cas.workflow.structs.WorkflowStatus
CREATED, ERROR, FINISHED, METADATA_MISSING, PAUSED, QUEUED, RESMGR_SUBMIT, STARTED
 
Constructor Summary
NonBlockingThreadPoolWorkflowEngine(WorkflowInstanceRepository instRep, int queueSize, int maxPoolSize, int minPoolSize, long threadKeepAliveTime, boolean unlimitedQueue, URL resUrl)
          Default Constructor.
 
Method Summary
 double getCurrentTaskWallClockMinutes(String workflowInstId)
          Gets the amount of wall clock minutes that the particular WorkflowTask within a WorkflowInstance has been executing for.
protected static double getCurrentTaskWallClockMinutes(WorkflowInstance inst)
           
 WorkflowInstanceRepository getInstanceRepository()
          Gets the WorkflowInstanceRepository used by this WorkflowEngine.
 double getWallClockMinutes(String workflowInstId)
          Gets the amount of wall clock minutes that a particular WorkflowInstance (identified by its workflowInst) has been executing.
protected static double getWallClockMinutes(WorkflowInstance inst)
           
 org.apache.oodt.cas.metadata.Metadata getWorkflowInstanceMetadata(String workflowInstId)
          Gets the Metadata associated with the WorkflowInstance identified by the given identifier.
 Vector getWorkflowQueue()
           
 void pauseWorkflowInstance(String workflowInstId)
           Pauses the WorkflowInstance specified by its workflowInstId.
 void persistWorkflowInstance(WorkflowInstance wInst)
           
 void resumeWorkflowInstance(String workflowInstId)
           Resumes Execution of the specified WorkflowInstance identified by its workflowInstId.
 void setWorkflowManagerUrl(URL url)
          Sets a pointer to the Workflow Manager that this WorkflowEngine belongs to.
 WorkflowInstance startWorkflow(Workflow workflow, org.apache.oodt.cas.metadata.Metadata metadata)
           Starts the specified Workflow by creating a WorkflowInstance, and then running that instance.
 void stopWorkflow(String workflowInstId)
          Stops the WorkflowInstance identified by the given workflowInstId.
 void submitWorkflowInstancetoPool(WorkflowInstance wInst)
           
 boolean updateMetadata(String workflowInstId, org.apache.oodt.cas.metadata.Metadata met)
          Updates the Metadata context for the WorkflowInstance identified by the given workflowInstId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONDITION_CACHE

public Map CONDITION_CACHE
Constructor Detail

NonBlockingThreadPoolWorkflowEngine

public NonBlockingThreadPoolWorkflowEngine(WorkflowInstanceRepository instRep,
                                           int queueSize,
                                           int maxPoolSize,
                                           int minPoolSize,
                                           long threadKeepAliveTime,
                                           boolean unlimitedQueue,
                                           URL resUrl)
Default Constructor.

Parameters:
instRep - The WorkflowInstanceRepository to be used by this engine.
queueSize - The size of the queue that the workflow engine should use (irrelevant if unlimitedQueue is set to true)
maxPoolSize - The minimum thread pool size.
minPoolSize - The maximum thread pool size.
threadKeepAliveTime - The amount of minutes that each thread in the pool should be kept alive.
unlimitedQueue - Whether or not to use a queue whose bounds are dictated by the physical memory of the underlying hardware.
resUrl - A URL pointer to a resource manager. If this is set Tasks will be wrapped as Resource Manager Jobs and sent through the Resource Manager. If this parameter is not set, local execution (the default) will be used
Method Detail

getWorkflowQueue

public Vector getWorkflowQueue()

submitWorkflowInstancetoPool

public void submitWorkflowInstancetoPool(WorkflowInstance wInst)

pauseWorkflowInstance

public void pauseWorkflowInstance(String workflowInstId)
Description copied from interface: WorkflowEngine

Pauses the WorkflowInstance specified by its workflowInstId.

Specified by:
pauseWorkflowInstance in interface WorkflowEngine
Parameters:
workflowInstId - The ID of the Workflow Instance to pause.

resumeWorkflowInstance

public void resumeWorkflowInstance(String workflowInstId)
Description copied from interface: WorkflowEngine

Resumes Execution of the specified WorkflowInstance identified by its workflowInstId.

Specified by:
resumeWorkflowInstance in interface WorkflowEngine
Parameters:
workflowInstId - The ID of the WorkflowInstance to resume.

startWorkflow

public WorkflowInstance startWorkflow(Workflow workflow,
                                      org.apache.oodt.cas.metadata.Metadata metadata)
                               throws EngineException
Description copied from interface: WorkflowEngine

Starts the specified Workflow by creating a WorkflowInstance, and then running that instance. The started WorkflowInstance which is returned, will have its status updated by the workflow engine, including its status field, and its currentTaskId.

Specified by:
startWorkflow in interface WorkflowEngine
Parameters:
workflow - The abstract representation of the Workflow to start.
metadata - Any metadata that needs to be shared between the tasks in the WorkflowInstance.
Returns:
A WorkflowInstance which can be used to monitor the execution of the Workflow through the Engine.
Throws:
EngineException - If any error occurs.

getInstanceRepository

public WorkflowInstanceRepository getInstanceRepository()
Description copied from interface: WorkflowEngine
Gets the WorkflowInstanceRepository used by this WorkflowEngine.

Specified by:
getInstanceRepository in interface WorkflowEngine
Returns:
The WorkflowInstanceRepository used by this WorkflowEngine.

updateMetadata

public boolean updateMetadata(String workflowInstId,
                              org.apache.oodt.cas.metadata.Metadata met)
Description copied from interface: WorkflowEngine
Updates the Metadata context for the WorkflowInstance identified by the given workflowInstId

Specified by:
updateMetadata in interface WorkflowEngine
Parameters:
workflowInstId - Identifies the WorkflowInstance whose Metadata context will be updated.
met - The new Metadata context.
Returns:
true if the update was successful, false otherwise.

setWorkflowManagerUrl

public void setWorkflowManagerUrl(URL url)
Description copied from interface: WorkflowEngine
Sets a pointer to the Workflow Manager that this WorkflowEngine belongs to.

Specified by:
setWorkflowManagerUrl in interface WorkflowEngine
Parameters:
url - The URL pointer to the Workflow Manager that this WorkflowEngine belongs to.

stopWorkflow

public void stopWorkflow(String workflowInstId)
Description copied from interface: WorkflowEngine
Stops the WorkflowInstance identified by the given workflowInstId.

Specified by:
stopWorkflow in interface WorkflowEngine
Parameters:
workflowInstId - The identifier of the WorkflowInstance to stop.

getCurrentTaskWallClockMinutes

public double getCurrentTaskWallClockMinutes(String workflowInstId)
Description copied from interface: WorkflowEngine
Gets the amount of wall clock minutes that the particular WorkflowTask within a WorkflowInstance has been executing for.

Specified by:
getCurrentTaskWallClockMinutes in interface WorkflowEngine
Parameters:
workflowInstId - The identifier of the WorkflowInstance to measure wall clock time for its current WorkflowTask.
Returns:
The amount of wall clock minutes that a particular WorkflowInstance's current WorkflowTask has been executing for.

getWorkflowInstanceMetadata

public org.apache.oodt.cas.metadata.Metadata getWorkflowInstanceMetadata(String workflowInstId)
Description copied from interface: WorkflowEngine
Gets the Metadata associated with the WorkflowInstance identified by the given identifier.

Specified by:
getWorkflowInstanceMetadata in interface WorkflowEngine
Parameters:
workflowInstId - The identifier of the WorkflowInstance to obtain the Metadata for.
Returns:
The Metadata shared context of the WorkflowInstance with the given identifier.

getWallClockMinutes

public double getWallClockMinutes(String workflowInstId)
Description copied from interface: WorkflowEngine
Gets the amount of wall clock minutes that a particular WorkflowInstance (identified by its workflowInst) has been executing. This includes time spent QUEUED, time spent WAITING, throughout its entire lifecycle.

Specified by:
getWallClockMinutes in interface WorkflowEngine
Parameters:
workflowInstId - The identifier of the WorkflowInstance to measure wall clock time for.
Returns:
The amount of wall clock minutes that a particular WorkflowInstance has been executing for.

getWallClockMinutes

protected static double getWallClockMinutes(WorkflowInstance inst)

getCurrentTaskWallClockMinutes

protected static double getCurrentTaskWallClockMinutes(WorkflowInstance inst)

persistWorkflowInstance

public void persistWorkflowInstance(WorkflowInstance wInst)
                             throws EngineException
Throws:
EngineException


Copyright © 1999-2011 Apache OODT. All Rights Reserved.