directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: [mina] MINA server design question
Date Fri, 15 Jul 2005 06:16:26 GMT
Hi Karim,

I apologize for my late reply. I almost forgot to reply.

2005/7/14, <>:
> What I am trying to implement is, provide a MINA server. The MINA server
> will be client of a third party TCP/IP socket milage server that serves
> milage calculation. It accepts TCP/IP socket requests in ASCII form on
> multiple ports. The way it works is, client opens a connection, it 
> confirms
> that connection is ok. Then client send milage calculation request and it
> sends multi-line response. The connection between client(in this case MINA
> server) and milage server never gets disconnected. On that open connection
> it keeps serving. The reason it does that is to avoid cost of opening a
> connection.

I see. You can do that with MINA.

Now in the attached code I've done some POC. It is a mixture of sumup and
> reverse example. As you can see that it opens a new connection for every
> request. Now my questions to you are;
> 1. How do I keep the connection between MINA server and milage server keep
> open and keep sending new milage requests on that same opened connection?

Connection is not closed if you don't call session.close(), so you don't 
need to worry about that.

2. How does MINA server works with multiple ports on milage server?

You can bind same protocol provider to more than one ports. Just call 
Acceptor.bind() as many times as you want. 

3. How does the connection pooling and thread management will be working
> between MINA server and milage server? Also between MINA server and its
> clients (in my case these may be EJB calls)?

We use leader-followers thread pool. It keeps the order of events fired 
sequential not compromising performance. More than one threads can handle 
one connection because threads are reused for all connections. So you cannot 
use any mechanism that uses Thread.currentThread() as a key such as 
ThreadLocal. But MINA provides user-defined attributes in Session. Please 
take a look at IoSession.get/setAttribute().

I didn't look into your code yet. Please let me know my reply is not 
sufficient. I'll take a look at the code and answer again.

what we call human nature is actually human habit

View raw message