Package org.apache.http.impl.nio.reactor

Examples of org.apache.http.impl.nio.reactor.DefaultListeningIOReactor


            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)
            .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, false)
            .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true)
            .setParameter(HttpProtocolParams.ORIGIN_SERVER, "HttpComponents/1.1");

        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);

        NHttpServiceHandler handler = new FileServiceHandler(args[0], useFileChannels, params);
        IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(handler, params);
       
        try {
            ioReactor.listen(new InetSocketAddress(8080));
            ioReactor.execute(ioEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
            System.err.println("I/O error: " + e.getMessage());
        }
View Full Code Here


    private ListenerEndpoint endpoint;

    public HttpServerNio(
            final NHttpConnectionFactory<NHttpServerIOTarget> connFactory) throws IOException {
        super();
        this.ioReactor = new DefaultListeningIOReactor();
        this.connFactory = connFactory;
    }
View Full Code Here

        return isStarted;
    }

    public void start() throws IOReactorException {
        final SocketAddress addr = new InetSocketAddress(port);
        ioReactor = new DefaultListeningIOReactor(nbThreads, threadFactory, params);

        final IOEventDispatch ioEventDispatch;
        if ("https".equals(protocol)) {
            ioEventDispatch = new SSLServerIOEventDispatch(serviceHandler, sslContext, params);
        } else {
View Full Code Here

     * @param port port to start the listener on
     */
    private void startServerEngine(int port) {
        HttpParams params = getServerParameters();
        try {
            ioReactor = new DefaultListeningIOReactor(
                NHttpConfiguration.getInstance().getServerIOWorkers(), params);

            ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
                public boolean handle(IOException ioException) {
                    log.warn("System may be unstable: IOReactor encountered a checked exception : " +
View Full Code Here

                handler,
                sslcontext,
                null,
                params);
       
        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
        try {
            ioReactor.listen(new InetSocketAddress(8080));
            ioReactor.execute(ioEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
            System.err.println("I/O error: " + e.getMessage());
        }
View Full Code Here

       
        // Provide an event logger
        handler.setEventListener(new EventLogger());
       
        IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(handler, params);
        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
        try {
            ioReactor.listen(new InetSocketAddress(8080));
            ioReactor.execute(ioEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
            System.err.println("I/O error: " + e.getMessage());
        }
View Full Code Here

    private ListenerEndpoint endpoint;

    public HttpServerNio(
            final NHttpConnectionFactory<NHttpServerIOTarget> connFactory) throws IOException {
        super();
        this.ioReactor = new DefaultListeningIOReactor();
        this.connFactory = connFactory;
    }
View Full Code Here

       
        // configure the IO reactor on the specified port
        HttpParams params = listenerContext.getParams();
        try {
            String prefix = (sslContext == null ? "http" : "https") + "-Listener I/O dispatcher";
            ioReactor = new DefaultListeningIOReactor(
                NHttpConfiguration.getInstance().getServerIOWorkers(),               
                new NativeThreadFactory(new ThreadGroup(prefix + " thread group"), prefix), params);

            ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
                public boolean handle(IOException ioException) {
View Full Code Here

    @Override
    public void run() {
        try {
            if (null == _ioReactor) {
                final IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(_handler, _params);
                _ioReactor = new DefaultListeningIOReactor(_workerCount,
                        _params);
                try {
                    _ioReactor.listen(new InetSocketAddress(_port));
                    _ioReactor.execute(ioEventDispatch);
                } catch (InterruptedIOException ex) {
View Full Code Here

    public void start() throws AxisFault {
        log.info("Starting the RelayTransport Listener...");
        try {
            String prefix = (sslContext == null ? "http" : "https") + "-Listener I/O dispatcher";

            ioReactor = new DefaultListeningIOReactor(sourceConfiguration.getIOThreadCount(),
                    new NativeThreadFactory(new ThreadGroup(prefix + " thread group"),
                            prefix), sourceConfiguration.getHttpParameters());
           
            ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
                public boolean handle(IOException ioException) {
View Full Code Here

TOP

Related Classes of org.apache.http.impl.nio.reactor.DefaultListeningIOReactor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.