org.jgroups.Message.getFlags()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.jgroups.Message.getFlags()方法的一些代码示例,展示了Message.getFlags()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getFlags()方法的具体详情如下:
包路径:org.jgroups.Message
类名称:Message
方法名:getFlags

Message.getFlags介绍

[英]Returns the internal representation of flags. Don't use this, as the internal format might change at any time ! This is only used by unit test code
[中]返回标志的内部表示形式。不要使用这个,因为内部格式可能随时改变!这仅由单元测试代码使用

代码示例

代码示例来源:origin: wildfly/wildfly

private Object handle(Message message) {
    Header header = (Header) message.getHeader(this.id);
    // If this is a request expecting a response, don't leave the requester hanging - send an identifiable response on which it can filter
    if ((header != null) && (header.type == Header.REQ) && header.rspExpected()) {
      Message response = message.makeReply().setFlag(message.getFlags()).clearFlag(Message.Flag.RSVP, Message.Flag.INTERNAL);
      response.putHeader(FORK.ID, message.getHeader(FORK.ID));
      response.putHeader(this.id, new Header(Header.RSP, header.req_id, header.corrId));
      response.setBuffer(UNKNOWN_FORK_RESPONSE.array());
      fork.getProtocolStack().getChannel().down(response);
    }
    return null;
  }
});

代码示例来源:origin: wildfly/wildfly

protected void sendReply(final Message req, final long req_id, Object reply, boolean is_exception) {
  Buffer rsp_buf;
  try {  // retval could be an exception, or a real value
    rsp_buf=replyToBuffer(reply, marshaller);
  }
  catch(Throwable t) {
    try {  // this call should succeed (all exceptions are serializable)
      rsp_buf=replyToBuffer(t, marshaller);
      is_exception=true;
    }
    catch(NotSerializableException not_serializable) {
      if(log.isErrorEnabled()) log.error(Util.getMessage("FailedMarshallingRsp") + reply + "): not serializable");
      return;
    }
    catch(Throwable tt) {
      if(log.isErrorEnabled()) log.error(Util.getMessage("FailedMarshallingRsp") + reply + "): " + tt);
      return;
    }
  }
  Message rsp=req.makeReply().setFlag(req.getFlags()).setBuffer(rsp_buf)
   .clearFlag(Message.Flag.RSVP, Message.Flag.INTERNAL); // JGRP-1940
  sendResponse(rsp, req_id, is_exception);
}

代码示例来源:origin: org.infinispan.server/infinispan-server-jgroups

private Object handle(Message message) {
    Header header = message.getHeader(this.id);
    // If this is a request expecting a response, don't leave the requester hanging - send an identifiable response on which it can filter
    if ((header != null) && (header.type == Header.REQ) && header.rspExpected()) {
      Message response = message.makeReply().setFlag(message.getFlags()).clearFlag(Message.Flag.RSVP);
      response.putHeader(FORK.ID, message.getHeader(FORK.ID));
      response.putHeader(this.id, new Header(Header.RSP, header.req_id, this.id));
      response.setBuffer(UNKNOWN_FORK_RESPONSE.array());
      channel.down(response);
    }
    return null;
  }
};

代码示例来源:origin: org.jboss.eap/wildfly-clustering-jgroups-extension

private Object handle(Message message) {
    Header header = (Header) message.getHeader(this.id);
    // If this is a request expecting a response, don't leave the requester hanging - send an identifiable response on which it can filter
    if ((header != null) && (header.type == Header.REQ) && header.rspExpected()) {
      Message response = message.makeReply().setFlag(message.getFlags()).clearFlag(Message.Flag.RSVP, Message.Flag.INTERNAL);
      response.putHeader(FORK.ID, message.getHeader(FORK.ID));
      response.putHeader(this.id, new Header(Header.RSP, header.req_id, header.corrId));
      response.setBuffer(UNKNOWN_FORK_RESPONSE.array());
      fork.getProtocolStack().getChannel().down(response);
    }
    return null;
  }
});

代码示例来源:origin: org.jboss.eap/wildfly-client-all

protected void sendReply(final Message req, final long req_id, Object reply, boolean is_exception) {
  Buffer rsp_buf;
  try {  // retval could be an exception, or a real value
    rsp_buf=replyToBuffer(reply, marshaller);
  }
  catch(Throwable t) {
    try {  // this call should succeed (all exceptions are serializable)
      rsp_buf=replyToBuffer(t, marshaller);
      is_exception=true;
    }
    catch(NotSerializableException not_serializable) {
      if(log.isErrorEnabled()) log.error(Util.getMessage("FailedMarshallingRsp") + reply + "): not serializable");
      return;
    }
    catch(Throwable tt) {
      if(log.isErrorEnabled()) log.error(Util.getMessage("FailedMarshallingRsp") + reply + "): " + tt);
      return;
    }
  }
  Message rsp=req.makeReply().setFlag(req.getFlags()).setBuffer(rsp_buf)
   .clearFlag(Message.Flag.RSVP, Message.Flag.INTERNAL); // JGRP-1940
  sendResponse(rsp, req_id, is_exception);
}

相关文章