org.terracotta.async.stealpolicies
Class FallBehindStealPolicy<I>

java.lang.Object
  extended by org.terracotta.async.stealpolicies.FallBehindStealPolicy<I>
All Implemented Interfaces:
StealPolicy<I>

public class FallBehindStealPolicy<I>
extends Object
implements StealPolicy<I>

A steal policy that will allow stealing once a bucket has fallen behind the thief by a certain amount of time.

In practical terms this means a bucket can be stolen from if its last processing time was more than the threshold time before the thief's last processing time.


Constructor Summary
FallBehindStealPolicy(long maxAllowedFallBehind)
           
 
Method Summary
 boolean shouldSteal(ProcessingBucket<I> victim, ProcessingBucket<I> thief)
          Returns true if the thief bucket can steal work items from the victim bucket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FallBehindStealPolicy

public FallBehindStealPolicy(long maxAllowedFallBehind)
Parameters:
maxAllowedFallBehind - the amount of milliseconds that the victim is allowed to fall behind the thief before its work gets stolen
Method Detail

shouldSteal

public boolean shouldSteal(ProcessingBucket<I> victim,
                           ProcessingBucket<I> thief)
Description copied from interface: StealPolicy
Returns true if the thief bucket can steal work items from the victim bucket.

Specified by:
shouldSteal in interface StealPolicy<I>
Parameters:
victim - bucket being stolen from
thief - bucket doing the stealing
Returns:
true if stealing is permitted


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.