HashedWheelTimer not executing scheduled tasks
esnjonas
jonas.tarnstrom at esn.me
Thu Jul 7 06:42:50 EDT 2011
Hi,
With Thread.sleep(1000) in TimerTask::run and Thread.sleep(10000) before I
stop the Wheel Timer the returned set contains one task but the execCount
still fails.
public class HashedWheelTimerTest
{
private static class TestTimeout implements TimerTask
{
protected final AtomicInteger execCount = new AtomicInteger(0);
public void run(Timeout timeout) throws Exception
{
Thread.sleep(1000);
execCount.incrementAndGet();
timeout.getTimer().newTimeout(this, 100, TimeUnit.MILLISECONDS);
}
}
@Test
public void testExpire() throws InterruptedException
{
HashedWheelTimer wheelTimer = new HashedWheelTimer(100,
TimeUnit.MILLISECONDS);
wheelTimer.start();
TestTimeout tt = new TestTimeout();
wheelTimer.newTimeout(tt, 100, TimeUnit.MILLISECONDS);
Thread.sleep(10000);
Set<Timeout> stop = wheelTimer.stop();
assertTrue(tt.execCount.get() > 1);
}
}
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/HashedWheelTimer-not-executing-scheduled-tasks-tp6557454p6557874.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list