Search in sources :

Example 1 with HttpDestinationOverFCGI

use of org.eclipse.jetty.fcgi.client.http.HttpDestinationOverFCGI in project jetty.project by eclipse.

the class AbstractHttpClientServerTest method start.

public void start(Handler handler) throws Exception {
    server = new Server();
    ServerFCGIConnectionFactory fcgiConnectionFactory = new ServerFCGIConnectionFactory(new HttpConfiguration());
    serverBufferPool = new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged());
    connector = new ServerConnector(server, null, null, serverBufferPool, 1, Math.max(1, Runtime.getRuntime().availableProcessors() / 2), fcgiConnectionFactory);
    //        connector.setPort(9000);
    server.addConnector(connector);
    server.setHandler(handler);
    server.start();
    QueuedThreadPool executor = new QueuedThreadPool();
    executor.setName(executor.getName() + "-client");
    client = new HttpClient(new HttpClientTransportOverFCGI(1, false, "") {

        @Override
        public HttpDestination newHttpDestination(Origin origin) {
            return new HttpDestinationOverFCGI(client, origin) {

                @Override
                protected DuplexConnectionPool newConnectionPool(HttpClient client) {
                    return new LeakTrackingConnectionPool(this, client.getMaxConnectionsPerDestination(), this) {

                        @Override
                        protected void leaked(LeakDetector.LeakInfo leakInfo) {
                            connectionLeaks.incrementAndGet();
                        }
                    };
                }
            };
        }
    }, null);
    client.setExecutor(executor);
    clientBufferPool = new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged());
    client.setByteBufferPool(clientBufferPool);
    client.start();
}
Also used : Origin(org.eclipse.jetty.client.Origin) HttpDestinationOverFCGI(org.eclipse.jetty.fcgi.client.http.HttpDestinationOverFCGI) Server(org.eclipse.jetty.server.Server) LeakTrackingByteBufferPool(org.eclipse.jetty.io.LeakTrackingByteBufferPool) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration) ServerConnector(org.eclipse.jetty.server.ServerConnector) QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) HttpClient(org.eclipse.jetty.client.HttpClient) LeakTrackingConnectionPool(org.eclipse.jetty.client.LeakTrackingConnectionPool) HttpClientTransportOverFCGI(org.eclipse.jetty.fcgi.client.http.HttpClientTransportOverFCGI)

Aggregations

HttpClient (org.eclipse.jetty.client.HttpClient)1 LeakTrackingConnectionPool (org.eclipse.jetty.client.LeakTrackingConnectionPool)1 Origin (org.eclipse.jetty.client.Origin)1 HttpClientTransportOverFCGI (org.eclipse.jetty.fcgi.client.http.HttpClientTransportOverFCGI)1 HttpDestinationOverFCGI (org.eclipse.jetty.fcgi.client.http.HttpDestinationOverFCGI)1 LeakTrackingByteBufferPool (org.eclipse.jetty.io.LeakTrackingByteBufferPool)1 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)1 Server (org.eclipse.jetty.server.Server)1 ServerConnector (org.eclipse.jetty.server.ServerConnector)1 QueuedThreadPool (org.eclipse.jetty.util.thread.QueuedThreadPool)1