mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hieu Phan Thanh" <hie...@Cybersoft-VN.com>
Subject RE: Message was not fired to the last filter "IoHandler" - Deadlock
Date Mon, 18 Dec 2006 08:52:21 GMT
Is there anyone could help me to solve this one?

My application works as a client send several messages to server via ACK
protocol.
After sending some message successfully, the application is hang out
when finhing decoding the message and call
ProtocolDecoderOutput.write(Object) for next filter?

I'm not sure this kind of problem is due to my code or MINA. Any help is
highly appriciated.

Regards,
Hieu Phan.  

> -----Original Message-----
> From: Hieu Phan Thanh [mailto:hieupt@Cybersoft-VN.com] 
> Sent: Monday, December 11, 2006 4:16 PM
> To: dev@mina.apache.org
> Subject: Message was not fired to the last filter "IoHandler" 
> - Deadlock
> 
> Hi everybody,
> 
> I have got a problem around the "message fired" method.
> After receiving some message successfully, the application is 
> deadlock after the "decode" method was returned, that mean 
> the application could not call the "messageReceived" method.
> Any help is very highly appreciated.
> 
> Thanks, Hieu Phan.
> 
> Here are some details about the application:
> 
> --getSession method START------------
> 	public synchronized static IoSession getSession() {
> 		appendDebugLog("Trying to connect to K/S 
> Station...", true);
> 		
> 		// Change the worker timeout to 1 second to 
> make the I/O thread quit
> 		// soon
> 		// when there's no connection to manage.
> 		connector.setWorkerTimeout(1);
> 		
> 		// Configure the service.
> 		SocketConnectorConfig cfg = new SocketConnectorConfig();
> 		cfg.setConnectTimeout(CONNECT_TIMEOUT);
> 		
> 		cfg.getFilterChain().addLast("codec",
> 				new ProtocolCodecFilter(new
> BcClientProtocolCodecFactory()));
> 
> 		Executor protocolExecutor =
> Executors.newFixedThreadPool(SysConfig.MAX_IO_THREAD_POOL);
> 		cfg.getFilterChain().addLast("threadpool", 
> 				new ExecutorFilter(protocolExecutor));
> 		
> 		IoSession session;
> 
> 		try {
> 			ConnectFuture future = 
> connector.connect(new InetSocketAddress(
> 					KS_SERVER, KS_PORT), new
> BcClientSessionHandler(), cfg);
> 
> 			future.join();
> 			session = future.getSession();
> 			
> 			appendDebugLog("Connect to K/S Station 
> successfully.", true);
> 		} catch (RuntimeIOException e) {
> 			appendInfoLog("Could not connect to K/S 
> Station.", true);
> 			session = null;			
> 		}
> 
> 		return session;
> 	}
> --getSession method END------------
> 
> --decode method START--------------
> 	public MessageDecoderResult decode(IoSession session, 
> ByteBuffer in,
> 			ProtocolDecoderOutput out) throws Exception {
> 		logger.debug("[DECODER] decoding AckMessage...");
> 		
> 		AckBcMessage ackMessage = new AckBcMessage();
> 		
> 		try {
> 			ackMessage.setReceivedMsgSize(in.getString(10, 
> 					Constants.CHARSET_DECODER));
> 		} catch (CharacterCodingException e) {		
> 			logger.error("DECODER] Exception: ", e);
> 		}
> 
> 		logger.debug("ACK = " + ackMessage);
> 		out.write(ackMessage);
> 		logger.debug("[DECODER] decoding AckMessage is 
> completed.");
> 		return MessageDecoderResult.OK;
> 	}
> --decode method END--------------
> 
> 
> 


Mime
View raw message