|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ode.scheduler.simple.JdbcDelegate
public class JdbcDelegate
JDBC-based implementation of the DatabaseDelegate
interface. Should work with most
reasonably behaved databases.
Constructor Summary | |
---|---|
JdbcDelegate(javax.sql.DataSource ds)
|
Method Summary | |
---|---|
boolean |
deleteJob(java.lang.String jobid,
java.lang.String nodeId)
Delete a job from the database. |
java.util.List<org.apache.ode.scheduler.simple.Job> |
dequeueImmediate(java.lang.String nodeId,
long maxtime,
int maxjobs)
"Dequeue" jobs from the database that are ready for immediate execution; this basically is a select/delete operation with constraints on the nodeId and scheduled time. |
java.util.List<java.lang.String> |
getNodeIds()
Return a list of unique nodes identifiers found in the database. |
boolean |
insertJob(org.apache.ode.scheduler.simple.Job job,
java.lang.String nodeId,
boolean loaded)
Save the job in the database. |
int |
updateAssignToNode(java.lang.String node,
int i,
int numNodes,
long maxtime)
Assign a particular node identifier to a fraction of jobs in the database that do not have one, and are up for execution within a certain time. |
int |
updateReassign(java.lang.String oldnode,
java.lang.String newnode)
Reassign jobs from one node to another. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JdbcDelegate(javax.sql.DataSource ds)
Method Detail |
---|
public boolean deleteJob(java.lang.String jobid, java.lang.String nodeId) throws DatabaseException
DatabaseDelegate
deleteJob
in interface DatabaseDelegate
jobid
- job identifiernodeId
- node identifier
DatabaseException
- in case of errorpublic java.util.List<java.lang.String> getNodeIds() throws DatabaseException
DatabaseDelegate
getNodeIds
in interface DatabaseDelegate
DatabaseException
public boolean insertJob(org.apache.ode.scheduler.simple.Job job, java.lang.String nodeId, boolean loaded) throws DatabaseException
DatabaseDelegate
insertJob
in interface DatabaseDelegate
job
- the jobnodeId
- node assigned to the job (or null if no node has been asssigned)loaded
- whether the job has been loaded into memory (i.e. in preperation for execution)
DatabaseException
- in case of errorpublic java.util.List<org.apache.ode.scheduler.simple.Job> dequeueImmediate(java.lang.String nodeId, long maxtime, int maxjobs) throws DatabaseException
DatabaseDelegate
dequeueImmediate
in interface DatabaseDelegate
nodeId
- node identifier of the jobsmaxtime
- only jobs with scheduled time earlier than this will be dequeuedmaxjobs
- maximum number of jobs to deqeue
DatabaseException
- in case of errorpublic int updateReassign(java.lang.String oldnode, java.lang.String newnode) throws DatabaseException
DatabaseDelegate
updateReassign
in interface DatabaseDelegate
oldnode
- node assigning fromnewnode
- new node asssigning to
DatabaseException
public int updateAssignToNode(java.lang.String node, int i, int numNodes, long maxtime) throws DatabaseException
DatabaseDelegate
UPDATE jobs AS job
WHERE job.scheduledTime before :maxtime
AND job.nodeId is null
AND job.scheduledTime MOD :y == :x
SET job.nodeId = :nodeId
updateAssignToNode
in interface DatabaseDelegate
node
- node identifier to assign to jobsi
- the result of the mod-divisionnumNodes
- the dividend of the mod-divisionmaxtime
- only jobs with scheduled time earlier than this will be updated
DatabaseException
- in case of error
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |