|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wm.app.tn.util.TNFixedData
com.wm.app.tn.delivery.GuaranteedJob
public abstract class GuaranteedJob
A GuaranteedJob represents one unit of work for the task manager. It can be subclassed to reliably deliver documents, to guarantee the execution of async routing services, etc.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.wm.app.tn.util.TNFixedData |
---|
TNFixedData.TreeCursor |
Field Summary | |
---|---|
static int |
DELIVERING
|
static int |
DONE
|
static int |
FAILED
|
static int |
HELD
|
static int |
NEW
|
static java.lang.String |
NO_JOB_ID
|
static int |
PENDING
|
static int |
QUEUED
|
static java.lang.String[] |
STATUS_STRINGS
|
static int |
STOPPED
|
Constructor Summary | |
---|---|
GuaranteedJob()
No-arg constructor needed for subclasses of TNFixedData. |
|
GuaranteedJob(java.lang.String jobId,
java.lang.String serverId,
DeliveryService service,
BizDocEnvelope bizdoc,
com.wm.data.IData svcInput,
long ttw,
int retryLimit,
int retryFactor)
Define a new Job |
Method Summary | |
---|---|
abstract void |
addActivityEntry(int type,
java.lang.String brief,
java.lang.String full)
Adds an activity log entry. |
boolean |
attempted()
|
static int |
codeForMsg(java.lang.String msg)
|
void |
delivering()
Mark job DELIVERING and update timestamp. |
void |
done()
Mark job DONE and update timestamp. |
void |
enqueue(java.lang.String queue)
Places the job on a virtual queue. |
boolean |
exceedsRetries()
|
void |
fail()
Mark job as FAILED (due to hitting retry limit or exceeding ttw). |
BizDocEnvelope |
getBizDocEnvelope()
|
abstract java.lang.String |
getClassification()
This method should return the job "classification" which is a String representing an abbreviated name for the class. |
abstract com.wm.data.IData |
getDBIData()
This method will be used by the DB operations when storing jobs by binary encoding the information. |
DeliveryService |
getDeliveryService()
|
com.wm.data.IData |
getInputData()
|
java.lang.String |
getInvokeAsUser()
For internal use only. |
java.lang.String |
getJobId()
|
com.wm.data.IData |
getOutputData()
|
java.lang.String |
getQueueName()
|
int |
getRetries()
|
int |
getRetryFactor()
|
int |
getRetryLimit()
|
java.lang.String |
getServerId()
|
DeliveryService |
getService()
|
java.lang.String |
getStatus()
|
java.lang.String |
getStatusMsg()
|
int |
getStatusVal()
|
long |
getTimeCreated()
|
long |
getTimeUpdated()
|
java.lang.String |
getTransportStatus()
|
java.lang.String |
getTransportStatusMessage()
|
long |
getTransportTime()
|
long |
getTTW()
|
static java.lang.Object[][] |
GuaranteedJobSchema()
|
void |
hold()
Mark job HELD. |
void |
invoke()
Processes the job by invoking the associated service and interprets the return values to determine the job status. |
boolean |
isActive()
|
boolean |
isComplete()
|
boolean |
isDelivering()
|
boolean |
isDone()
|
boolean |
isExpired()
|
boolean |
isFailed()
|
boolean |
isHeld()
|
boolean |
isNew()
|
boolean |
isPending()
|
boolean |
isProcessing()
|
boolean |
isQueued()
|
boolean |
isRetry()
|
boolean |
isStopped()
|
boolean |
readyToRun()
Determines whether or not the job is ready to run. |
void |
reset()
Restore job to pending or queued and timestamp status change. |
boolean |
retriesReached()
|
void |
retryFailed()
Update the retry count and timestamp. |
boolean |
save()
Save the job in the database. |
void |
setActive(boolean active)
Make this job active. |
void |
setAttempted(boolean attempted)
Make this job active. |
void |
setBizDocEnvelope(BizDocEnvelope bizdoc)
|
abstract void |
setDBIData(com.wm.data.IData data)
This method will be used by the DB operations when restoring jobs from the database. |
void |
setDefaultServerId()
Sets the id of the server that this job should run on to the hostid of the current thread. |
void |
setInputData(com.wm.data.IData inputData)
Set any additional service input data. |
void |
setInvokeAsUser(java.lang.String invokeAsUser)
For internal use only. |
void |
setJobId(java.lang.String id)
This should only be used by the database code when restoring from the DB. |
void |
setOutputData(com.wm.data.IData outputData)
This should only be used by the database code when restoring from the DB. |
void |
setProcessing(boolean proc)
Sets the processing flag to prevent multiple threads from processing the same job simultaneously. |
void |
setQueueName(java.lang.String queue)
Sets the queue name. |
void |
setRetries(int retries)
This should only be used by the database code when restoring from the DB. |
void |
setRetryFactor(int factor)
Set the retry factor for this job. |
void |
setRetryLimit(int limit)
Set the retry limit for this job. |
void |
setServerId(java.lang.String id)
Set the id of the server that this job should run on. |
void |
setService(DeliveryService service)
Set the transport service to be invoked when processing this job. |
void |
setStatus(int status)
This should only be used by the database code when restoring from the DB. |
void |
setTimeCreated(long time)
Set the time this job was created. |
void |
setTimeUpdated(long time)
Sets the time this job was last updated. |
void |
setTransportStatus(java.lang.String status)
Internal use only. |
void |
setTransportStatusMessage(java.lang.String message)
Set the transport status message return from the transport service. |
void |
setTransportTime(long time)
Set the transport time return from the transport service. |
void |
setTTW(long ttw)
Set the time to wait (in milliseconds) between retry attempts if the job fails. |
void |
start()
Mark status as PENDING to indicate delivery in progress and timestamp status change. |
void |
stop()
Add mark STOPPED and timestamp status change. |
java.lang.String |
toString()
Default toString implementation returns class name followed by contents. |
Methods inherited from class com.wm.app.tn.util.TNFixedData |
---|
clone, dataSize, get, get, getCursor, getHashCursor, getIndexCursor, getKey, getSharedCursor, getTreeCursor, indexOf, merge, set, set |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String NO_JOB_ID
public static final int NEW
public static final int PENDING
public static final int DONE
public static final int FAILED
public static final int STOPPED
public static final int QUEUED
public static final int DELIVERING
public static final int HELD
public static final java.lang.String[] STATUS_STRINGS
Constructor Detail |
---|
public GuaranteedJob()
public GuaranteedJob(java.lang.String jobId, java.lang.String serverId, DeliveryService service, BizDocEnvelope bizdoc, com.wm.data.IData svcInput, long ttw, int retryLimit, int retryFactor) throws DeliveryException
jobId
- job idserverId
- server id job will be run onservice
- service to be invoked when running this jobbizdoc
- document associated with this job (if any)svcInput
- service inputsttw
- Time-to-wait (in milliseconds)retryLimit
- max number of retry attemptsretryFactor
- factor used to increase the time between retries
DeliveryException
Method Detail |
---|
public static final int codeForMsg(java.lang.String msg)
public static java.lang.Object[][] GuaranteedJobSchema()
public void invoke()
public boolean readyToRun()
public abstract java.lang.String getClassification()
public BizDocEnvelope getBizDocEnvelope()
public DeliveryService getDeliveryService()
public com.wm.data.IData getOutputData()
public int getRetries()
public int getRetryFactor()
public int getRetryLimit()
public com.wm.data.IData getInputData()
public int getStatusVal()
public java.lang.String getStatus()
public java.lang.String getStatusMsg()
public java.lang.String getTransportStatus()
public java.lang.String getTransportStatusMessage()
public long getTransportTime()
public long getTTW()
public long getTimeCreated()
public long getTimeUpdated()
public java.lang.String getJobId()
public java.lang.String getServerId()
public DeliveryService getService()
public java.lang.String getQueueName()
public boolean exceedsRetries()
public boolean retriesReached()
public boolean isActive()
public boolean isProcessing()
public boolean isRetry()
public boolean isNew()
public boolean isPending()
public boolean isDone()
public boolean isFailed()
public boolean isStopped()
public boolean isQueued()
public boolean isDelivering()
public boolean isComplete()
public boolean isHeld()
public boolean isExpired()
public abstract void addActivityEntry(int type, java.lang.String brief, java.lang.String full)
type
- activity log typebrief
- brief message to insertfull
- full message to insertpublic void setActive(boolean active)
public void setAttempted(boolean attempted)
public boolean attempted()
public void setBizDocEnvelope(BizDocEnvelope bizdoc)
bizdoc
- the document associated with this jobpublic void setInputData(com.wm.data.IData inputData)
inputData
- public void setJobId(java.lang.String id)
id
- Id of the jobpublic void setOutputData(com.wm.data.IData outputData)
outputData
- data passed from the servicepublic void setRetries(int retries)
retries
- number of retries attemptedpublic void setRetryFactor(int factor)
factor
- retry factorpublic void setRetryLimit(int limit)
limit
- maximum retry limitpublic void setServerId(java.lang.String id)
id
- Id of the server for this job to run onpublic void setDefaultServerId()
public void setService(DeliveryService service)
service
- associated servicepublic void setStatus(int status)
status
- public void setTimeCreated(long time)
time
- public void setTimeUpdated(long time)
time
- a timestamppublic void setTransportStatus(java.lang.String status)
status
- public void setTransportStatusMessage(java.lang.String message)
message
- public void setTransportTime(long time)
time
- transport timepublic void setTTW(long ttw)
ttw
- time to wait between retriespublic void setProcessing(boolean proc)
proc
- indicates whether the job is being processedpublic void setQueueName(java.lang.String queue)
queue
- name of the queuepublic void enqueue(java.lang.String queue)
queue
- name of the queuepublic void delivering()
public void start()
public void reset()
public void stop()
public void done()
public void fail()
public void hold()
public void retryFailed()
public java.lang.String getInvokeAsUser()
public void setInvokeAsUser(java.lang.String invokeAsUser)
public boolean save()
public abstract com.wm.data.IData getDBIData()
public abstract void setDBIData(com.wm.data.IData data)
data
- data to setpublic java.lang.String toString()
TNFixedData
toString
in class TNFixedData
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |