Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you consider a synchronous implementation for the event bus ? #6

Open
GoogleCodeExporter opened this issue Aug 21, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 24 Jan 2012 at 9:07

@GoogleCodeExporter
Copy link
Author

There is a second constructor available for BasicEventBus that dispatches the 
events in a synchronized way, see BasicEventBus#BasicEventBus(ExecutorService 
executorService, boolean waitForHandlers)

Maybe this is what you are looking for?


Original comment by [email protected] on 30 Apr 2012 at 7:37

@GoogleCodeExporter
Copy link
Author

What I believe OP meant is support for single-threaded bus implementation.

It would have its uses in simple applications where MT synchronization is 
overkill particularly if app is using single-threaded GUI frameworks such as 
SWT.

Rather than implementing whole new EventBus implementation, I believe better 
solution would be to extend BasicEventBus with one additional "notify" method 
that should have the exact same functionality as "publish" has now, but will 
bypass both event queue and executorService and will send events to subscribes 
directly, blocking in call until all subscribers are notified.

I believe I could supply a patch if maintainer is currently unable to, but 
would still need him to revise and accept it.

Original comment by [email protected] on 8 May 2012 at 7:24

@GoogleCodeExporter
Copy link
Author

I just sent an e-mail to Adam and now I feel pretty dumb, I'm looking for 
exactly  that feature, though I think for consistencies sake it should still be 
called "publish". 

An argument at the bus' construction to specify the threading mode would be my 
suggestion, though I'm not sure of the differences between using the singleton 
EventBusService and constructing your own BasicEventBus.

Original comment by Groostav on 23 May 2013 at 9:23

@GoogleCodeExporter
Copy link
Author

Eventually, I've switched to Guava's EventBus:

   https://code.google.com/p/guava-libraries/wiki/EventBusExplained

I brings some overhead of whole Guava lib to your project, but otherwise is a 
very nice event bus implementation.

Original comment by [email protected] on 24 May 2013 at 7:52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant