You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Karasulu <ao...@bellsouth.net> on 2004/11/03 00:13:54 UTC

[seda] many reply handlers

Hey Trustin,

I was just lookin at the code and it looks like handlers that return 
multiple responses for a request are stubbed out.    I think I left it 
that way back :).  No worries I can cap it off but I want to ask a few 
questions about synchronization first. Take a look here at 
reply(ManyReplyHandler):

http://svn.apache.org/viewcvs.cgi/incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java?rev=56429&view=auto

    /**
     * Handles the generation and return of multiple responses.
     *
     * @param handler the handler that generates the responses
     * @param request the request responded to
     */
    private void reply( ManyReplyHandler handler, Object request, ClientKey key )
    {
        Object response = null;

        try
        {
            Iterator list = handler.handle(key, request);

            if (handler.isSequential())
            {
                while (list.hasNext())
                {
                    response = list.next();

                    // @todo: need to force serialized response processing
                    // perhaps we need to add an isResponseOrdered or a
                    // response sequence number for multi-part responses
------------------> throw new UnsupportedOperationException("need response serialization");

Basically I would iterate through the list and generate a response event 
for each item.  Each item is a response to the same request.   Now you 
had mentioned some changes to use a queue that orders events in the 
right way so as to return the events back to the client in the order 
they were created for ManyReplyHandlers. 

If I publish these responses off the Iterator above as ResponseEvent 
will the order of event delivery automagically be in the order of event 
creation?

Thanks in advance,
Alex


Re: [seda] many reply handlers

Posted by Trustin Lee <tr...@gmail.com>.
> Basically I would iterate through the list and generate a response event
> for each item.  Each item is a response to the same request.   Now you
> had mentioned some changes to use a queue that orders events in the
> right way so as to return the events back to the client in the order
> they were created for ManyReplyHandlers.
> 
> If I publish these responses off the Iterator above as ResponseEvent
> will the order of event delivery automagically be in the order of event
> creation?

Yes, exactly.  OrderedThreadPool will handle the order.

-- 
what we call human nature in actually is human habit
--
http://gleamynode.net/