com.sun.sgs.impl.kernel.schedule
Class NowOrLaterRetryPolicy

java.lang.Object
  extended by com.sun.sgs.impl.kernel.schedule.NowOrLaterRetryPolicy
All Implemented Interfaces:
SchedulerRetryPolicy

public class NowOrLaterRetryPolicy
extends Object
implements SchedulerRetryPolicy

A SchedulerRetryPolicy that works in a similar fashion as the ImmediateRetryPolicy except that it also loosens the transaction restrictions after a certain number of task retries in order to push through tasks that are frequently timing out. This SchedulerRetryPolicy causes a task that throws a retryable exception to retry immediately. However, once a task has been retried more than the configurable threshold (see below), then the transaction timeout for the task is doubled, and the task is scheduled to be retried later (rather than immediately). This class supports the following configuration properties:

Property: "com.sun.sgs.impl.kernel.schedule.retry.backoff.threshold"
Default: 10
If a task has been retried more than this number of times, then the task's transaction restrictions are loosened the next time it runs and the task is scheduled to be retried later. This value must be greater than or equal to 1.


Field Summary
(package private) static int DEFAULT_RETRY_BACKOFF_THRESHOLD
          The default retry backoff threshold.
(package private) static String RETRY_BACKOFF_THRESHOLD_PROPERTY
          The property used to define the retry count threshold to use before loosening the transaction requirements and scheduling a task to be retried later.
 
Constructor Summary
NowOrLaterRetryPolicy(Properties properties)
          Constructs a NowOrLaterRetryPolicy.
 
Method Summary
 SchedulerRetryAction getRetryAction(ScheduledTask task)
          Determines if and how a task should be retried after a failure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RETRY_BACKOFF_THRESHOLD_PROPERTY

static final String RETRY_BACKOFF_THRESHOLD_PROPERTY
The property used to define the retry count threshold to use before loosening the transaction requirements and scheduling a task to be retried later.

See Also:
Constant Field Values

DEFAULT_RETRY_BACKOFF_THRESHOLD

static final int DEFAULT_RETRY_BACKOFF_THRESHOLD
The default retry backoff threshold.

See Also:
Constant Field Values
Constructor Detail

NowOrLaterRetryPolicy

public NowOrLaterRetryPolicy(Properties properties)
Constructs a NowOrLaterRetryPolicy.

Parameters:
properties - the system properties available
Method Detail

getRetryAction

public SchedulerRetryAction getRetryAction(ScheduledTask task)
Determines if and how a task should be retried after a failure. This method should be called by a scheduler if a task aborts. This method may modify the given task in order to affect how the scheduler behaves when re-executing.

Note: The Throwable cause of the most recent failure of the given task should always be accessible via the ScheduledTask.getLastFailure() method. This Throwable may implement ExceptionRetryStatus. If it does, care should be taken to abide by the contract specified by the TaskManager with regard to Throwables that implement this interface.

Note: The proper way to drop a task with a custom policy is to return DROP with this method. Implementations should not use a call to cancel on the given task.

This implementation normally returns a value of SchedulerRetryAction.RETRY_NOW for any task that has most recently failed with a retryable exception. However, if the given task has been retried more than the backoff threshold, then the task's transaction timeout is doubled, and this method returns a value of SchedulerRetryAction.RETRY_LATER.

Specified by:
getRetryAction in interface SchedulerRetryPolicy
Parameters:
task - the task that has been aborted
Returns:
the SchedulerRetryAction that the scheduler should take with respect to retrying the given task

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved