Issue #1643 Configure selectors for AbstractProxyServlet
This commit is contained in:
parent
0bfc41e068
commit
432b941f32
|
@ -44,6 +44,7 @@ import org.eclipse.jetty.client.HttpClient;
|
|||
import org.eclipse.jetty.client.ProtocolHandlers;
|
||||
import org.eclipse.jetty.client.api.Request;
|
||||
import org.eclipse.jetty.client.api.Response;
|
||||
import org.eclipse.jetty.client.http.HttpClientTransportOverHTTP;
|
||||
import org.eclipse.jetty.http.HttpField;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpHeaderValue;
|
||||
|
@ -259,7 +260,7 @@ public abstract class AbstractProxyServlet extends HttpServlet
|
|||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @see #newHttpClient()
|
||||
* @return a {@link HttpClient} configured from the {@link #getServletConfig() servlet configuration}
|
||||
* @throws ServletException if the {@link HttpClient} cannot be created
|
||||
*/
|
||||
|
@ -340,11 +341,17 @@ public abstract class AbstractProxyServlet extends HttpServlet
|
|||
}
|
||||
|
||||
/**
|
||||
* The servlet init parameter 'selectors' can be set for the number of
|
||||
* selector threads to be used by the HttpClient.
|
||||
* @return a new HttpClient instance
|
||||
*/
|
||||
protected HttpClient newHttpClient()
|
||||
{
|
||||
return new HttpClient();
|
||||
int selectors = (Runtime.getRuntime().availableProcessors() + 1) / 2;
|
||||
String value = getServletConfig().getInitParameter("selectors");
|
||||
if (value != null)
|
||||
selectors = Integer.parseInt(value);
|
||||
return new HttpClient(new HttpClientTransportOverHTTP(selectors),null);
|
||||
}
|
||||
|
||||
protected HttpClient getHttpClient()
|
||||
|
|
Loading…
Reference in New Issue