org.ow2.util.pool.impl.enhanced.internal.resizer.impl
Class AsynchronousResizer<S>

java.lang.Object
  extended by org.ow2.util.pool.impl.enhanced.internal.resizer.impl.AsynchronousResizer<S>
Type Parameters:
S - statistics type
All Implemented Interfaces:
java.lang.Runnable, IResizer<S>

public class AsynchronousResizer<S>
extends java.lang.Object
implements IResizer<S>, java.lang.Runnable

Author:
Gael Lalire

Constructor Summary
AsynchronousResizer(IResizer<S> poolResizer)
           
AsynchronousResizer(IResizer<S> poolResizer, int threadCount)
           
 
Method Summary
 void prepareUpdate(S state)
          Prepare an update (calculate next value of expectedSize).
 void run()
           
 void setResizable(IResizable resizable)
          Resizer will call method on it.
 void update()
          This method grant that eventually at least one call will be made to setExpectedSize, with stats calculated by latest call to prepareUpdate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchronousResizer

public AsynchronousResizer(IResizer<S> poolResizer)

AsynchronousResizer

public AsynchronousResizer(IResizer<S> poolResizer,
                           int threadCount)
Method Detail

prepareUpdate

public void prepareUpdate(S state)
Description copied from interface: IResizer
Prepare an update (calculate next value of expectedSize). When this method returns the calcul must be complete (no asynchronous mechanism can be used).

Specified by:
prepareUpdate in interface IResizer<S>
Parameters:
state - statistics

update

public void update()
Description copied from interface: IResizer
This method grant that eventually at least one call will be made to setExpectedSize, with stats calculated by latest call to prepareUpdate. When this method returns you cannot know if the setExpectedSize have been called (asynchronous mechanism like watchDog or delegation to another thread can be used).

Specified by:
update in interface IResizer<S>

run

public void run()
Specified by:
run in interface java.lang.Runnable

setResizable

public void setResizable(IResizable resizable)
Description copied from interface: IResizer
Resizer will call method on it.

Specified by:
setResizable in interface IResizer<S>
Parameters:
resizable - a resizable


Copyright © 2007-2009 OW2 Consortium. All Rights Reserved.