public class SimulationExecutor extends ThreadPoolExecutor
SimulatorLauncher
pour
executer les jobs soumis dans la queue de SimulationService
Les fonctionnalites en plus par rapport a un ThreadPoolExecutor
sont:
SimulatorLauncher
du jobIl est aussi possible d'ecoute l'etat de l'attribut pause
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Modifier and Type | Field and Description |
---|---|
protected int |
lastCorePoolSize
le nombre de thread utilise avant la pause
|
protected SimulatorLauncher |
launcher
le launcher a utilise pour les simulations
|
protected boolean |
pause
vrai si cet executor est en pause
|
protected PropertyChangeSupport |
propertyListeners |
protected SimulationService |
simulationService
le simulation service qui a cree cet executor
|
Constructor and Description |
---|
SimulationExecutor(SimulationService simulationService,
SimulatorLauncher launcher,
SimulationQueue workQueue) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener) |
protected void |
beforeExecute(Thread t,
Runnable r)
Met les threads en attente si pause est vrai, et fixe le
SimulatorLauncher a utiliser pour par la tache. |
SimulatorLauncher |
getLauncher() |
SimulationService |
getSimulationService() |
boolean |
isPause() |
void |
pause()
demande au thread d'arreter de prendre de nouvelle tache
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener) |
void |
resume()
indique au thread de recommencer a prendre de nouvelle tache
|
void |
setPause(boolean pause)
Change la valeur de la variable pause, si pause est alors vrai
notifie tous les threads en attente
|
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
protected PropertyChangeSupport propertyListeners
protected boolean pause
protected int lastCorePoolSize
protected SimulationService simulationService
protected SimulatorLauncher launcher
public SimulationExecutor(SimulationService simulationService, SimulatorLauncher launcher, SimulationQueue workQueue)
public SimulationService getSimulationService()
public SimulatorLauncher getLauncher()
public void addPropertyChangeListener(PropertyChangeListener listener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
protected void beforeExecute(Thread t, Runnable r)
SimulatorLauncher
a utiliser pour par la tache.
Si la tache a deja un SimulatorLauncher
d'assigne, on ne fait
pas la tachebeforeExecute
in class ThreadPoolExecutor
t
- le thread qui va executer la tacher
- public boolean isPause()
public void pause()
public void resume()
public void setPause(boolean pause)
pause
- pause value to setCopyright © 1999–2020 CodeLutin. All rights reserved.