Package org.mycore.services.queuedjob
Class MCRJobMaster
java.lang.Object
org.mycore.services.queuedjob.MCRJobMaster
- All Implemented Interfaces:
Comparable<MCRShutdownHandler.Closeable>
,Runnable
,MCRShutdownHandler.Closeable
The master of all
MCRJobThread
s threads.- Author:
- René Adler
-
Field Summary
Fields inherited from interface org.mycore.common.events.MCRShutdownHandler.Closeable
DEFAULT_PRIORITY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Shuts down this thread and every local threads spawned byrun()
.static MCRJobMaster
getInstance
(Class<? extends MCRJobAction> action) Returns an singleton instance of this class.getName()
Returns the name of this job master.protected String
int
Returns the priority.Returns the processable collection assigned to this job master.static boolean
isRunning
(Class<? extends MCRJobAction> action) Return ifMCRJobMaster
is running.void
stops transmittingMCRJob
toMCRJobThread
and prepares shutdown.void
run()
Starts local threads (MCRJobThread
) and givesMCRJob
instances to them.static void
startMasterThread
(Class<? extends MCRJobAction> action) Starts the localMCRJobMaster
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.mycore.common.events.MCRShutdownHandler.Closeable
compareTo
-
Method Details
-
getInstance
Returns an singleton instance of this class.- Parameters:
action
- theMCRJobAction
ornull
- Returns:
- the instance of this class
-
isRunning
Return ifMCRJobMaster
is running.- Returns:
- if is running
-
startMasterThread
Starts the localMCRJobMaster
. Can be auto started if"MCR.QueuedJob.{?MCRJobAction?.}autostart"
is set totrue
. -
run
public void run()Starts local threads (MCRJobThread
) and givesMCRJob
instances to them. Use property"MCR.QueuedJob.JobThreads"
to specify how many concurrent threads should be running."MCR.QueuedJob.activated"
can be used activate or deactivate generalMCRJob
running. -
prepareClose
public void prepareClose()stops transmittingMCRJob
toMCRJobThread
and prepares shutdown.- Specified by:
prepareClose
in interfaceMCRShutdownHandler.Closeable
-
close
public void close()Shuts down this thread and every local threads spawned byrun()
.- Specified by:
close
in interfaceMCRShutdownHandler.Closeable
-
getPriority
public int getPriority()Description copied from interface:MCRShutdownHandler.Closeable
Returns the priority. A Closeable with a higher priority will be closed before a Closeable with a lower priority. Default priority is 5.- Specified by:
getPriority
in interfaceMCRShutdownHandler.Closeable
-
getPreLabel
-
getName
Returns the name of this job master.- Returns:
-
getProcessableCollection
Returns the processable collection assigned to this job master.- Returns:
- the processable collection
-