Package org.fusesource.hawtdispatch.transport

Examples of org.fusesource.hawtdispatch.transport.TcpTransport


        String protocol = protocol(uri.getScheme());
        if( protocol!=null ) {
            return new SslTransportServer(uri){
                @Override
                protected TcpTransport createTransport() {
                    TcpTransport transport = super.createTransport();
                    IntrospectionSupport.setProperties(transport, options);
                    return transport;
                }
            }.protocol(protocol);
        }
View Full Code Here


    }


    public Transport connect(String location) throws Exception {
        URI uri = new URI(location);
        TcpTransport transport = createTransport(uri);
        if (transport == null) return null;

        Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(uri));
        URI localLocation = getLocalLocation(uri);
        configure(transport, options);
        verify(transport, options);

        transport.connecting(uri, localLocation);

        return transport;
    }
View Full Code Here

        }

        return new TcpTransportServer(location) {
            @Override
            protected TcpTransport createTransport() {
                TcpTransport transport = super.createTransport();
                IntrospectionSupport.setProperties(transport, options);
                return transport;
            }
        };
    }
View Full Code Here

     */
    protected TcpTransport createTransport(URI uri) throws NoSuchAlgorithmException, Exception {
        if( !uri.getScheme().equals("tcp") ) {
            return null;
        }
        TcpTransport transport = new TcpTransport();
        return transport;
    }
View Full Code Here

        String protocol = protocol(uri.getScheme());
        if( protocol!=null ) {
            return new SslTransportServer(uri){
                @Override
                protected TcpTransport createTransport() {
                    TcpTransport transport = super.createTransport();
                    IntrospectionSupport.setProperties(transport, new HashMap(options));
                    return transport;
                }
            }.protocol(protocol);
        }
View Full Code Here

    }


    public Transport connect(String location) throws Exception {
        URI uri = new URI(location);
        TcpTransport transport = createTransport(uri);
        if (transport == null) return null;

        Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(uri));
        URI localLocation = getLocalLocation(uri);
        configure(transport, options);
        verify(transport, options);

        transport.connecting(uri, localLocation);

        return transport;
    }
View Full Code Here

        }

        return new TcpTransportServer(location) {
            @Override
            protected TcpTransport createTransport() {
                TcpTransport transport = super.createTransport();
                IntrospectionSupport.setProperties(transport, new HashMap(options));
                return transport;
            }
        };
    }
View Full Code Here

     */
    protected TcpTransport createTransport(URI uri) throws NoSuchAlgorithmException, Exception {
        if( !uri.getScheme().equals("tcp") ) {
            return null;
        }
        TcpTransport transport = new TcpTransport();
        return transport;
    }
View Full Code Here

            public TcpTransport create_transport() {
                if( hitOnce ) {
                    return super.create_transport();
                }
                hitOnce = true;
                TcpTransport transport = super.create_transport();
                transport.setMaxReadRate(64*1024);
                return transport;
            }
        };
        configureSlave(node2, node1, node2Dir);
        SlaveLevelDBStore node3 = createSlave(node1, node3Dir);
View Full Code Here

     *
     * @param onConnect
     * @throws Exception
     */
    void createTransport(AmqpConnectOptions options, final Callback<Void> onConnect) throws Exception {
        final TcpTransport transport;
        if( options.getSslContext() !=null ) {
            SslTransport ssl = new SslTransport();
            ssl.setSSLContext(options.getSslContext());
            transport = ssl;
        } else {
            transport = new TcpTransport();
        }

        URI host = options.getHost();
        if( host.getPort() == -1 ) {
            if( options.getSslContext()!=null ) {
                host = new URI(host.getScheme()+"://"+host.getHost()+":5672");
            } else {
                host = new URI(host.getScheme()+"://"+host.getHost()+":5671");
            }
        }


        transport.setBlockingExecutor(options.getBlockingExecutor());
        transport.setDispatchQueue(options.getDispatchQueue());

        transport.setMaxReadRate(options.getMaxReadRate());
        transport.setMaxWriteRate(options.getMaxWriteRate());
        transport.setReceiveBufferSize(options.getReceiveBufferSize());
        transport.setSendBufferSize(options.getSendBufferSize());
        transport.setTrafficClass(options.getTrafficClass());
        transport.setUseLocalHost(options.isUseLocalHost());
        transport.connecting(host, options.getLocalAddress());

        transport.setTransportListener(new DefaultTransportListener(){
            public void onTransportConnected() {
                if(state==CONNECTING) {
                    state = CONNECTED;
                    onConnect.onSuccess(null);
                    transport.resumeRead();
                }
            }

            public void onTransportFailure(final IOException error) {
                if(state==CONNECTING) {
                    onConnect.onFailure(error);
                }
            }

        });
        transport.connecting(host, options.getLocalAddress());
        bind(transport);
        transport.start(NOOP);
    }
View Full Code Here

TOP

Related Classes of org.fusesource.hawtdispatch.transport.TcpTransport

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.