开发者

When to use OSGi EventAdmin and when not?

开发者 https://www.devze.com 2023-03-27 11:21 出处:网络
I have a general question regarding the usage of the OSGi EventAdmin service. I\'m currently using it in开发者_JAVA技巧 a setting where potentially thousands of events can be generated per second. Myf

I have a general question regarding the usage of the OSGi EventAdmin service. I'm currently using it in开发者_JAVA技巧 a setting where potentially thousands of events can be generated per second. My fear is that the EventAdmin service might be a bottleneck. Initial results I get from my profiler seem to support this. The questions I have are:

  1. Is there a general rule of thumb when to use the EventAdmin service?
  2. How do the sendEvent and postEvent methods differ in terms of performance?
  3. Is there a particular OSGi container which is known to have a low performing EventAdmin implementation?

Thanks in advance for your support!

Cheers, Georg


Do you have more information about the bottleneck you see?

We have an update coming for the Event Admin spec (see RFC 157 in [1]) to aid some performance issues. But this is not completed spec work yet.

Send event is a synchronous send, so the calling thread blocks until all listeners have been notified. Most implementations use the callers thread. Post event does not block the caller. It queues the work for another thread to deliver the event. The current Event Admin spec requires ordering for async events, so this can cause delays if ordering is not required. RFC 157 provides the ability to not require this ordering.

I have no data on whether one implementation before better or worse than another.

[1] http://www.osgi.org/Download/File?url=/download/osgi-4.3-early-draft2.pdf

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号