Class BackgroundProcessTask
- java.lang.Object
-
- org.silverpeas.core.thread.task.AbstractRequestTask<AbstractRequestTask.ProcessContext>
-
- org.silverpeas.core.backgroundprocess.BackgroundProcessTask
-
@Technical @Bean public class BackgroundProcessTask extends AbstractRequestTask<AbstractRequestTask.ProcessContext>
This task is in charge of processing background processes.
All services which needs to perform background processes needs to push aAbstractBackgroundProcessRequest
toBackgroundProcessTask
.Each request has an identifier and a lock duration set by the caller (through the
AbstractBackgroundProcessRequest
implementation). The lock duration is the minimal time the requests are ignored after a first one with a same identifier has been processed.Here the rules:
- If a new request is pushed whereas it does not exist already one into the queue with a same identifier, then the new request is pushed into queue.
- If a new request is pushed whereas it exists already one into the queue with a same
identifier:
- the lock duration has passed, then the new request is pushed into queue
- the lock duration nas not passed or the existing request has not yet been performed, then the new request is ignored
If a request has not yet been processed, it could happen that the lock duration will be greater than the one specified in case a new request with a same identifier is pushed.
- Author:
- silveryocha
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BackgroundProcessTask.LOCK_DURATION
-
Nested classes/interfaces inherited from class org.silverpeas.core.thread.task.AbstractRequestTask
AbstractRequestTask.ProcessContext, AbstractRequestTask.Request<C>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
processRequest(AbstractRequestTask.Request<AbstractRequestTask.ProcessContext> request)
Processes the given request.
Useful for a task which needs to perform some stuffs around the process.static void
push(AbstractBackgroundProcessRequest request)
Pushes a request to process.-
Methods inherited from class org.silverpeas.core.thread.task.AbstractRequestTask
afterNoMoreRequest, call, getProcessContext, getRequestQueueLimit
-
-
-
-
Method Detail
-
push
public static void push(AbstractBackgroundProcessRequest request)
Pushes a request to process.- Parameters:
request
- a request.
-
processRequest
protected void processRequest(AbstractRequestTask.Request<AbstractRequestTask.ProcessContext> request) throws org.silverpeas.kernel.SilverpeasException
Description copied from class:AbstractRequestTask
Processes the given request.
Useful for a task which needs to perform some stuffs around the process.- Overrides:
processRequest
in classAbstractRequestTask<AbstractRequestTask.ProcessContext>
- Parameters:
request
- the request to process.- Throws:
org.silverpeas.kernel.SilverpeasException
- on error.
-
-