You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by fff <mi...@gmail.com> on 2007/07/30 14:19:24 UTC
multithread in Handler
hello,guys:
first,thanks for your working on mina.We are developing with mina for
sevaral monthes,and pay few attention at something like socket because
of your good jobs.
Now,I have a problem with mina ,multithreads is reqired in
handler,exactly in a demuxingHandler.One kind message is devided into
types by a property called "dataMessageType",these types come from one
connection,but have to be processed synchronously.
Is there any advise?Thanks for reading any way.=)
Re: multithread in Handler
Posted by Trustin Lee <tr...@gmail.com>.
On 7/31/07, fff <mi...@gmail.com> wrote:
> Trustin Lee wrote:
> > On 7/30/07, fff <mi...@gmail.com> wrote:
> >> hello,guys:
> >> first,thanks for your working on mina.We are developing with mina for
> >> sevaral monthes,and pay few attention at something like socket because
> >> of your good jobs.
> >
> > Good to hear that. Please give us feed back whenever you have any
> > issue with MINA. :)
> >
> >> Now,I have a problem with mina ,multithreads is reqired in
> >> handler,exactly in a demuxingHandler.One kind message is devided into
> >> types by a property called "dataMessageType",these types come from one
> >> connection,but have to be processed synchronously.
> >> Is there any advise?Thanks for reading any way.=)
> >
> > If the messages come from one connection, all messages will be
> > processed sequentially. Is this what you want?
> >
>
> Isn't it the default behave of mina acceptor?Or any other?
> What we are excepting is Not in sequentially,but at the same time.
I see. Then I'd create a shared executor and forward tasks in
MessageHandler there. Otherwise, you could create your own
ExecutorFilter that processes events simultaneously. If you are using
trunk (2.0.0-M1-SNAPSHOT), then you could simply use
UnorderedExecutorFilter, which is what exactly you are looking for.
> Our product is not only an acceptor,but also with numbers of connectors
> in it,which connect to a farther server.Both of them are through TCP.For
> example,If i'm one user,I make a connection to Acceptor,after
> authorization I make a Connector between Acceptor and the farther
> server,and keep this line live.
> The massages travel like this:
> client(C)<->acceptor(A)<->connector()<->fartherServer(S)
> The problem is when a msg comes to A,A processes it and sends to
> S,without be replied,another msg come to A,but A now is Thread.sleep()
> for reply,so the handler is blocked for new msg.
> how to process this new msg at once,when handler is waitting for the
> ealier's reply?
The solution I suggested above will fix your problem.
> likely,it does nothing with mina,hah =),thanks again.
No problem! :)
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
Re: multithread in Handler
Posted by fff <mi...@gmail.com>.
Trustin Lee wrote:
> On 7/30/07, fff <mi...@gmail.com> wrote:
>> hello,guys:
>> first,thanks for your working on mina.We are developing with mina for
>> sevaral monthes,and pay few attention at something like socket because
>> of your good jobs.
>
> Good to hear that. Please give us feed back whenever you have any
> issue with MINA. :)
>
>> Now,I have a problem with mina ,multithreads is reqired in
>> handler,exactly in a demuxingHandler.One kind message is devided into
>> types by a property called "dataMessageType",these types come from one
>> connection,but have to be processed synchronously.
>> Is there any advise?Thanks for reading any way.=)
>
> If the messages come from one connection, all messages will be
> processed sequentially. Is this what you want?
>
Isn't it the default behave of mina acceptor?Or any other?
What we are excepting is Not in sequentially,but at the same time.
> HTH,
> Trustin
Our product is not only an acceptor,but also with numbers of connectors
in it,which connect to a farther server.Both of them are through TCP.For
example,If i'm one user,I make a connection to Acceptor,after
authorization I make a Connector between Acceptor and the farther
server,and keep this line live.
The massages travel like this:
client(C)<->acceptor(A)<->connector()<->fartherServer(S)
The problem is when a msg comes to A,A processes it and sends to
S,without be replied,another msg come to A,but A now is Thread.sleep()
for reply,so the handler is blocked for new msg.
how to process this new msg at once,when handler is waitting for the
ealier's reply?
likely,it does nothing with mina,hah =),thanks again.
Re: multithread in Handler
Posted by Trustin Lee <tr...@gmail.com>.
On 7/30/07, fff <mi...@gmail.com> wrote:
> hello,guys:
> first,thanks for your working on mina.We are developing with mina for
> sevaral monthes,and pay few attention at something like socket because
> of your good jobs.
Good to hear that. Please give us feed back whenever you have any
issue with MINA. :)
> Now,I have a problem with mina ,multithreads is reqired in
> handler,exactly in a demuxingHandler.One kind message is devided into
> types by a property called "dataMessageType",these types come from one
> connection,but have to be processed synchronously.
> Is there any advise?Thanks for reading any way.=)
If the messages come from one connection, all messages will be
processed sequentially. Is this what you want?
HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6