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

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

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

Message.getHeaders介绍

[英]Returns a reference to the headers hashmap, which is immutable. Any attempt to modify the returned map will cause a runtime exception
[中]返回对headers hashmap的引用,它是不可变的。任何修改返回映射的尝试都将导致运行时异常

代码示例

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

/**
 * Copies a message. Copies only headers with IDs >= starting_id or IDs which are in the copy_only_ids list
 * @param copy_buffer
 * @param starting_id
 * @param copy_only_ids
 * @return
 */
public Message copy(boolean copy_buffer, short starting_id, short ... copy_only_ids) {
  Message retval=copy(copy_buffer, false);
  for(Map.Entry<Short,Header> entry: getHeaders().entrySet()) {
    short id=entry.getKey();
    if(id >= starting_id || Util.containsId(id, copy_only_ids))
      retval.putHeader(id, entry.getValue());
  }
  return retval;
}

代码示例来源:origin: apache/geode

logger.trace("JGroupsMessenger received {} headers: {}", jgmsg, jgmsg.getHeaders());

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

private static void printMessage(Message msg, String label) {
  StringBuilder sb=new StringBuilder();
  sb.append(label).append(":\n");
  Map<String, Header> hdrs=msg.getHeaders();
  sb.append(print(msg, hdrs));
  System.out.println(sb);
}

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

/**
 * Copies a message. Copies only headers with IDs >= starting_id or IDs which are in the copy_only_ids list
 * @param copy_buffer
 * @param starting_id
 * @param copy_only_ids
 * @return
 */
public Message copy(boolean copy_buffer, short starting_id, short ... copy_only_ids) {
  Message retval=copy(copy_buffer, false);
  for(Map.Entry<Short,Header> entry: getHeaders().entrySet()) {
    short id=entry.getKey();
    if(id >= starting_id || Util.containsId(id, copy_only_ids))
      retval.putHeader(id, entry.getValue());
  }
  return retval;
}

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

s+="[";
Message m=(Message)event.getArg();
Map headers=new HashMap(m.getHeaders());
for(Iterator i=headers.keySet().iterator(); i.hasNext();) {
  Object headerKey=i.next();

代码示例来源:origin: org.apache.geode/gemfire-core

logger.trace("JGroupsMessenger received {} headers: {}", jgmsg, jgmsg.getHeaders());

相关文章