First off, you don't need to synchronize on the iosession. IoSession
is thread safe so you can have multiple threads calling
IoSession.write(). I don't think that would be causing the problem
your seeing though.
To clarify your problem, the server doesn't receive requests from the
first client but it does receive requests from the second client?
Have you been able to verify the first client is actually sending data
to the server? Could it be a server problem?
-Mike
On 8/3/07, Pradheep <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm facing an issue when the multiple threads are accessing the session
> (IOSession) concurrently. <br>
>
> ISSUE
> When the client is invoked with multiple threads, the client keeps sending
> the requests to but the packets never reach the server. at one point of time
> all the threads are waiting for the resposne ie the client is completely
> blocked.
>
> But when a new client connects to it, it works fine, but the previous client
> simply waits for response
> (the server prints each request it receives)
>
> Question Are there any such known issues on MINA or is it problem with the
> way the code operates (pseudo code is given below).
>
> --------------------------------------------------------------------------------------------------------------------------
> void sendAndWaitForResponse() {
> synchronized(iosession) {
> Response responseMessage = new Respons();
> iosession.write(message); // write the bytes in to session
> map.put(requestID,response) //store the response object in a MAP -
> with an id
> responseMessage.wait();
> }
> }
>
> void responseReceived(Response receivedResposne) {
>
> Response lockedResponse = map.get(receivedResposne.getID());
> lockedResponse.notify();
> }
> --------------------------------------------------------------------------------------------------------------------------
>
> Note - It is very much sure that ID generation produces unique key.
>
> Thanks in advance,
> Let me know if you need more information.
>
> regards,
> Pradheep.
> --
> View this message in context:
> http://www.nabble.com/An-issue-with-multiple-threads.....---Reposted-due-to-formatting-issues-tf4213558s16868.html#a11986763
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
>
>