High performance java threading library

Hi,

For a multi-threaded NMS module that handles SNMP outbaound sessions and incomming traps, I am looking for a high level API that utilizes the java 1.5/1.6 threading API.

 

I have encountered several libraries, namely they are:

http://tempus-fugit.googlecode.com/svn/site/documentation/concurrency.html

 

http://code.google.com/p/jetlang/

 

http://prometheus.codehaus.org/overview.html

 

http://code.google.com/p/jconch/

 

Has anyone had real experience with any of these libraries or some other library?

 

I only need the threading module not the SNMP module.

 

Thanks,

Comments

http://hawtdispatch.fusesource.org/ I haven't used it, but the concepts sound good.

 

 

Hi,

Thanks, indeed the concept does sound good, while most of the examples are in Scala I shall test it with Junit and report back.

 

It's probably obvious looking through the projects but tempus-fugit is more of an abstraction / helper library over the vanilla Java concurrency library. The other libraries offer a little more in the way of low level funtionality. As it goes, I've achieved good results in terms of performance with just the vanilla stuff and havn't needed the additional bits and pieces some of the other libraries offer. So, if you want a "neater" way to work with the vanialla stuff, tempus-fugit might be a good candidate (if you like the style its written in). If you need additional features, like concurrent collections, then some of the other libraries may suit. I've not used any in earnest but jconch has been around for a while (I'd be concerned with 'correctness' of the low level features in these libraries though, ie, how established/bug free the project are). tempus-fugit is also geared up to helping you test concurrent bits and pieces, how much is useful to you though is another question...

Hi Toby,
First thanks for dropping by and providing your valuable input.
I did actually reach the same conclusion and built a very small package around the native Java 6 threading API. So far, though its in the inception phase, it is easy to work with and the flexibility is very high- e.g. I extended ThreadPoolExecutor and implemented ThreadFactory to have for instance a common thread naming policy and to monitor (by overriding beforeExecute() ete ) Callable<T> and Runnable creation on the lowest level.

I will take note of your comment about the tempus-fugit library and if and once I find that I am not pleased with what I have I shall consider switching. Yes, you are correct with respect to testing, not an easy issue to cope with. At present I am using Junit 4 and considering the use of: 
http://www.cs.umd.edu/projects/PL/multithreadedtc/

Once again thanks for visiting,    

Hi, thanks for the reply. The MultithreadedTC library is really interesting. I've played with the idea of modyfying byte code to force specific interleaving (or randomly generating interleavings) and I'd be very interested to hear how you get on with mTC. Out of interest, what kind of things are you looking to monitoring with before/afters? I've been working on various monitoring platforms for a while so have an interest there too. All the best.

I was folowing the ideas set in this paper:

http://www.ibm.com/developerworks/java/library/j-jtp09196/index.html

See the class:

TrackingThreadPool extends ThreadPoolExecutor

//...

protected void afterExecute(Runnable r, Throwable t) {
        long time = System.currentTimeMillis() - startTime.get().longValue();
        synchronized (this) {
            totalTime += time;
            ++totalTasks;
        }
        inProgress.remove(r);
        super.afterExecute(r, t);
    }