org.oddjob.scheduling.Keeper
that uses a database
table.
The keeper uses a simple 'first to insert' a row wins methodology for deciding winner and looser. This is quite primitive and decides that any exception from the insert operation is a duplicate key exception and therefore a looser.
A org.oddjob.scheduling.LoosingOutcome
will continue to Poll the database (for as long
as it has listeners) until the work is complete. The default polling schedule
polls every 5 seconds indefinitely. The pollSchedule
property
can be used to poll for a limited time, after which it flags an exception
state. This could be used by loosing servers to flag the winner is taking
too long and has possibly crashed.
This is an example of the SQL that would create a suitable table.
CREATE TABLE oddjob_grabbable(
key VARCHAR(32),
instance VARCHAR(32),
winner VARCHAR(32),
complete boolean,
CONSTRAINT oddjob_pk PRIMARY KEY (key, instance))
This service does not tidy up the database so rows will grow indefinitely. A separate tidy job should be implemented.
connection | The connection to use. |
keeper | |
name | The name. |
pollSchedule | The schedule to provide the polling interval. |
pollerCount | The number of outstanding loosing outcome's polling of the database that are still in progress. |
scheduleExecutorService | The scheduling service for polling. |
table | The database table name. |
Example 1 | See the User Guide. |
Configured By | ELEMENT |
Access | WRITE_ONLY |
Required | Yes. |
The connection to use.
Access | READ_ONLY |
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
The name.
Configured By | ELEMENT |
Access | READ_WRITE |
Required | No - defaults to a 5 second {@link IntervalSchedule}. |
The schedule to provide the polling interval.
Access | READ_ONLY |
The number of outstanding loosing outcome's polling of the database that are still in progress.
Configured By | ELEMENT |
Access | WRITE_ONLY |
Required | No - provided by Oddjob. |
The scheduling service for polling.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
The database table name.
See the User Guide.