JavaEventing - An easy to use eventing library for Java
code.google.com
code.google.com
For m events with n handlers, that's mn+m threads. 100 events w/ 5 handlers? That's 600 new threads.
If you have frequent events or your handlers take any time at all, you're dead. This will simply grind to a halt under any kind of real load.
As a point of comparison, I put together a quick Python script that defines a simple single-threaded event dispatcher and then does the same thing as your testPerformance() test, and it handles over 296k events/s on my machine (where javaEventing handles 3.7k).
This use of multi-threading is used to achieve full asynchronisity
The way that you're currently synchronizing, the only concurrency you're seeing is for your handlers. You only trigger and dispatch out to handlers one event at a time.
There are two scenarios where threads are always going to be unavoidably slow: high contention, and processor-bound tasks with more threads than processors. Your current synchronization policy pretty much assures you're going to run into high contention, and if you're using this for processor-bound tasks, you're going to pay a severe tax for the number of threads you're generating, as well.
Put in the threadpool. Take a look at ConcurrentHashMap and CopyOnWriteArrayList. Work on your synchronization policy. High throughput concurrency and eventing is hard, but Java actually has a lot of nice building blocks to work with. If you want a good overview, you should check out Brian Goetz's Java Concurrency in Practice.
I'm not sure why you're bothered by inner classes, though. Anonymous inner classes are a very common way to write event-handling code in java, especially if the handler needs to capture some enclosing scope for later use.
Edit: this project is more interesting in the context of the owner's other two projects: http://code.google.com/u/skjervold/
As to your concerns regarding the static use of the EventManger, I can apprechiate your point of view. I'll put it on my todo-list for the next version.
Anyone have any production level experience with this library?
How is it's maturity/stability?