Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] timeout


On Mon, Sep 24, 2012 at 8:23 PM, Paul Krasucki <paulkrasucki@xxxxxxxxx> wrote:
> I am trying to set up jetty so that it has different session timeouts for
> different types of clients; specifically I'd like to have longer timeout
> (say 10 minutes) for iPad/iPhone clients and 2 minutes for all the others. I
> set up two connectors in jetty.xml on two different ports with different
> maxIdletime (port 8081 -short, port 8084 - longer) and defined two different
> servlets in web.xml: cometd and cometdmobile which look the same but again
> have different values of timeout and maxInterval. Still it looks like my
> clients connecting to cometdmobile on port 8084 have session removed after 2
> minutes of disconnect. What am I missing? Is it a right way to solve the
> problem of different session timeouts?
> Any help will be greatly appreciated.

If the 2 servlets are in the same web application, it is very likely
that you are creating only 1 instance of BayeuxServer, and therefore
the 2 configurations will overwrite each other in the same
BayeuxServer instance (there is a 1-1 mapping between web applications
and BayeuxServer instances, by default).

I see 2 choices, 1 simple and 1 complicated.
Simple: you split your web app in 2 web apps, so you can configure
them differently.
Complicated: you keep one webapp but you manually create 2 instances
of BayeuxServer, configure them differently, and associate them to 2
different CometD servlets (you can do this by overriding
You need to remove the BayeuxServer instance from the ServletContext
attributes, so different servlet instances create different
BayeuxServer objects. You can do this with a ServletContextListener.

See also
to properly configure your services with the right BayeuxServer

Developer advice, services and support
from the Jetty & CometD experts.
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

Back to the top