You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Wiström,
Magnus <Ma...@consignit.se> on 2005/12/14 10:03:00 UTC
MINA
Hi,
Is this the right maillist for question regarding MINA?
Magnus
Re: MINA
Posted by Emmanuel Lecharny <el...@gmail.com>.
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
users@mina.apache.org)
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
Re: MINA
Posted by JhuneRGeronimo <jh...@yahoo.com>.
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
>
--
View this message in context: http://www.nabble.com/MINA-tp1936663p19270605.html
Sent from the Apache Directory Project mailing list archive at Nabble.com.
Re: MINA
Posted by Niklas Therning <ni...@trillian.se>.
Wiström wrote:
> Hi,
>
> Is this the right maillist for question regarding MINA?
>
> Magnus
Hi Magnus,
Yes it is. Just make sure you use the prefix [mina] in the subject of
all MINA-related messages.
/Niklas