You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by steview <st...@jofti.com> on 2007/11/18 22:15:51 UTC

using SimpleIoProcessorPool in multiple acceptors

Hi,
I have a requirement similar to the following

A client connects on a well known port and then is issued a directive to
another port to connect to (all  this is tcp/ip based).

This can be a growing list of ports (possibly thousands) - I want to deal
with using the 2.0 mina trunk - however, I am struggling with the concepts
in 2.0.
In 1.x I believe I could have used the acceptor.bind(localAddress, handler,
config) method to add these ports to the existing acceptor (which was
laready running) . 

However, in 2.0 this does not seem to be available.  I read the excerts
which suggest that I create a new NioAcceptor each time, but pass in the
same ProcessorPool. The code in NioAcceptor shows this - but the scope of
the class for NioSession is not public, so it cannot be used outside this
package. 

 I am a bit unsure if this is the right mechanism - or if there is something
in 2.0 I am missing.

regards
Steve
-- 
View this message in context: http://www.nabble.com/using-SimpleIoProcessorPool-in-multiple-acceptors-tf4831890s16868.html#a13823906
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: using SimpleIoProcessorPool in multiple acceptors

Posted by Trustin Lee <tr...@gmail.com>.
Sure, please go ahead. :)

Cheers,
Trustin

On Nov 20, 2007 10:11 AM, Mark <el...@gmail.com> wrote:
> As a follow up to my previous email.  I could take a look at adding this
> feature as well.
>
>
>
> On Nov 19, 2007 8:10 PM, Mark <el...@gmail.com> wrote:
>
> >
> >
> > On Nov 18, 2007 7:46 PM, Trustin Lee <tr...@gmail.com> wrote:
> >
> > > Hi Steve,
> > >
> > > On Nov 19, 2007 9:40 AM, steview <st...@jofti.com> wrote:
> > > >
> > > > Hi Trustin,
> > > > It appears from the code that set addresses can only be used while the
> > >
> > > > acceptor is not running (e.g as a start up config) - can you confirm
> > > if that
> > > > is correct?.
> > >
> > > Yes.  If there's demand for dynamically changing the list of the bound
> > > ports, we will add such a feature.
> >
> >
> > I would vote a huge +1 for this  feature.
> >
> > >
> > >
> > > >  I am not sure that stopping, adding the new ports and restarting the
> > > > acceptor is a reasonable approach. I am after a scalable way to
> > > dynamically
> > > > add more ports to the acceptor (or create new acceptors that all share
> > > the
> > > > processing threadpool) as I do not want hundreds of acceptors (1 for
> > > each
> > > > new port) added as the app is running.
> > >
> > > Do all of the open ports use the same IoHandler implementation?
> > >
> > > > Is there any reason the previous bind method was removed in 2.0 - and
> > > what
> > > > would be the best way to achieve the same thing?
> > >
> > > It was because it is much simpler.  :)
> > >
> > > Trustin
> > > --
> > > what we call human nature is actually human habit
> > > --
> > > http://gleamynode.net/
> > > --
> > > PGP Key ID: 0x0255ECA6
> > >
> >
> >
> >
> > --
> > --------------------------------
> > The adjuration to be "normal" seems shockingly repellent to me; I see
> > neither hope nor comfort in sinking to that low level. I think it is
> > ignorance that makes people think of abnormality only with horror and allows
> > them to remain undismayed at the proximity of "normal" to average and
> > mediocre. For surely anyone who achieves anything is, essentially, abnormal.
> >
> >     Dr. Karl Menninger
>
>
>
>
> --
> --------------------------------
> The adjuration to be "normal" seems shockingly repellent to me; I see
> neither hope nor comfort in sinking to that low level. I think it is
> ignorance that makes people think of abnormality only with horror and allows
> them to remain undismayed at the proximity of "normal" to average and
> mediocre. For surely anyone who achieves anything is, essentially, abnormal.
>     Dr. Karl Menninger
>



-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: using SimpleIoProcessorPool in multiple acceptors

Posted by Mark <el...@gmail.com>.
As a follow up to my previous email.  I could take a look at adding this
feature as well.


On Nov 19, 2007 8:10 PM, Mark <el...@gmail.com> wrote:

