magoffin.matt.ma2.biz
Interface WorkBiz

All Known Implementing Classes:
WorkBizImpl

public interface WorkBiz

API for a work queue and scheduling tasks to keep the application from overloading the system it's running on.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
matt.magoffin

Nested Class Summary
static interface WorkBiz.WorkInfo
          Work information created by submitting WorkRequest instances.
static interface WorkBiz.WorkRequest
          Interface for submitting a job to the work queue.
 
Field Summary
static java.lang.Integer DEFAULT_PRIORITY
          The default priority applied to work requests if none specified.
static java.lang.Integer HIGH_PRIORITY
          A high priority.
static java.lang.Integer LOW_PRIORITY
          A low priority.
 
Method Summary
 WorkBiz.WorkInfo getInfo(long ticket)
          Get information about a running or recently running job.
 boolean infoExists(long ticket)
          Check for the existance of a running or recently complete job.
 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.
 

Field Detail

DEFAULT_PRIORITY

static final java.lang.Integer DEFAULT_PRIORITY
The default priority applied to work requests if none specified.


LOW_PRIORITY

static final java.lang.Integer LOW_PRIORITY
A low priority.


HIGH_PRIORITY

static final java.lang.Integer HIGH_PRIORITY
A high priority.

Method Detail

submitWork

WorkBiz.WorkInfo submitWork(WorkBiz.WorkRequest work)
Submit a work request for processing.

Parameters:
work - the work to perform
Returns:
a WorkInfo detailing the status of the work

getInfo

WorkBiz.WorkInfo getInfo(long ticket)
Get information about a running or recently running job.

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 infoExists(long) method to test for the existance of a job without any of these potential side effects.

Parameters:
ticket - the work ticket number
Returns:
the WorkInfo for the requested ticket, or null if not available

infoExists

boolean infoExists(long ticket)
Check for the existance of a running or recently complete job.

This method can be used to check if a job is known, without any side-effects calling getInfo(long) might include (such as resetting access statitics, purging a complete job, etc).

Parameters:
ticket - the work ticket number
Returns:
boolean if info is available for the given work ticket number

workReadyNow

boolean workReadyNow(long ticket)
Signal that a particular job is ready to begin work now, presumably after being delayed.

Parameters:
ticket - the work ticket number that is ready
Returns:
boolean if that work was found