Partially read messages
-----------------------

                 Key: DIRMINA-263
                 URL: http://issues.apache.org/jira/browse/DIRMINA-263
             Project: Directory MINA
          Issue Type: Wish
    Affects Versions: 0.9.5
         Environment: win xp
            Reporter: Hooman Valibeigi


assume we have a client that sends its requests consecutively ()
I tested it using MINA and I found that MINA only notifies the server side 
IoHandler one time for a sequence of requests
I mean when the client sends 3 consecutive requests the server's 
messageReceived method will be invoked only once
(a Request in my opinion is a package containing a request ID and data related 
to the request)
so my question is how should we handle the ByteBuffer that contains more than 
one requests ?
the other IoSessions should not wait while the server is processing the 
interminable requests of a client
in other word the server becomes busy while processing all sent and incoming 
requests of one client and may never finish
even If it responds to the first buffered request in ByteBuffer and leave the 
remaining requests in hope that they will remain intact for the next 
messageReceived invocation from the same IoSession, it is wrong, since any 
remaining byte in ByteBuffer will be released after the messageReceived method 
is finished, whether we read them or not
so we should read all the incoming bytes or we will lose them
I ask you what is the correct solution to handle these kind of requests ?
in short, I want to process one request per messageReceived invocation and I 
expect that IoHandler will notify me again if I have unread data from previous 
messageReceived calls
this question may be translated in other way as below
when is messageReceived invoked ?
- when the selecetor selects a socket which is readable ?
- so what happens if I dont process all the available data (all requests) 
within the ByteBuffer in one shot ?
- also another question arise. is there any chance that the ByteBuffer 
parameter from messageReceived, does not have the full request data ? I mean is 
it possible that a request arives in several messageReceived calls ? I ask this 
because a ByteBuffer has a limit so It brings in mind that we may encounter 
several problems
such that
- a ByteBuffer containing one partial request
- a ByteBuffer containing more than one request (all complete)
- a ByteBuffer containing more than one request (but the last one is partial)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to