es.caib.bpm.job
Class JobExecutor

java.lang.Object
  extended by es.caib.bpm.job.JobExecutor

public class JobExecutor
extends java.lang.Object


Field Summary
protected  int historyMaxSize
           
protected static java.lang.String hostName
           
protected  int idleInterval
           
protected  boolean isStarted
           
protected  int lockBufferTime
           
protected  int lockMonitorInterval
           
protected  LockMonitorThread lockMonitorThread
           
protected  int maxIdleInterval
           
protected  int maxLockTime
           
protected  java.util.Map monitoredJobIds
           
protected  java.lang.String name
           
protected  int nbrOfThreads
           
protected  java.util.Map threads
           
 
Constructor Summary
JobExecutor()
           
 
Method Summary
 void addMonitoredJobId(java.lang.String threadName, long jobId)
           
protected  java.lang.Thread createThread(java.lang.String threadName)
           
 int getHistoryMaxSize()
           
 int getIdleInterval()
           
protected  java.lang.String getLastThreadName()
           
 int getLockBufferTime()
           
 int getLockMonitorInterval()
           
 int getMaxIdleInterval()
           
 int getMaxLockTime()
           
 java.util.Set getMonitoredJobIds()
           
 java.lang.String getName()
           
 int getNbrOfThreads()
           
protected  java.lang.String getNextThreadName()
           
 int getSize()
           
 java.util.Map getThreads()
           
 boolean isStarted()
           
 void removeMonitoredJobId(java.lang.String threadName)
           
 void setHistoryMaxSize(int historyMaxSize)
           
 void setIdleInterval(int idleInterval)
           
 void setLockBufferTime(int lockBufferTime)
           
 void setLockMonitorInterval(int lockMonitorInterval)
           
 void setMaxIdleInterval(int maxIdleInterval)
           
 void setMaxLockTime(int maxLockTime)
           
 void setMonitoredJobIds(java.util.Map monitoredJobIds)
           
 void setName(java.lang.String name)
           
 void setNbrOfThreads(int nbrOfThreads)
           
 void setSize(int nbrOfThreads)
           
 void setStarted(boolean isStarted)
           
 void setThreads(java.util.Map threads)
           
 void start()
           
protected  void startThread()
           
 java.util.List stop()
          signals to all threads in this job executor to stop.
 void stopAndJoin()
           
protected  java.lang.Thread stopThread()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

nbrOfThreads

protected int nbrOfThreads

idleInterval

protected int idleInterval

maxIdleInterval

protected int maxIdleInterval

historyMaxSize

protected int historyMaxSize

maxLockTime

protected int maxLockTime

lockMonitorInterval

protected int lockMonitorInterval

lockBufferTime

protected int lockBufferTime

threads

protected java.util.Map threads

lockMonitorThread

protected LockMonitorThread lockMonitorThread

monitoredJobIds

protected java.util.Map monitoredJobIds

isStarted

protected boolean isStarted

hostName

protected static java.lang.String hostName
Constructor Detail

JobExecutor

public JobExecutor()
Method Detail

start

public void start()

stop

public java.util.List stop()
signals to all threads in this job executor to stop. It may be that threads are in the middle of something and they will finish that firts. Use stopAndJoin() in case you want a method that blocks until all the threads are actually finished.

Returns:
a list of all the stopped threads. In case no threads were stopped an empty list will be returned.

stopAndJoin

public void stopAndJoin()
                 throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

startThread

protected void startThread()

createThread

protected java.lang.Thread createThread(java.lang.String threadName)

getNextThreadName

protected java.lang.String getNextThreadName()

getLastThreadName

protected java.lang.String getLastThreadName()

stopThread

protected java.lang.Thread stopThread()

setMonitoredJobIds

public void setMonitoredJobIds(java.util.Map monitoredJobIds)

getMonitoredJobIds

public java.util.Set getMonitoredJobIds()

addMonitoredJobId

public void addMonitoredJobId(java.lang.String threadName,
                              long jobId)

removeMonitoredJobId

public void removeMonitoredJobId(java.lang.String threadName)

setHistoryMaxSize

public void setHistoryMaxSize(int historyMaxSize)

getHistoryMaxSize

public int getHistoryMaxSize()

setIdleInterval

public void setIdleInterval(int idleInterval)

getIdleInterval

public int getIdleInterval()

setStarted

public void setStarted(boolean isStarted)

isStarted

public boolean isStarted()

setMaxIdleInterval

public void setMaxIdleInterval(int maxIdleInterval)

getMaxIdleInterval

public int getMaxIdleInterval()

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

setSize

public void setSize(int nbrOfThreads)

getSize

public int getSize()

setThreads

public void setThreads(java.util.Map threads)

getThreads

public java.util.Map getThreads()

setMaxLockTime

public void setMaxLockTime(int maxLockTime)

getMaxLockTime

public int getMaxLockTime()

setLockBufferTime

public void setLockBufferTime(int lockBufferTime)

getLockBufferTime

public int getLockBufferTime()

setLockMonitorInterval

public void setLockMonitorInterval(int lockMonitorInterval)

getLockMonitorInterval

public int getLockMonitorInterval()

setNbrOfThreads

public void setNbrOfThreads(int nbrOfThreads)

getNbrOfThreads

public int getNbrOfThreads()


Copyright © 2012 Direcció General de Tecnologia i Comunicacions. Govern de les Illes Balears. All Rights Reserved.