Thoughts on EventManager & async posting

From: Holger Hoffstätte (holge..izards.de)
Date: Mon Nov 24 2003 - 09:32:03 EST

  • Next message: Holger Hoffstätte: "Just done: Plastic themes in modeler"

    Hi!

    After my break I'm slowly getting back into cayenne, catching up with
    mails and everything..lots happened. Maybe I should disappear more
    often? :-)

    Anyway I just took some time to look over the new async event posting
    and wanted to share some thoughts. When I first thought about the
    possible future evolution of the EventManager, I had several things in
    mind; one of these things was the async event posting which is desirable
    for cross-VM posting. While the newly added implementation does just that,
    it differs from my original idea in one important aspect: event posting
    is not transparent anymore since it now seems to be explicitly synchronous
    or asynchronous. I think this is somewhat unfortunate, because now whoever
    posts an event must know about the notification behaviour of all possibly
    registered receivers. Not all receivers can work asynchronously since the
    reception can have consequences in a larger context (other related
    objects, application-wide etc.); unfortunately, in the current setup the
    sender of the event cannot know whether posting an event immediately or
    not is the right thing to do.

    Wouldn't it be easier for the event poster to not have to make this
    decision and instead let each recipient handle this for himself? I guess
    the preference could be set at registration time (in addListener()) and
    the entire management could be implemented for example by separation of
    the notification queues into immediate and asynchronous receivers. I'd
    prefer to see this because it would also apply to, say, prioritization
    (ordered queues not by registration order but rather by receiver priority)
    and possibly other things in the future.
    Originally I wanted to use Doug Lea's excellent Concurrent utilities for
    this (something we should probably do anyway - see
    http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/)
    Another benefit would be that we wouldn't have to make a decision about
    whether synchronous or asynchronous posting should be default.. ;-)

    Hope this made some sense? Thoughts?

    Holger

    PS: good to see that the bridge stuff worked out as planned and that
    JavaGroups works. :-)



    This archive was generated by hypermail 2.0.0 : Mon Nov 24 2003 - 09:32:42 EST