Package com.alibaba.dubbo.remoting

Examples of com.alibaba.dubbo.remoting.Channel


            return;
        channel.removeAttribute(key);
    }

    public boolean hasAttribute(String key) {
        Channel channel = getChannel();
        if (channel == null)
            return false;
        return channel.hasAttribute(key);
    }
View Full Code Here


   
    public void send(Object message, boolean sent) throws RemotingException {
        if (send_reconnect && !isConnected()){
            connect();
        }
        Channel channel = getChannel();
        //TODO getChannel返回的状态是否包含null需要改进
        if (channel == null || ! channel.isConnected()) {
          throw new RemotingException(this, "message can not send, because channel is closed . url:" + getUrl());
        }
        channel.send(message, sent);
    }
View Full Code Here

    public void disconnect() {
        connectLock.lock();
        try {
            destroyConnectStatusCheckCommand();
            try {
                Channel channel = getChannel();
                if (channel != null) {
                    channel.close();
                }
            } catch (Throwable e) {
                logger.warn(e.getMessage(), e);
            }
            try {
View Full Code Here

    public InetSocketAddress getConnectAddress() {
        return new InetSocketAddress(NetUtils.filterLocalHost(getUrl().getHost()), getUrl().getPort());
    }

    public InetSocketAddress getRemoteAddress() {
        Channel channel = getChannel();
        if (channel == null)
            return getUrl().toInetSocketAddress();
        return channel.getRemoteAddress();
    }
View Full Code Here

            return getUrl().toInetSocketAddress();
        return channel.getRemoteAddress();
    }

    public InetSocketAddress getLocalAddress() {
        Channel channel = getChannel();
        if (channel == null)
            return InetSocketAddress.createUnresolved(NetUtils.getLocalHost(), 0);
        return channel.getLocalAddress();
    }
View Full Code Here

            return InetSocketAddress.createUnresolved(NetUtils.getLocalHost(), 0);
        return channel.getLocalAddress();
    }

    public boolean isConnected() {
        Channel channel = getChannel();
        if (channel == null)
            return false;
        return channel.isConnected();
    }
View Full Code Here

    @Test
    public void testDecodeReplyResponse() throws Exception {

        URL url = URL.valueOf( ThriftProtocol.NAME + "://127.0.0.1:40880/" + Demo.Iface.class.getName() );

        Channel channel = new MockedChannel( url );

        RandomAccessByteArrayOutputStream bos = new RandomAccessByteArrayOutputStream( 128 );

        Request request = createRequest();
View Full Code Here

    @Test
    public void testDecodeExceptionResponse() throws Exception {

        URL url = URL.valueOf( ThriftProtocol.NAME + "://127.0.0.1:40880/" + Demo.class.getName() );

        Channel channel = new MockedChannel( url );

        RandomAccessByteArrayOutputStream bos = new RandomAccessByteArrayOutputStream( 128 );

        Request request = createRequest();
View Full Code Here

    @Test
    public void testEncodeReplyResponse() throws Exception {

        URL url = URL.valueOf( ThriftProtocol.NAME + "://127.0.0.1:40880/" + Demo.Iface.class.getName() );

        Channel channel = new MockedChannel( url );

        Request request = createRequest();

        RpcResult rpcResult = new RpcResult();
        rpcResult.setResult( "Hello, World!" );
View Full Code Here

    @Test
    public void testEncodeExceptionResponse() throws Exception {

        URL url = URL.valueOf( ThriftProtocol.NAME + "://127.0.0.1:40880/" + Demo.Iface.class.getName() );

        Channel channel = new MockedChannel( url );

        Request request = createRequest();

        RpcResult rpcResult = new RpcResult();
        String exceptionMessage = "failed";
View Full Code Here

TOP

Related Classes of com.alibaba.dubbo.remoting.Channel

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.