当前位置: 首页>>代码示例>>Java>>正文


Java Message.setDest方法代码示例

本文整理汇总了Java中org.jgroups.Message.setDest方法的典型用法代码示例。如果您正苦于以下问题:Java Message.setDest方法的具体用法?Java Message.setDest怎么用?Java Message.setDest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgroups.Message的用法示例。


在下文中一共展示了Message.setDest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleXmitRsp

import org.jgroups.Message; //导入方法依赖的package包/类
private void handleXmitRsp(Message msg, NakAckHeader hdr) {
    if(msg == null)
        return;

    try {
        if(stats)
            xmit_rsps_received.incrementAndGet();

        msg.setDest(null);
        NakAckHeader newhdr=hdr.copy();
        newhdr.type=NakAckHeader.MSG; // change the type back from XMIT_RSP --> MSG
        msg.putHeader(id, newhdr);
        up(new Event(Event.MSG, msg));
        if(rebroadcasting)
            checkForRebroadcasts();
    }
    catch(Exception ex) {
        if(log.isErrorEnabled()) {
            log.error("failed reading retransmitted message", ex);
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:23,代码来源:NAKACK.java

示例2: testDontLoopback

import org.jgroups.Message; //导入方法依赖的package包/类
public void testDontLoopback() {
    final Address DEST=Util.createRandomAddress("A");
    Message msg=new Message(null).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);

    msg.dest(null); // OK
    msg.setDest(null);

    msg.dest(DEST);

    msg.clearTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
    msg.dest(DEST); // OK
    msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
    msg.setTransientFlagIfAbsent(Message.TransientFlag.DONT_LOOPBACK);

    short flags=(short)(Message.TransientFlag.DONT_LOOPBACK.value() + Message.TransientFlag.OOB_DELIVERED.value());
    msg.setTransientFlag(flags);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:18,代码来源:MessageTest.java

示例3: createJGMessage

import org.jgroups.Message; //导入方法依赖的package包/类
private Message createJGMessage(byte[] msgBytes, Address src, Address dest, short version) {
  Message msg = new Message();
  msg.setDest(dest);
  msg.setSrc(src);
  msg.setObject(msgBytes);
  msg.setFlag(Message.Flag.NO_RELIABILITY);
  msg.setFlag(Message.Flag.NO_FC);
  msg.setFlag(Message.Flag.DONT_BUNDLE);
  msg.setFlag(Message.Flag.OOB);
  return msg;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:12,代码来源:GMSPingPonger.java

示例4: flushMessagesInForwardTable

import org.jgroups.Message; //导入方法依赖的package包/类
/**
 * Sends all messages currently in forward_table to the new target (changing the dest field).
 * This needs to be done, so the underlying reliable unicast protocol (e.g. UNICAST) adds these messages
 * to its retransmission mechanism<br/>
 * Note that we need to resend the messages in order of their seqnos ! We also need to prevent other message
 * from being inserted until we're done, that's why there's synchronization.<br/>
 * Access to the forward_table doesn't need to be synchronized as there won't be any insertions during flushing
 * (all down-threads are blocked)
 */
protected void flushMessagesInForwardTable(Address target) {
    // for forwarded messages, we need to receive the forwarded message from the coordinator, to prevent this case:
    // - V1={A,B,C}
    // - A crashes
    // - C installs V2={B,C}
    // - C forwards messages 3 and 4 to B (the new coord)
    // - B drops 3 because its view is still V1
    // - B installs V2
    // - B receives message 4 and broadcasts it
    // ==> C's message 4 is delivered *before* message 3 !
    // ==> By resending 3 until it is received, then resending 4 until it is received, we make sure this won't happen
    // (see https://issues.jboss.org/browse/JGRP-1449)

    // Forward the first entry and wait for the ack
    Map.Entry<Long,Message> first=forward_table.firstEntry();
    if(first == null)
        return;
    Long key=first.getKey();
    Message val=first.getValue();
    Message forward_msg;

    while(flushing && running && !forward_table.isEmpty()) {
        forward_msg=val.copy();
        forward_msg.setDest(target);
        forward_msg.setFlag(Message.Flag.DONT_BUNDLE);
        if(log.isTraceEnabled())
            log.trace(local_addr + ": flushing (forwarding) " + "::" + key + " to target " + target);
        ack_promise.reset();
        down_prot.down(new Event(Event.MSG, forward_msg));
        Long ack=ack_promise.getResult(500);
        if((ack != null && ack.equals(key)) || !forward_table.containsKey(key))
            break;
    }

    for(Map.Entry<Long,Message> entry: forward_table.entrySet()) {
        key=entry.getKey();
        val=entry.getValue();
        if(flushing && running) {
            forward_msg=val.copy();
            forward_msg.setDest(target);
            forward_msg.setFlag(Message.Flag.DONT_BUNDLE);
            if(log.isTraceEnabled())
                log.trace(local_addr + ": flushing (forwarding) " + "::" + key + " to target " + target);
            down_prot.down(new Event(Event.MSG, forward_msg));
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:57,代码来源:ForwardQueue.java


注:本文中的org.jgroups.Message.setDest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。