ActiveTask

public interface ActiveTask

ActiveTask represents a task which can be executed under a separated thread.

Author:Hugo Y. K. Lam

Methods

execute

public void execute()

Executes this task.

Throws:
  • Exception – if unable to carry out the task.

getMaxRetries

public int getMaxRetries()

Gets the maximum number of retries.

Returns:the maximum number of retries.

getRetryInterval

public long getRetryInterval()

Gets the retry interval in milliseconds.

Returns:the retry interval.

isRetryEnabled

public boolean isRetryEnabled()

Indicates if retry should be enabled.

Returns:true if retry should be enabled.

isSucceedFast

public boolean isSucceedFast()

Indicates if the task should succeed fast. false if this task should be retried depending solely on the indication of isRetryEnabled().

Returns:true if the task should succeed fast.

See also: .isRetryEnabled()

onAwake

public void onAwake()

Invoked when the retry interval has passed and before execution.

onFailure

public void onFailure(Throwable e)

Invoked when there is any exception thrown from the execution.

Parameters:
  • e – the exception cause.

setRetried

public void setRetried(int retried)

Sets the number of times this task has been retried.

Parameters:
  • retried – the number of times this task has been retried.