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

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

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

Message.writeToNoAddrs介绍

[英]Writes the message to the output stream, but excludes the dest and src addresses unless the src address given as argument is different from the message's src address
[中]将消息写入输出流,但不包括dest和src地址,除非作为参数给出的src地址与消息的src地址不同

代码示例

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

  1. /**
  2. * Write a list of messages with the *same* destination and src addresses. The message list is
  3. * marshalled as follows (see doc/design/MarshallingFormat.txt for details):
  4. * <pre>
  5. * List: * | version | flags | dest | src | cluster-name | [Message*] |
  6. *
  7. * Message: | presence | leading | flags | [src] | length | [buffer] | size | [Headers*] |
  8. *
  9. * </pre>
  10. * @param dest
  11. * @param src
  12. * @param msgs
  13. * @param dos
  14. * @param multicast
  15. * @throws Exception
  16. */
  17. public static void writeMessageList(Address dest, Address src, byte[] cluster_name,
  18. List<Message> msgs, DataOutput dos, boolean multicast, short transport_id) throws Exception {
  19. writeMessageListHeader(dest, src, cluster_name, msgs != null ? msgs.size() : 0, dos, multicast);
  20. if(msgs != null)
  21. for(Message msg: msgs)
  22. msg.writeToNoAddrs(src, dos, transport_id); // exclude the transport header
  23. }

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

  1. protected int marshalMessagesToSameDestination(Address dest, Message[] buf, final int start_index, final int end_index,
  2. int max_bundle_size) throws Exception {
  3. int num_msgs=0, bytes=0;
  4. for(int i=start_index; i != end_index; i=increment(i)) {
  5. Message msg=buf[i];
  6. if(msg != null && msg != NULL_MSG && Objects.equals(dest, msg.dest())) {
  7. long msg_size=msg.size();
  8. if(bytes + msg_size > max_bundle_size)
  9. break;
  10. bytes+=msg_size;
  11. num_msgs++;
  12. buf[i]=NULL_MSG;
  13. msg.writeToNoAddrs(msg.src(), output, transport.getId());
  14. }
  15. }
  16. return num_msgs;
  17. }

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

  1. protected int marshalMessagesToSameDestination(Address dest, Message[] buf,
  2. int start_index, final int end_index, int max_bundle_size) throws Exception {
  3. int num_msgs=0, bytes=0;
  4. for(;;) {
  5. Message msg=buf[start_index];
  6. if(msg != null && Objects.equals(dest, msg.dest())) {
  7. long size=msg.size();
  8. if(bytes + size > max_bundle_size)
  9. break;
  10. bytes+=size;
  11. num_msgs++;
  12. buf[start_index]=null;
  13. msg.writeToNoAddrs(msg.src(), output, transport.getId());
  14. }
  15. if(start_index == end_index)
  16. break;
  17. start_index=advance(start_index);
  18. }
  19. return num_msgs;
  20. }

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

  1. protected int marshalMessagesToSameDestination(Address dest, Message[] buf,
  2. int start_index, int available_msgs, int max_bundle_size) throws Exception {
  3. int num_msgs=0, bytes=0;
  4. while(available_msgs > 0) {
  5. Message msg=buf[start_index];
  6. if(msg != null && Objects.equals(dest, msg.dest())) {
  7. long msg_size=msg.size();
  8. if(bytes + msg_size > max_bundle_size)
  9. break;
  10. bytes+=msg_size;
  11. num_msgs++;
  12. buf[start_index]=null;
  13. msg.writeToNoAddrs(msg.src(), output, transport.getId());
  14. }
  15. available_msgs--;
  16. start_index=increment(start_index);
  17. }
  18. return num_msgs;
  19. }

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

  1. msg.writeToNoAddrs(msg.getSrc(), output, transport.getId());
  2. msg_queue[i]=null;

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

  1. /**
  2. * Write a list of messages with the *same* destination and src addresses. The message list is
  3. * marshalled as follows (see doc/design/MarshallingFormat.txt for details):
  4. * <pre>
  5. * List: * | version | flags | dest | src | cluster-name | [Message*] |
  6. *
  7. * Message: | presence | leading | flags | [src] | length | [buffer] | size | [Headers*] |
  8. *
  9. * </pre>
  10. * @param dest
  11. * @param src
  12. * @param msgs
  13. * @param dos
  14. * @param multicast
  15. * @throws Exception
  16. */
  17. public static void writeMessageList(Address dest, Address src, byte[] cluster_name,
  18. List<Message> msgs, DataOutput dos, boolean multicast, short transport_id) throws Exception {
  19. writeMessageListHeader(dest, src, cluster_name, msgs != null ? msgs.size() : 0, dos, multicast);
  20. if(msgs != null)
  21. for(Message msg: msgs)
  22. msg.writeToNoAddrs(src, dos, transport_id); // exclude the transport header
  23. }

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

  1. protected int marshalMessagesToSameDestination(Address dest, Message[] buf, final int start_index, final int end_index,
  2. int max_bundle_size) throws Exception {
  3. int num_msgs=0, bytes=0;
  4. for(int i=start_index; i != end_index; i=increment(i)) {
  5. Message msg=buf[i];
  6. if(msg != null && msg != NULL_MSG && Objects.equals(dest, msg.dest())) {
  7. long msg_size=msg.size();
  8. if(bytes + msg_size > max_bundle_size)
  9. break;
  10. bytes+=msg_size;
  11. num_msgs++;
  12. buf[i]=NULL_MSG;
  13. msg.writeToNoAddrs(msg.src(), output, transport.getId());
  14. }
  15. }
  16. return num_msgs;
  17. }

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

  1. protected int marshalMessagesToSameDestination(Address dest, Message[] buf,
  2. int start_index, int available_msgs, int max_bundle_size) throws Exception {
  3. int num_msgs=0, bytes=0;
  4. while(available_msgs > 0) {
  5. Message msg=buf[start_index];
  6. if(msg != null && Objects.equals(dest, msg.dest())) {
  7. long msg_size=msg.size();
  8. if(bytes + msg_size > max_bundle_size)
  9. break;
  10. bytes+=msg_size;
  11. num_msgs++;
  12. buf[start_index]=null;
  13. msg.writeToNoAddrs(msg.src(), output, transport.getId());
  14. }
  15. available_msgs--;
  16. start_index=increment(start_index);
  17. }
  18. return num_msgs;
  19. }

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

  1. protected int marshalMessagesToSameDestination(Address dest, Message[] buf,
  2. int start_index, final int end_index, int max_bundle_size) throws Exception {
  3. int num_msgs=0, bytes=0;
  4. for(;;) {
  5. Message msg=buf[start_index];
  6. if(msg != null && Objects.equals(dest, msg.dest())) {
  7. long size=msg.size();
  8. if(bytes + size > max_bundle_size)
  9. break;
  10. bytes+=size;
  11. num_msgs++;
  12. buf[start_index]=null;
  13. msg.writeToNoAddrs(msg.src(), output, transport.getId());
  14. }
  15. if(start_index == end_index)
  16. break;
  17. start_index=advance(start_index);
  18. }
  19. return num_msgs;
  20. }

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

  1. msg.writeToNoAddrs(msg.getSrc(), output, transport.getId());
  2. msg_queue[i]=null;

相关文章