Your code is wrong because you swallow the interrupted exception, so you will call getMessage even if you got a timeout condition hence the null value returned.
Jeff On Wed, Oct 30, 2013 at 10:40 AM, 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 > -- Jeff MAURY "Legacy code" often differs from its suggested alternative by actually working and scaling. - Bjarne Stroustrup http://www.jeffmaury.com http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
