[Index]

sql-keeper-service


Provides a 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.


Property Summary

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 Summary

Example 1 See the User Guide.

Property Detail

connection

Configured ByELEMENT
AccessWRITE_ONLY
RequiredYes.

The connection to use.

keeper

AccessREAD_ONLY

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The name.

pollSchedule

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo - defaults to a 5 second {@link IntervalSchedule}.

The schedule to provide the polling interval.

pollerCount

AccessREAD_ONLY

The number of outstanding loosing outcome's polling of the database that are still in progress.

scheduleExecutorService

Configured ByELEMENT
AccessWRITE_ONLY
RequiredNo - provided by Oddjob.

The scheduling service for polling.

table

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The database table name.


Examples

Example 1

See the User Guide.


(c) Rob Gordon 2005 - 2017