OutgoingSegmentTask

public class OutgoingSegmentTask extends ActiveTaskAdaptor

Creation Date: 9/10/2006

Author:Twinsen Tsang

Constructors

OutgoingSegmentTask

public OutgoingSegmentTask(SFRMMessageSegmentDVO sgtDVO, SFRMPartnershipDVO pDVO, SFRMMessageDVO msgDVO, PackagedPayloads payload)

Explicit Constructor.

Parameters:
  • sgtDVO – The payload need to be send out.
  • pDVO – The partnership record associated to this segment.
  • msgDVO – The message record associated to this segment.
  • payload – The packaged payloads
Throws:
  • NullPointerException – If the message, partnership and segment is null.

Methods

execute

public void execute()

Execute the active task.

See also: hk.hku.cecid.piazza.commons.module.ActiveTask.execute()

getMaxRetries

public int getMaxRetries()
Returns:return the max retries allowed for this active task.

getRetryInterval

public long getRetryInterval()
Returns:return the interval between each sending retry.

isRetryEnabled

public boolean isRetryEnabled()
Returns:return true if this task can be retried.

onFailure

public void onFailure(Throwable e)

The method is invoked upon the task fails to send. The message segment and message will treat as FAIL. with status DF (Delivery Failure). Also, if the outgoing segment is a RECEIPT, then the PAYLOAD segment corresponding to this RECEIPT is also treated as FAIL.

Parameters:
  • e – The failure cause.

setRetried

public void setRetried(int retried)

Set the retries of active task. The parameter retried is useless here as we use the field “retried” in the database segment table for reference.

Parameters:
  • retried – The number of times that has been tried.