|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.ma2.biz.impl.WorkBizImpl
public class WorkBizImpl
Implementation of WorkBiz that uses an ExecutorService
to schedule the work in different threads.
The configurable properties of this class are:
ExecutorService
to use for executing
the submitted work in WorkBiz.submitWork(WorkRequest)
. If not configured,
PlatformTransactionManager
to manage transactions
with. Each job is executed in a transaction, either by joining an
exiting one or starting a new one. If left null then no
transactions will be used.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface magoffin.matt.ma2.biz.WorkBiz |
---|
WorkBiz.WorkInfo, WorkBiz.WorkRequest |
Field Summary |
---|
Fields inherited from interface magoffin.matt.ma2.biz.WorkBiz |
---|
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY |
Constructor Summary | |
---|---|
WorkBizImpl()
|
Method Summary | |
---|---|
void |
finish()
Shutdown the work queue. |
long |
getCompletedJobMinRememberTimeMs()
|
long |
getDelayedJobMaxRememberTimeMs()
|
java.util.concurrent.ExecutorService |
getExecutor()
|
WorkBiz.WorkInfo |
getInfo(long ticket)
Get information about a running or recently running job. |
long |
getScanJobTimerMs()
|
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager()
|
boolean |
infoExists(long ticket)
Check for the existance of a running or recently complete job. |
void |
init()
Initialize this instance. |
boolean |
isForceTransactionRollback()
|
void |
setCompletedJobMinRememberTimeMs(long completedJobMinRememberTimeMs)
|
void |
setDelayedJobMaxRememberTimeMs(long delayedJobMaxRememberTimeMs)
|
void |
setExecutor(java.util.concurrent.ExecutorService executor)
|
void |
setForceTransactionRollback(boolean forceTransactionRollback)
|
void |
setScanJobTimerMs(long scanJobTimerMs)
|
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
|
WorkBiz.WorkInfo |
submitWork(WorkBiz.WorkRequest work)
Submit a work request for processing. |
boolean |
workReadyNow(long ticket)
Signal that a particular job is ready to begin work now, presumably after being delayed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WorkBizImpl()
Method Detail |
---|
public void init()
public void finish()
public WorkBiz.WorkInfo submitWork(WorkBiz.WorkRequest work)
WorkBiz
submitWork
in interface WorkBiz
work
- the work to perform
public boolean workReadyNow(long ticket)
WorkBiz
workReadyNow
in interface WorkBiz
ticket
- the work ticket number that is ready
public WorkBiz.WorkInfo getInfo(long ticket)
WorkBiz
If the job is still running calling this method must always return the work info. If the job has completed, it is up to the implementation of this API if the info is returned or not. For practical purposes implementations should be able to return information about completed jobs for a reasonable length of time after the job completes, to give time for clients to query the status of the job.
Note: calling this method might have side effects,
like purging completed jobs. Use the WorkBiz.infoExists(long)
method to test for the existance of a job without any of these
potential side effects.
getInfo
in interface WorkBiz
ticket
- the work ticket number
public boolean infoExists(long ticket)
WorkBiz
This method can be used to check if a job is known, without
any side-effects calling WorkBiz.getInfo(long)
might include (such as
resetting access statitics, purging a complete job, etc).
infoExists
in interface WorkBiz
ticket
- the work ticket number
public java.util.concurrent.ExecutorService getExecutor()
public void setExecutor(java.util.concurrent.ExecutorService executor)
executor
- The executor to set.public long getScanJobTimerMs()
public void setScanJobTimerMs(long scanJobTimerMs)
scanJobTimerMs
- The scanJobTimerMs to set.public long getCompletedJobMinRememberTimeMs()
public void setCompletedJobMinRememberTimeMs(long completedJobMinRememberTimeMs)
completedJobMinRememberTimeMs
- The completedJobMinRememberTimeMs to set.public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
transactionManager
- The transactionManager to set.public boolean isForceTransactionRollback()
public void setForceTransactionRollback(boolean forceTransactionRollback)
forceTransactionRollback
- The forceTransactionRollback to set.public long getDelayedJobMaxRememberTimeMs()
public void setDelayedJobMaxRememberTimeMs(long delayedJobMaxRememberTimeMs)
delayedJobMaxRememberTimeMs
- the delayedJobMaxRememberTimeMs to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |