HashedWheelTimer & Delegation

Kirtimaan (Gmail) kirtimaan.mg at gmail.com
Thu Nov 18 05:22:03 EST 2010


Hi,
 
Is it possible to pass a class reference to HashedWheelTimer while setting a
newTimeout job.
 
What I want achieve is using a single HashedWheelTimer object to execute a
method at fixed interval for each connected client. This method is part of
business logic and deals with user instance, so defined inside channel
handler (which is extending IdleStateTimer) and stateful.
 
I defined a HashedWheelTimer already for idlestate detection in my custom
pipeline factory. I thought of defining another one in my main class as
static member (or even using the same existing instance) to schedule task
for each client based on condition. Task could be like after every 20 second
send update to client A, after every 15 second send list of clients to
client B (means not a single task and depends on conditions and client
instance).
 
One option could be that I extend TimerTask and pass & store my logic class
reference to that. Then add a time out task using HashedTimeoutTask
newTimeout(task, delay, unit) where task is object of CustomTimerTask type.
 
Using separate Timers doesn't sound like a good idea to me, as that's not
performance friendly option. Because then it will create a separate thread
to manage timer for each connected client. Other option which I thought for
a moment is using something like quartz-scheduler, but then it will make
stuff little complex for me.
 
If its not a proper way to do what I am trying, could any one suggest a
better or proper way. 
 
Thanks,
Kirtimaan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20101118/dfbe71ae/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 46417 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20101118/dfbe71ae/attachment-0001.gif 


More information about the netty-users mailing list