Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] More than one Context Handler and one context handler is loaded

Hi
My embedded jetty app has 2 context handlers registered to it. Both are listening at same port. Below is the sample.

Server s = new Server();
Connector c = new SelectChannelConnector();
((SelectChannelConnector)connector).setAcceptors(2);
connector.setHost(IP);
connector.setPort(port);
server.addConnector(connector);

ContextHandler context1 = new ContextHandler();
context.setContextPath("/abc");
context.setHandler(handler1);
context.setAllowNullPathInfo(true);

ContextHandler context2 = new ContextHandler();
context2.setContextPath("/xyz");
context2.setHandler(handler2);
context2.setAllowNullPathInfo(true);

ContextHandlerCollection hc = new ContextHandlerCollection();
hc.addHandler(context1);
hc.addHandler(context2);

server.setHandler(hc);
server.start();

I am also using a thread pool which is set at server level.
When I send requests to one context and put load on that so that all threads are used, At that time when I send a request to the second context its taking time to process the request to 2nd context.

My requirement is that other context should not delay processing when one context is under load.

Can I have dedicated thread pool for each context. Is there any other work around.
Appreciate reply to this.

Thanks
Sarath





Back to the top