Hi Geronimo,
there are obviously two things wrong :
- first you have to check that your client is reading the million
message your are sending,
- second you have to post such a message to the correct mailing list( ie
[EMAIL PROTECTED])
JhuneRGeronimo wrote:
Geronimo wrote:
Hi,
I had run this simple code below for 2 hours and look what happen... Is
there anybody explain and help me why a simple test like this will hit the
memory.
my Server :
public class Server2 {
public static void main(String[] args) throws IOException {
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
int PORT = 8999;
IoAcceptor acceptor = new SocketAcceptor(2,
Executors.newCachedThreadPool());
IoServiceConfig cfg = acceptor.getDefaultConfig();
TextLineCodecFactory factory = new
TextLineCodecFactory(Charset.forName("UTF-8"));
factory.setDecoderMaxLineLength(2048);
cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(factory));
acceptor.bind(new InetSocketAddress(PORT), new ioHandler(), cfg);
}
}
my Handler
public class ioHandler extends IoHandlerAdapter {
public void exceptionCaught(IoSession session, Throwable t) throws
Exception {
t.printStackTrace();
session.close();
}
public void messageReceived(IoSession session, Object msg) throws
Exception {
String str = msg.toString();
if( str.trim().equalsIgnoreCase("quit") ) {
session.close();
return;
}
Date date = new Date();
Thread.sleep(840);
for(int i = 0 ;i<1000000; i++ ){
Thread.sleep(100);
session.write("\n
<action>01</action><action>01</action><action>01</action><action>01</action><action>01</action><action>01</action><action>01</action><action>01</action><action>01</action><action>01</action><action>01</action><action>01</action>
" + i + "\n" );
}
WriteFuture sw = session.write( date.toString() );
System.out.println("Message written...");
}
public void sessionCreated(IoSession session) throws Exception {
System.out.println("Session created...");
if( session.getTransportType() == TransportType.SOCKET )
((SocketSessionConfig) session.getConfig()
).setReceiveBufferSize( 2048
);
session.setIdleTime( IdleStatus.BOTH_IDLE, 10 );
}
}
result for 2 HOURS...
http://www.nabble.com/file/p19248923/mina.jpg
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org