Romuald,

Is calling service.unbind() with disconnectOnUnbind set to false not an
acceptable solution ?
This will make your app stop listening on the port, but existing connections
will not die.
Later, when your conditions are met (lower load for instance), you can call
service.bind() again
and new connection requests will be accepted.

Another solution is using a firewall that does rate-limiting on SYN packets.
For example, we configured our firewall to accept only when SYN packet per
second per remote IP address.

Of course it will be more complex to do this dynamically based on the load
on your java server.

Maarten

On 7/26/07, Romuald du Song <[EMAIL PROTECTED]> wrote:
>
> Closing the socket immediatly is not enough in our case as client are not
> very smart machine
> and moreover they are thousands. When we do not want to accept new
> connection it's
> because we don't want to run into problem like no more native thread
> available or too much file opened.
> I don't think this problem is specific to us.
>
> On 7/24/07, Trustin Lee <[EMAIL PROTECTED]> wrote:
> >
> > On 7/17/07, Romuald du Song <[EMAIL PROTECTED]> wrote:
> > > Hy,
> > >
> > > I'd like to know whether it's possible to implement with current Mina
> > > version a filter
> > >  that would not allow new connections base on various criteria ?
> > > It would help for stopping acceptation of new sessions when load is
> too
> > > high,
> > >  or backend is too slow to respond, or to force a proxy to use another
> > > server
> > >  because current will not accept new connections.
> >
> > Currently, there's no way to stop accepting new connections except
> > unbinding.  Instead, you can close the connections immediately.  If
> > it's not enough for you, please let us know.
> >
> > Trustin
> > --
> > what we call human nature is actually human habit
> > --
> > http://gleamynode.net/
> > --
> > PGP Key ID: 0x0255ECA6
> >
>
>
>
> --
> -Tout ce qui n'est pas donné est perdu - Hasari Pal
>

Reply via email to