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

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

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

Message.setTransientFlagIfAbsent介绍

[英]Atomically checks if a given flag is set and - if not - sets it. When multiple threads concurrently call this method with the same flag, only one of them will be able to set the flag
[中]以原子方式检查给定标志是否已设置,如果未设置,则设置它。当多个线程同时使用同一标志调用此方法时,其中只有一个线程能够设置该标志

代码示例

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

long    seq=tuple.getVal1();
if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
  oob_batch.add(msg);

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

if(loopback) { // sent by self
  if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
    deliver(msg, sender, hdr.seqno, "OOB message");

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

long    seq=tuple.getVal1();
if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
  oob_batch.add(msg);

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

/** Called when the sender of a message is the local member. In this case, we don't need to add the message
 * to the table as the sender already did that */
protected void handleDataReceivedFromSelf(final Address sender, long seqno, Message msg) {
  Entry entry=send_table.get(sender);
  if(entry == null || entry.state() == State.CLOSED) {
    log.warn("%s: entry not found for %s; dropping message", local_addr, sender);
    return;
  }
  update(entry, 1);
  final Table<Message> win=entry.msgs;
  // An OOB message is passed up immediately. Later, when remove() is called, we discard it. This affects ordering !
  // http://jira.jboss.com/jira/browse/JGRP-377
  if(msg.isFlagSet(Message.Flag.OOB)) {
    msg=win.get(seqno); // we *have* to get a message, because loopback means we didn't add it to win !
    if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
      deliverMessage(msg, sender, seqno);
    // we don't steal work if the message is internal (https://issues.jboss.org/browse/JGRP-1733)
    if(msg != null && msg.isFlagSet(Message.Flag.INTERNAL)) {
      processInternalMessage(win, sender);
      return;
    }
  }
  removeAndDeliver(win, sender);
}

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

long    seq=tuple.getVal1();
if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
  oob_batch.add(msg);

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

if(loopback) { // sent by self
  if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
    deliver(msg, sender, hdr.seqno, "OOB message");

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

long    seq=tuple.getVal1();
if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
  oob_batch.add(msg);

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

/** Called when the sender of a message is the local member. In this case, we don't need to add the message
 * to the table as the sender already did that */
protected void handleDataReceivedFromSelf(final Address sender, long seqno, Message msg) {
  Entry entry=send_table.get(sender);
  if(entry == null || entry.state() == State.CLOSED) {
    log.warn("%s: entry not found for %s; dropping message", local_addr, sender);
    return;
  }
  update(entry, 1);
  final Table<Message> win=entry.msgs;
  // An OOB message is passed up immediately. Later, when remove() is called, we discard it. This affects ordering !
  // http://jira.jboss.com/jira/browse/JGRP-377
  if(msg.isFlagSet(Message.Flag.OOB)) {
    msg=win.get(seqno); // we *have* to get a message, because loopback means we didn't add it to win !
    if(msg != null && msg.isFlagSet(Message.Flag.OOB) && msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED))
      deliverMessage(msg, sender, seqno);
    // we don't steal work if the message is internal (https://issues.jboss.org/browse/JGRP-1733)
    if(msg != null && msg.isFlagSet(Message.Flag.INTERNAL)) {
      processInternalMessage(win, sender);
      return;
    }
  }
  removeAndDeliver(win, sender);
}

相关文章