Package com.alibaba.dubbo.remoting.exchange

Examples of com.alibaba.dubbo.remoting.exchange.Request


    }

    @SuppressWarnings("deprecation")
    public void received(Channel channel, Object message) throws RemotingException {
        if (message instanceof Request && ((Request)message).isHeartbeat()){
            Request req = (Request) message;
            if (req.isTwoWay()){
                Response res = new Response(req.getId(),req.getVersion());
                res.setHeartbeat(true);
                channel.send(res);
            }
        }
        handler.received(channel, message);
View Full Code Here


                res.setErrorMessage(in.readUTF());
            }
            return res;
        } else {
            // decode request.
            Request req = new Request(id);
            req.setVersion("2.0.0");
            req.setTwoWay((flag & FLAG_TWOWAY) != 0);
            if ((flag & FLAG_EVENT) != 0) {
                req.setEvent(Request.HEARTBEAT_EVENT);
            }
            try {
                Object data;
                if (req.isHeartbeat()) {
                    data = decodeHeartbeatData(channel, in);
                } else if (req.isEvent()) {
                    data = decodeEventData(channel, in);
                } else {
                    data = decodeRequestData(channel, in);
                }
                req.setData(data);
            } catch (Throwable t) {
                // bad request
                req.setBroken(true);
                req.setData(t);
            }
            return req;
        }
    }
View Full Code Here

    protected Object getRequestData(long id) {
        DefaultFuture future = DefaultFuture.getFuture(id);
        if (future == null)
            return null;
        Request req = future.getRequest();
        if (req == null)
            return null;
        return req.getData();
    }
View Full Code Here

    }

    @SuppressWarnings("deprecation")
    public void received(Channel channel, Object message) throws RemotingException {
        if (message instanceof Request && ((Request)message).isHeartbeat()){
            Request req = (Request) message;
            if (req.isTwoWay()){
                Response res = new Response(req.getId(),req.getVersion());
                res.setHeartbeat(true);
                channel.send(res);
            }
        }
        handler.received(channel, message);
View Full Code Here

    }

    public void received(Channel channel, Object message) throws RemotingException {
        setReadTimestamp(channel);
        if (isHeartbeatRequest(message)) {
            Request req = (Request) message;
            if (req.isTwoWay()) {
                Response res = new Response(req.getId(), req.getVersion());
                res.setEvent(Response.HEARTBEAT_EVENT);
                channel.send(res);
                if (log.isDebugEnabled()) {
                    log.debug(
                        new StringBuilder(32)
View Full Code Here

        doClose();
        server.close(timeout);
    }
   
    private void sendChannelReadOnlyEvent(){
        Request request = new Request();
        request.setEvent(Request.READONLY_EVENT);
        request.setTwoWay(false);
        request.setVersion(Version.getVersion());
       
        Collection<Channel> channels = getChannels();
        for (Channel channel : channels) {
            try {
                if (channel.isConnected())channel.send(request, getUrl().getParameter(Constants.CHANNEL_READONLYEVENT_SENT_KEY, true));
View Full Code Here

    protected Object getRequestData(long id) {
        DefaultFuture future = DefaultFuture.getFuture(id);
        if (future == null)
            return null;
        Request req = future.getRequest();
        if (req == null)
            return null;
        return req.getData();
    }
View Full Code Here

                  res.setErrorMessage(in.readUTF());
              }
              return res;
          } else {
              // decode request.
              Request req = new Request(id);
              req.setVersion("2.0.0");
              req.setTwoWay( ( flag & FLAG_TWOWAY ) != 0 );
              if (( flag & FLAG_EVENT ) != 0 ){
                  req.setEvent(Request.HEARTBEAT_EVENT);
              }
              try {
                  Object data;
                  if (req.isHeartbeat()) {
                      data = decodeHeartbeatData(channel, in);
                  } else if (req.isEvent()) {
                      data = decodeEventData(channel, in);
                  } else {
                      data = decodeRequestData(channel, in);
                  }
                  req.setData(data);
              } catch (Throwable t) {
                  // bad request
                  req.setBroken(true);
                  req.setData(t);
              }
              return req;
          }
        } finally {
            if (is.available() > 0) {
View Full Code Here

                res.setErrorMessage(in.readUTF());
            }
            return res;
        } else {
            // decode request.
            Request req = new Request(id);
            req.setVersion("2.0.0");
            req.setTwoWay((flag & FLAG_TWOWAY) != 0);
            if ((flag & FLAG_EVENT) != 0) {
                req.setEvent(Request.HEARTBEAT_EVENT);
            }
            try {
                Object data;
                if (req.isHeartbeat()) {
                    data = decodeHeartbeatData(channel, in);
                } else if (req.isEvent()) {
                    data = decodeEventData(channel, in);
                } else {
                    data = decodeRequestData(channel, in);
                }
                req.setData(data);
            } catch (Throwable t) {
                // bad request
                req.setBroken(true);
                req.setData(t);
            }
            return req;
        }
    }
View Full Code Here

    protected Object getRequestData(long id) {
        DefaultFuture future = DefaultFuture.getFuture(id);
        if (future == null)
            return null;
        Request req = future.getRequest();
        if (req == null)
            return null;
        return req.getData();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.dubbo.remoting.exchange.Request

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.