DefaultDispatchQueue implementation problem

Thorsten Möller <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <003501c383a6$f7167600$33d71e8d@Thoro>
Hi!

After some hours of debugging I found out that there is a really bad design
problem with the implementation of DefaultEventQueue.listRemainingEvents().
Let me explain. Suppose you have a event hierarchy like this:

<req-events>
    <event name="Level0">
        <event name="Level1">
            <event name="Level2">
                <event name="Level3a"/>
                <event name="Level3b"/>
            </event>
        </event>
    </event>
</req-events>

When there is a call to event "Level3a" the event processing starts with
event "Level0". The events "Level1", "Level2" and "Level3a" also remain to
get processed. So far so good. My event handler listening on "Level0" events
looks like this:

public void handleControlEvent(ControlEventContext context) throws
EventException, ServletException, IOException
{
    ...
    if (context.getQueue().listRemainingEvents().size() == 0)
    {
        // inside code will always get executed since size is always 0 no
matter if there was a direct call
        // on this event or on child events
    }
    ...
}

But, as the name "listRemainingEvents" suggests, the method should return a
list with 3 elements: Level1, Level2 and Level3a or to be precise: only a
call on event Level0 should return an empty List, likewise a call on event
Level2 should return a list with two elements (Level1 and Level2).
Please note that I only talked about the event handler which listens on
Level0 events and the assumption that there are no other events (view or
whatever) on the queue.
To sum up the problem: in my opinion the implementation of
listRemainingEvents is wrong and should immediately changed the way I
described. If that's not possible at least a new method should be added.


Regards
Thorsten
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.