org.ow2.orchestra.pvm.internal.jobexecutor.jdk
Class JdkJobExecutor

java.lang.Object
  extended by org.ow2.orchestra.pvm.internal.jobexecutor.AbstractJobExecutor
      extended by org.ow2.orchestra.pvm.internal.jobexecutor.jdk.JdkJobExecutor
All Implemented Interfaces:
JobExecutor

public class JdkJobExecutor
extends AbstractJobExecutor
implements JobExecutor

Implementation of the JobExecutor which uses java ExecutorService to execute the jobs.

Author:
Guillaume Porcher

Field Summary
 
Fields inherited from class org.ow2.orchestra.pvm.internal.jobexecutor.AbstractJobExecutor
acquireJobsCommand, commandService, deadJobHandler, idleMillis, isActive, limitSameInstanceJobs, lockMillis, name, nextDueDateCommand
 
Constructor Summary
JdkJobExecutor()
           
 
Method Summary
protected  int getAcquireJobSize()
           
 JdkDispatcherThread getDispatcherThread()
           
 ExecutorService getExecutorService()
           
 void start()
          starts the JdkDispatcherThread and ExecutorServices
 void stop()
          stops with join set to false.
 void stop(boolean join)
          signals to all threads managed by this jobImpl executor to stop.
protected  void waitTillQueueEmpty()
           
 
Methods inherited from class org.ow2.orchestra.pvm.internal.jobexecutor.AbstractJobExecutor
getAcquireJobsCommand, getCommandExecutor, getDeadJobHandler, getHostName, getIdleMillis, getLockMillis, getName, getNextDueDateCommand, isActive, isLimitSameInstanceJobs, jobWasAdded, setCommandExecutor, setDeadJobHandler, setIdleInterval, setLimitSameInstanceJobs, setMaxLockTime, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ow2.orchestra.pvm.internal.jobexecutor.JobExecutor
getDeadJobHandler, getName, isActive, jobWasAdded
 

Constructor Detail

JdkJobExecutor

public JdkJobExecutor()
Method Detail

start

public void start()
starts the JdkDispatcherThread and ExecutorServices

Specified by:
start in interface JobExecutor
Specified by:
start in class AbstractJobExecutor

stop

public void stop()
Description copied from interface: JobExecutor
stops with join set to false.

Specified by:
stop in interface JobExecutor
Specified by:
stop in class AbstractJobExecutor
See Also:
JobExecutor.stop(boolean)

stop

public void stop(boolean join)
Description copied from interface: JobExecutor
signals to all threads managed by this jobImpl executor to stop. Stopping the dispatcher thread is blocking till the dispatcher is no more alive. If join is set to true, this method will block until all jobImpl executor threads are joined and actually dead. If join is false, the jobImpl executor threads are only told to stop, without waiting till they are actually stopped. It may be that jobImpl executor threads are in the middle of executing a jobImpl and they may finish after this method returned.

Specified by:
stop in interface JobExecutor
Specified by:
stop in class AbstractJobExecutor

waitTillQueueEmpty

protected void waitTillQueueEmpty()

getDispatcherThread

public JdkDispatcherThread getDispatcherThread()
Specified by:
getDispatcherThread in class AbstractJobExecutor

getAcquireJobSize

protected int getAcquireJobSize()
Specified by:
getAcquireJobSize in class AbstractJobExecutor

getExecutorService

public ExecutorService getExecutorService()
Returns:
the executorService


Copyright © 2011 OW2 Consortium. All Rights Reserved.