org.codehaus.wadi.impl
Class CapacityEvicter

java.lang.Object
  extended byorg.codehaus.wadi.impl.AbstractEvicter
      extended byorg.codehaus.wadi.impl.AbstractBestEffortEvicter
          extended byorg.codehaus.wadi.impl.CapacityEvicter
All Implemented Interfaces:
Evicter, Lifecycle

public class CapacityEvicter
extends AbstractBestEffortEvicter

Evict based on an intended capacity. In other words, if the number of sessions grows over a parameterised limit, reduce it until it falls within it. Since strictOrdering is forced, and a Comparattor is supplied, sessions will be evicted according to their lastAccessedTime. Those that have been inactive for the most time will be evicted first.

Version:
$Revision: 1139 $
Author:
Jules Gosnell

Field Summary
protected  int _capacity
           
protected  Comparator _comparator
           
 
Fields inherited from class org.codehaus.wadi.impl.AbstractBestEffortEvicter
_config, _lockLog, _log, _strictOrdering, _sweepInterval, _task
 
Constructor Summary
CapacityEvicter(int sweepInterval, int capacity)
           
 
Method Summary
 Comparator getComparator(long time)
           
 boolean test(Evictable evictable, long time, long ttl)
           
 
Methods inherited from class org.codehaus.wadi.impl.AbstractBestEffortEvicter
destroy, evict, init, insert, remove, setLastAccessedTime, setMaxInactiveInterval, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_comparator

protected final Comparator _comparator

_capacity

protected final int _capacity
Constructor Detail

CapacityEvicter

public CapacityEvicter(int sweepInterval,
                       int capacity)
Method Detail

getComparator

public Comparator getComparator(long time)
Overrides:
getComparator in class AbstractBestEffortEvicter

test

public boolean test(Evictable evictable,
                    long time,
                    long ttl)


Copyright © 2004-2008 Core Developers Network Ltd.. All Rights Reserved.