>
>
> On Nov 18, 2007 7:46 PM, Trustin Lee <tr...@gmail.com> wrote:
>
> > Hi Steve,
> >
> > On Nov 19, 2007 9:40 AM, steview <st...@jofti.com> wrote:
> > >
> > > Hi Trustin,
> > > It appears from the code that set addresses can only be used while the
> >
> > > acceptor is not running (e.g as a start up config) - can you confirm
> > if that
> > > is correct?.
> >
> > Yes.  If there's demand for dynamically changing the list of the bound
> > ports, we will add such a feature.
>
>
> I would vote a huge +1 for this  feature.
>
> >
> >
> > >  I am not sure that stopping, adding the new ports and restarting the
> > > acceptor is a reasonable approach. I am after a scalable way to
> > dynamically
> > > add more ports to the acceptor (or create new acceptors that all share
> > the
> > > processing threadpool) as I do not want hundreds of acceptors (1 for
> > each
> > > new port) added as the app is running.
> >
> > Do all of the open ports use the same IoHandler implementation?
> >
> > > Is there any reason the previous bind method was removed in 2.0 - and
> > what
> > > would be the best way to achieve the same thing?
> >
> > It was because it is much simpler.  :)
> >
> > Trustin
> > --
> > what we call human nature is actually human habit
> > --
> > http://gleamynode.net/
> > --
> > PGP Key ID: 0x0255ECA6
> >
>
>
>
> --
> --------------------------------
> The adjuration to be "normal" seems shockingly repellent to me; I see
> neither hope nor comfort in sinking to that low level. I think it is
> ignorance that makes people think of abnormality only with horror and allows
> them to remain undismayed at the proximity of "normal" to average and
> mediocre. For surely anyone who achieves anything is, essentially, abnormal.
>
>     Dr. Karl Menninger




-- 
--------------------------------
The adjuration to be "normal" seems shockingly repellent to me; I see
neither hope nor comfort in sinking to that low level. I think it is
ignorance that makes people think of abnormality only with horror and allows
them to remain undismayed at the proximity of "normal" to average and
mediocre. For surely anyone who achieves anything is, essentially, abnormal.
    Dr. Karl Menninger

Re: using SimpleIoProcessorPool in multiple acceptors

Posted by Mark <el...@gmail.com>.
On Nov 18, 2007 7:46 PM, Trustin Lee <tr...@gmail.com> wrote:

> Hi Steve,
>
> On Nov 19, 2007 9:40 AM, steview <st...@jofti.com> wrote:
> >
> > Hi Trustin,
> > It appears from the code that set addresses can only be used while the
> > acceptor is not running (e.g as a start up config) - can you confirm if
> that
> > is correct?.
>
> Yes.  If there's demand for dynamically changing the list of the bound
> ports, we will add such a feature.


I would vote a huge +1 for this  feature.

>
>
> >  I am not sure that stopping, adding the new ports and restarting the
> > acceptor is a reasonable approach. I am after a scalable way to
> dynamically
> > add more ports to the acceptor (or create new acceptors that all share
> the
> > processing threadpool) as I do not want hundreds of acceptors (1 for
> each
> > new port) added as the app is running.
>
> Do all of the open ports use the same IoHandler implementation?
>
> > Is there any reason the previous bind method was removed in 2.0 - and
> what
> > would be the best way to achieve the same thing?
>
> It was because it is much simpler.  :)
>
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>



-- 
--------------------------------
The adjuration to be "normal" seems shockingly repellent to me; I see
neither hope nor comfort in sinking to that low level. I think it is
ignorance that makes people think of abnormality only with horror and allows
them to remain undismayed at the proximity of "normal" to average and
mediocre. For surely anyone who achieves anything is, essentially, abnormal.
    Dr. Karl Menninger

Re: using SimpleIoProcessorPool in multiple acceptors

Posted by Trustin Lee <tr...@gmail.com>.
On Nov 19, 2007 10:45 AM, steview <st...@jofti.com> wrote:
>
> Hi Trustin,
> If you could add that feature that would be great -

Let me try to add that feature in my spare time.  Any patches are
welcome, too.  I think this feature should be included in the first RC
of 2.0.0 at least.

> There majority of the dynamic connections will share the same handler - does
> this suggest another solution?

No, I was just curious.

> If you could point me in another direction in the api that would be welcome
> - in case I have missed something

You understood MINA API very well and thanks for telling us a new use
case.  To be honest, we didn't think about such a use case so far.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: using SimpleIoProcessorPool in multiple acceptors

Posted by steview <st...@jofti.com>.
Hi Trustin,
If you could add that feature that would be great - 

There majority of the dynamic connections will share the same handler - does
this suggest another solution?

If you could point me in another direction in the api that would be welcome
- in case I have missed something

 regards
Steve


