Balzanka / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Add 'register(Object listener, Executor listenerCaller)' to AsyncEventBus #1349

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently AsyncEventBus simply calls listeners in the separate executor as 
provide in the constructer, yet there is no way for listeners to individually 
control what executor should be used to call them. Ideally we'd have something 
like 'addCallback', where a listener can provide a a specific executor. This 
gives the possibility for the listener to control what executor is calling and 
at the same time makes AsyncEventBus faster as the posting executor is not 
blocked by a listener.

Original issue reported on code.google.com by DeRijcke.Erik@gmail.com on 21 Mar 2013 at 9:57

GoogleCodeExporter commented 9 years ago
Seems related to issue 951.

Original comment by cgdec...@gmail.com on 21 Mar 2013 at 2:59

GoogleCodeExporter commented 9 years ago
Yes it seems issue 951 talks of the same functionality. However important for 
me is not that the event delivery happens asynchronously, but that I know which 
executor is delivering the event, this is needed to make sure that always the 
same executor/thread accesses the listening object, something which can not be 
guaranteed in the current AsyncEventBus.

Original comment by DeRijcke.Erik@gmail.com on 21 Mar 2013 at 7:43

GoogleCodeExporter commented 9 years ago
Would the ability to control what Executor is used to dispatch to a subscriber 
using annotations on the subscriber method work for this? For example, rather 
than specifying an Executor when you register an object, instead annotate each 
method in the class with some annotation of your choice. Then, when you create 
the EventBus you associate that annotation with a specific Executor. This gives 
more fine-grained control over which methods are dispatched with which 
Executors and saves you from having to deal with Executors when registering an 
object, but does mean that you can't register different instances of the same 
type to be handled by different Executors. I'd prefer keeping registration as 
simple as possible.

Original comment by cgdecker@google.com on 26 Jun 2014 at 10:36

GoogleCodeExporter commented 9 years ago
Sounds lovely!

Original comment by DeRijcke.Erik@gmail.com on 27 Jun 2014 at 7:28

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08