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


Java Message.setFlag方法代码示例

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


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

示例1: setMessageFlags

import org.jgroups.Message; //导入方法依赖的package包/类
void setMessageFlags(DistributionMessage gfmsg, Message msg) {
  // GemFire uses its own reply processors so there is no need
  // to maintain message order
  msg.setFlag(Flag.OOB);
  // Bundling is mostly only useful if we're doing no-ack work,
  // which is fairly rare
  msg.setFlag(Flag.DONT_BUNDLE);

  if (gfmsg.getProcessorType() == DistributionManager.HIGH_PRIORITY_EXECUTOR
      || gfmsg instanceof HighPriorityDistributionMessage || AlertAppender.isThreadAlerting()) {
    msg.setFlag(Flag.NO_FC);
    msg.setFlag(Flag.SKIP_BARRIER);
  }
  if (gfmsg instanceof DistributedCacheOperation.CacheOperationMessage) {
    // we don't want to see our own cache operation messages
    msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:JGroupsMessenger.java

示例2: run

import org.jgroups.Message; //导入方法依赖的package包/类
public void run() {
    for(int i=1; i <= number_of_msgs; i++) {
        try {
            Message msg=new Message(destination, buf);
            if(oob)
                msg.setFlag(Message.Flag.OOB);
            if(dont_bundle)
                msg.setFlag(Message.Flag.DONT_BUNDLE);
            if(i > 0 && do_print > 0 && i % do_print == 0)
                System.out.println("-- sent " + i);
            output_lock.lock(); // need to sync if we have more than 1 sender
            try {
                // msg.writeTo(output);
                writeMessage(msg, output);
            }
            finally {
                output_lock.unlock();
            }
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:25,代码来源:UnicastTestTcp.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: run

import org.jgroups.Message; //导入方法依赖的package包/类
public void run() {
    for(int i=1; i <= number_of_msgs; i++) {
        try {
            Message msg=new Message(null, buf);
            if(oob)
                msg.setFlag(Message.Flag.OOB);
            if(dont_bundle)
                msg.setFlag(Message.Flag.DONT_BUNDLE);
            if(i > 0 && do_print > 0 && i % do_print == 0)
                System.out.println("-- sent " + i);

            Buffer buffer=writeMessage(msg);

            output_lock.lock(); // need to sync if we have more than 1 sender
            try {
                // msg.writeTo(output);
                output.writeInt(buffer.getLength());
                output.write(buffer.getBuf(), buffer.getOffset(), buffer.getLength());
                // output.flush();
            }
            finally {
                output_lock.unlock();
            }
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:30,代码来源:UnicastTestTcpSlow.java

示例5: testLeaveDuringSend

import org.jgroups.Message; //导入方法依赖的package包/类
public void testLeaveDuringSend() throws Exception {
    final JChannel[]          channels = new JChannel[NUM];
    final MessageDispatcher[] dispatchers = new MessageDispatcher[NUM];

    for(int i=0; i < NUM; i++) {
        channels[i]= new JChannel(new SHARED_LOOPBACK(),
                                  new SHARED_LOOPBACK_PING(),
                                  new MERGE3(),
                                  new FD().setValue("timeout", 1000).setValue("max_tries", 1),
                                  new NAKACK2(),
                                  new UNICAST3(),
                                  new STABLE(),
                                  new GMS(),
                                  new RSVP().setValue("ack_on_delivery", false)
                                    .setValue("throw_exception_on_timeout", false));
        channels[i].setName(Character.toString((char) ('A' + i)));
        channels[i].setDiscardOwnMessages(true);
        dispatchers[i]=new MessageDispatcher(channels[i], null, null, new MyRequestHandler());
        channels[i].connect("DynamicDiscardTest");
        System.out.print(i + 1 + " ");
    }
    Util.waitUntilAllChannelsHaveSameSize(10000, 1000, channels);

    // discard all messages (except those to self)
    DISCARD discard = new DISCARD();
    channels[0].getProtocolStack().insertProtocol(discard, ProtocolStack.ABOVE, TP.class);
    discard.setDiscardAll(true);

    // send a RSVP message
    Message msg = new Message(null, "message2");
    msg.setFlag(Message.Flag.RSVP, Message.Flag.OOB);
    RspList<Object> rsps = dispatchers[0].castMessage(null, msg, RequestOptions.SYNC().setTimeout(5000));

    Rsp<Object> objectRsp = rsps.get(channels[1].getAddress());
    assertFalse(objectRsp.wasReceived());
    assertTrue(objectRsp.wasSuspected());
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:38,代码来源:DynamicDiscardTest.java

示例6: 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

示例7: testSizeMessageWithDestAndSrcAndFlags

import org.jgroups.Message; //导入方法依赖的package包/类
public static void testSizeMessageWithDestAndSrcAndFlags() throws Exception {
    Message msg=new Message(UUID.randomUUID(), UUID.randomUUID(), null);
    msg.setFlag(Message.Flag.OOB);
    msg.setFlag(Message.Flag.DONT_BUNDLE);
    _testSize(msg);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:7,代码来源:MessageTest.java

示例8: oob

import org.jgroups.Message; //导入方法依赖的package包/类
private static Message oob() {
    Message retval=new Message();
    retval.setFlag(Message.Flag.OOB);
    return retval;
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:6,代码来源:NakReceiverWindowTest.java


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