avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Steuck <greg-avalon-...@nest.cx>
Subject RE: EventHandler
Date Fri, 24 May 2002 18:11:45 GMT
>>>>> "Berin" == Berin Loritsch <bloritsch@apache.org> writes:

    Berin> I thought I had the Queues not accept nulls.  Keep in mind
    Berin> I have so swamped, I can barely keep my head above water.

And you had. DefaultQueue does not accept nulls by way of
VariableSizeBuffer.

    Berin> Hmm.  I think I remember someone saying that it is helpful
    Berin> to have null values in the queue.  However, if you did not
    Berin> put the nulls in the queue, we should not have them come
    Berin> out of the queue.  Have you run into that scenario?  If so,
    Berin> then it is in error.

Here's a snippet I am talking about:

public final class TPCThreadManager
    public static final class PipelineRunner implements Runnable
        public void run()
        {
            Source[] sources = m_pipeline.getSources();
            EventHandler handler = m_pipeline.getEventHandler();

            for( int i = 0; i < sources.length; i++ )
            {
                handler.handleEvents( sources[ i ].dequeueAll() );
            }
        }

According to Source.dequeueAll description:
 * Dequeues all available elements, or returns <code>null</code> if there is
 * nothing left on the queue.

So, by interface definitions it is possible that this code would pass
a null into handleEvents.

Hmm, I looked at DefaultQueue.dequeueAll a little closer. It seems to
me, it returns null in case of a failure (when it couldn't obtain the
mutex) and returns an array with length=0 if the queue is empty. Could
somebody else confirm my suspicion?

    Berin> At least I got the event package in order before I had to
    Berin> stop.  I just didn't have time to debug it like I would
    Berin> otherwise want to.

Its grateful users will. Anybody can build on shoulders of giants,
that's why free software is so great.

    Berin> I have been working with C++ projects at work lately.  I
    Berin> have really come to appreciate templates...  I wish I had
    Berin> that facility in Java *now* (it's in a JSR, but not
    Berin> implemented).

Wouldn't AspectJ cover most of the cases where templates are used?
Or do I completely misunderstand both AspectJ and templates?

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message