Speaking of ScheduledExecutor; JBoss Netty's timer

View: New views
2 Messages — Rating Filter:   Alert me  

Speaking of ScheduledExecutor; JBoss Netty's timer

by Elias Ross :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

JBoss Netty ships with (basically) a scheduled pooled executor that is optimal for I/O cancellation tasks. Here's the Javadoc. It's worth reading the paper it's based on:

http://www.jboss.org/file-access/default/members/netty/freezone/api/3.1/org/jboss/netty/util/HashedWheelTimer.html

The slides pointed to in the Javadoc link to a good explanation of the time/space trade-offs per operation for this data structure:

http://www.cse.wustl.edu/~cdgill/courses/cs6874/TimingWheels.ppt

Since it's segmented, it seems much better designed for multi-threaded use. Like ConcurrentHashMap, there is a separate bucket for each time interval.

Cancelation is a constant time operation.

Only unfortunate aspect of this class is that none of the interfaces from java.util.concurrent are used, e.g. ScheduledFuture or ScheduledExecutorService.

_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@...
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

Re: Speaking of ScheduledExecutor; JBoss Netty's timer

by Trustin Lee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Elias et al,

Here's the link to the source code:

    http://anonsvn.jboss.org/repos/netty/trunk/src/main/java/org/jboss/netty/util/HashedWheelTimer.java

and here's the link to the syntax-highlighted version:

    http://fisheye.jboss.org/browse/Netty/trunk/src/main/java/org/jboss/netty/util/HashedWheelTimer.java?r=1850

If someone is interested in picking up this implementation and
including it in j.u.concurrent, I would be happy to discuss with my
boss about relicensing it under the license that OpenJDK prefers.

The data structure is very simple, so it shouldn't be difficult to
write from scratch though if you really want.

HTH

— Trustin Lee, http://gleamynode.net/

On Fri, Oct 30, 2009 at 12:27 AM, Elias Ross <genman@...> wrote:

> JBoss Netty ships with (basically) a scheduled pooled executor that is
> optimal for I/O cancellation tasks. Here's the Javadoc. It's worth reading
> the paper it's based on:
>
> http://www.jboss.org/file-access/default/members/netty/freezone/api/3.1/org/jboss/netty/util/HashedWheelTimer.html
>
> The slides pointed to in the Javadoc link to a good explanation of the
> time/space trade-offs per operation for this data structure:
>
> http://www.cse.wustl.edu/~cdgill/courses/cs6874/TimingWheels.ppt
>
> Since it's segmented, it seems much better designed for multi-threaded use.
> Like ConcurrentHashMap, there is a separate bucket for each time interval.
>
> Cancelation is a constant time operation.
>
> Only unfortunate aspect of this class is that none of the interfaces from
> java.util.concurrent are used, e.g. ScheduledFuture or
> ScheduledExecutorService.
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest@...
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>

_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@...
http://cs.oswego.edu/mailman/listinfo/concurrency-interest