com.sun.sgs.impl.service.task
Class FixedTimeContinuePolicy

java.lang.Object
  extended by com.sun.sgs.impl.service.task.FixedTimeContinuePolicy
All Implemented Interfaces:
ContinuePolicy

public class FixedTimeContinuePolicy
extends Object
implements ContinuePolicy

An implementation of ContinuePolicy that always provides positive continuation feedback until a fixed amount of time has elapsed in the current transaction. After this time period has elapsed, feedback is always negative for the given transaction. This time period is configurable via the following configuration property:

Property: "com.sun.sgs.impl.service.task.continue.threshold"
Default: 10L
Specifies the time in milliseconds from the start of a transaction during which the shouldContinue method will return true. After this period of time has elapsed in a transaction, this method will always return false.


Field Summary
static long CONTINUE_THRESHOLD_DEFAULT
          The default continue threshold.
static String CONTINUE_THRESHOLD_PROPERTY
          The property key to set how long a task should run before shouldContinue returns false.
 
Constructor Summary
FixedTimeContinuePolicy(Properties properties, ComponentRegistry systemRegistry, TransactionProxy txnProxy)
          Construct a FixedTimeContinuePolicy instance.
 
Method Summary
 boolean shouldContinue()
          Returns true if the currently running task should do more work if it is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTINUE_THRESHOLD_PROPERTY

public static final String CONTINUE_THRESHOLD_PROPERTY
The property key to set how long a task should run before shouldContinue returns false.

See Also:
Constant Field Values

CONTINUE_THRESHOLD_DEFAULT

public static final long CONTINUE_THRESHOLD_DEFAULT
The default continue threshold.

See Also:
Constant Field Values
Constructor Detail

FixedTimeContinuePolicy

public FixedTimeContinuePolicy(Properties properties,
                               ComponentRegistry systemRegistry,
                               TransactionProxy txnProxy)
Construct a FixedTimeContinuePolicy instance.

Parameters:
properties - the system properties
systemRegistry - the system registry
txnProxy - the system's transaction proxy
Method Detail

shouldContinue

public boolean shouldContinue()
Returns true if the currently running task should do more work if it is available. Otherwise, returns false. This method should only be called from a transactional context.

Specified by:
shouldContinue in interface ContinuePolicy
Returns:
true if the currently running task should do more work if possible; otherwise false
See Also:
TaskManager.shouldContinue()

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