Le 10/30/13 10:40 AM, Joachim Rodrigues a écrit : > 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 ?
What timeout are you using ? Also why do you want to simulate a synchronous mode when using NIO ? It would be better if your frame directly receives the response when the response arrives, something you can do easily with MINA assumng you dispatch the message in your IoHandler. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com