Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android and javafx lightweight compatible event framework

My requirement is that I am looking for an light weight event framework which is compatible in Android and Java Fx( Windows and Linux platform) so that it runs seamless in both the technologies.

I researched for existing event based frameworks.
1) Eventing framework mbassador (by bennidi)-> is it compatible with android 4.0 (Ice Cream sandwich) as it works fine with javafx and is lightweight and performance is also good.
2) Guava EventBus :- From documentation it seems it is compatible with android but what about performance and is it better then mbassador.

like image 251
dbw Avatar asked Aug 26 '13 06:08

dbw


1 Answers

Eventing framework MBassador is compatible with Android 4.0.
Guava Event Bus is lightweight and also compatible with both the technologies.

Both the above framework are lightweight and provide robust mechanism for Subscribe/Publish pattern and according to description of MBassador it's initial design was inspired from Guava Event Bus but the Strong reference to listeners used in Guava Event Bus was problem in some scenario.

According to credits section in description at GitHub MBassador

The initial inspiration for creating this component came from trying out Google Guava's event bus implementation. I liked the simplicity of its design and I do trust the developers at Google a lot, so I was happy to find that they also provided an event bus system. The main reason it proved to be unusable for our scenario was that it uses strong references to the listeners such that every object has to be explicitly deregistered. This was difficult in our Spring managed environment. Finally, I decided to create a custom implementation, which then matured to be stable, extensible and yet very efficient

Both the framework are robust, lightweight and it depends on your requirement which one to use.

I have found performance comparison on [Java event bus library comparison]](http://codeblock.engio.net/?p=37) (I got the results from google cached page of this site) where Google Guava, SimpleBus, EventBus and mbassador frameworks were compared and MBassador was the clear winner.

EDIT: I removed the picture snapshot and just focusing on end results,

The shown performance characteristics of the compared implementations indicate that,
1. Listener subscription is an expensive operation for all implementations but MBassador and Guava
2. Concurrent access does generally slow down the bus performance because of higher contention/synchronization.
3. SimpleBus is by far the slowest implementation.
4. MBassador is by far the fastest implementation in all scenarios. It also offers the best scaling characteristics meaning that higher concurrency rates do not slow down the bus performance as much as the others. This is because MBassador relies on a custom data structure with very fast write operations that do not block readers and at the same time do not copy existing data structures (most other implementations use CopyOnWriteArrayList).

To sum it up For the past few months we have been using MBassador and it holds up to our requirement it is working well in Android, JavaFX and works well in simple java too on Linux, Windows, Mac etc O.S.

like image 186
dbw Avatar answered Nov 01 '22 17:11

dbw