com.infoengine.webject.mgt
Class DispatchTasks

java.lang.Object
  extended bycom.infoengine.webject.Webject
      extended bycom.infoengine.webject.mgt.DispatchTasks

public class DispatchTasks
extends Webject


Nested Class Summary
private  class DispatchTasks.DomainsForType
          Inner class used in caching domains discovered for types.
private  class DispatchTasks.TaskDelegateInfo
          Inner class used in registering information about task delegates including their URI's and the adapters and task processors that support them.
private  class DispatchTasks.TaskDelegateKey
          Inner class used in generating cache keys for directory-based task delegate definitions.
private  class DispatchTasks.TaskRunner
          Inner class for executing tasks concurrently.
 
Field Summary
private static int cacheTTL
           
private static Hashtable domainCache
           
private static Method EXECUTE_TASK
           
private static Random random
           
private static String RESOURCE
           
private static Hashtable taskDelegateCache
           
private static String vMDomain
           
 
Constructor Summary
DispatchTasks()
           
 
Method Summary
private  void awaitTask(DispatchTasks.TaskRunner thread, Task task)
          Wait for a task to finish executing, then add its results to the VDB of a specified task.
private  void awaitTasks(Vector threads, Task task)
          Wait for a group of tasks to finish executing, then add their results to the VDB of a specified task.
private  HashSet getDomainsForType(String type)
          Query the directory service for the domain names of repositories that support a specified type.
private  String getVMDomain()
          Get the domain name associated with this virtual machine.
 Task invoke(Task task)
          Dispatch tasks to process the contents of an input group.
private  void mergeVdb(Task task, IeCollection vdb)
          Merge the contents of a specified VDB to the VDB of a task.
private  Vector randomize(Vector vector)
          Randomize the order of elements in a vector.
 
Methods inherited from class com.infoengine.webject.Webject
booleanParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

cacheTTL

private static int cacheTTL

domainCache

private static Hashtable domainCache

random

private static Random random

taskDelegateCache

private static Hashtable taskDelegateCache

vMDomain

private static String vMDomain

EXECUTE_TASK

private static final Method EXECUTE_TASK
Constructor Detail

DispatchTasks

public DispatchTasks()
Method Detail

invoke

public Task invoke(Task task)
            throws IEException
Dispatch tasks to process the contents of an input group. Parameters specify task selection criteria, maximum number of concurrently running tasks, etc.

Specified by:
invoke in class Webject
Parameters:
task - a value of type 'Task'
Returns:
a value of type 'Task'
Throws:
IEException

awaitTasks

private void awaitTasks(Vector threads,
                        Task task)
                 throws IEException
Wait for a group of tasks to finish executing, then add their results to the VDB of a specified task.

Parameters:
threads - A vector of threads in which tasks are running.
task - The task to update.
Throws:
IEException - if any of the threads has thrown an exception.

awaitTask

private void awaitTask(DispatchTasks.TaskRunner thread,
                       Task task)
                throws IEException
Wait for a task to finish executing, then add its results to the VDB of a specified task.

Parameters:
thread - An instance of a thread running a task.
task - The task to update.
Throws:
IEException - if the thread has thrown an exception.

mergeVdb

private void mergeVdb(Task task,
                      IeCollection vdb)
Merge the contents of a specified VDB to the VDB of a task.

Parameters:
task - The task whose VDB will be updated.
vdb - The VDB to be merged into the task's VDB.

randomize

private Vector randomize(Vector vector)
Randomize the order of elements in a vector.

Parameters:
vector - The input vector
Returns:
The randomized output vector

getVMDomain

private String getVMDomain()
                    throws IEException
Get the domain name associated with this virtual machine.

Throws:
IEException

getDomainsForType

private HashSet getDomainsForType(String type)
                           throws IEException
Query the directory service for the domain names of repositories that support a specified type.

Throws:
IEException