boolean await(long timeoutMillis)
throws InterruptedException
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/InterruptedException.html?is-external=true>
Wait for the asynchronous operation to complete with the specified timeout.
Returns:true if the operation is completed.
So I think you should check the return value of await method to ensure
there is data to read
On Wed, Oct 30, 2013 at 5:40 PM, Joachim Rodrigues <
[email protected]> wrote:
> Hi I'm working on a multi threaded project that create about 200
> simltaneous threads.
> For each thread i have a mina connection to a server.
>
> And sometimes when retrieving the response, the object response is null
>
>
> Object response = null;
>
> session.write(frame);
> if (frame.isWaitForResponse()) {
> ReadFuture read = session.read();
> try {
> read.await(collectorResponseTimeOut);
> } catch (InterruptedException e) {
> e.printStackTrace();
>
> }
> response = read.getMessage();
>
>
>
> it stoped to be null when i added
>
> response.getClass();
>
> at the end, just after response = read.getMessage();
> Then no more null objects.
>
> Does anyone knows why ?
>
>
> Thanks
>