Trustin Lee wrote:
> 
> Hi Steve,
> 
> On Nov 19, 2007 9:40 AM, steview <st...@jofti.com> wrote:
>>
>> Hi Trustin,
>> It appears from the code that set addresses can only be used while the
>> acceptor is not running (e.g as a start up config) - can you confirm if
>> that
>> is correct?.
> 
> Yes.  If there's demand for dynamically changing the list of the bound
> ports, we will add such a feature.
> 
>>  I am not sure that stopping, adding the new ports and restarting the
>> acceptor is a reasonable approach. I am after a scalable way to
>> dynamically
>> add more ports to the acceptor (or create new acceptors that all share
>> the
>> processing threadpool) as I do not want hundreds of acceptors (1 for each
>> new port) added as the app is running.
> 
> Do all of the open ports use the same IoHandler implementation?
> 
>> Is there any reason the previous bind method was removed in 2.0 - and
>> what
>> would be the best way to achieve the same thing?
> 
> It was because it is much simpler.  :)
> 
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/using-SimpleIoProcessorPool-in-multiple-acceptors-tf4831890s16868.html#a13826500
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: using SimpleIoProcessorPool in multiple acceptors

Posted by Trustin Lee <tr...@gmail.com>.
Hi Steve,

On Nov 19, 2007 9:40 AM, steview <st...@jofti.com> wrote:
>
> Hi Trustin,
> It appears from the code that set addresses can only be used while the
> acceptor is not running (e.g as a start up config) - can you confirm if that
> is correct?.

Yes.  If there's demand for dynamically changing the list of the bound
ports, we will add such a feature.

>  I am not sure that stopping, adding the new ports and restarting the
> acceptor is a reasonable approach. I am after a scalable way to dynamically
> add more ports to the acceptor (or create new acceptors that all share the
> processing threadpool) as I do not want hundreds of acceptors (1 for each
> new port) added as the app is running.

Do all of the open ports use the same IoHandler implementation?

> Is there any reason the previous bind method was removed in 2.0 - and what
> would be the best way to achieve the same thing?

It was because it is much simpler.  :)

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: using SimpleIoProcessorPool in multiple acceptors

Posted by steview <st...@jofti.com>.
Hi Trustin,
It appears from the code that set addresses can only be used while the
acceptor is not running (e.g as a start up config) - can you confirm if that
is correct?.
 I am not sure that stopping, adding the new ports and restarting the
acceptor is a reasonable approach. I am after a scalable way to dynamically
add more ports to the acceptor (or create new acceptors that all share the
processing threadpool) as I do not want hundreds of acceptors (1 for each
new port) added as the app is running.

Is there any reason the previous bind method was removed in 2.0 - and what
would be the best way to achieve the same thing?

regards
Steve




Trustin Lee wrote:
> 
> Hi Steve,
> 
> On Nov 19, 2007 6:15 AM, steview <st...@jofti.com> wrote:
>>
>> Hi,
>> I have a requirement similar to the following
>>
>> A client connects on a well known port and then is issued a directive to
>> another port to connect to (all  this is tcp/ip based).
>>
>> This can be a growing list of ports (possibly thousands) - I want to deal
>> with using the 2.0 mina trunk - however, I am struggling with the
>> concepts
>> in 2.0.
>> In 1.x I believe I could have used the acceptor.bind(localAddress,
>> handler,
>> config) method to add these ports to the existing acceptor (which was
>> laready running) .
> 
> SimpleIoProcessorPool is not for acceptor/connector threads but for
> I/O processor threads.
> You could set multiple addresses to bind by calling setAddresses().
> Isn't it sufficient for you?
> 
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/using-SimpleIoProcessorPool-in-multiple-acceptors-tf4831890s16868.html#a13825975
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: using SimpleIoProcessorPool in multiple acceptors

Posted by Trustin Lee <tr...@gmail.com>.
Hi Steve,

On Nov 19, 2007 6:15 AM, steview <st...@jofti.com> wrote:
>
> Hi,
> I have a requirement similar to the following
>
> A client connects on a well known port and then is issued a directive to
> another port to connect to (all  this is tcp/ip based).
>
> This can be a growing list of ports (possibly thousands) - I want to deal
> with using the 2.0 mina trunk - however, I am struggling with the concepts
> in 2.0.
> In 1.x I believe I could have used the acceptor.bind(localAddress, handler,
> config) method to add these ports to the existing acceptor (which was
> laready running) .

SimpleIoProcessorPool is not for acceptor/connector threads but for
I/O processor threads.
You could set multiple addresses to bind by calling setAddresses().
Isn't it sufficient for you?

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6