java.util.concurrent.LinkedBlockingQueue.element()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(117)

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

LinkedBlockingQueue.element介绍

暂无

代码示例

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

/**
 * When a COMMIT message is received, eventually this method is called,
 * which matches up the zxid from the COMMIT with (hopefully) the head of
 * the pendingTxns queue and hands it to the commitProcessor to commit.
 * @param zxid - must correspond to the head of pendingTxns if it exists
 */
public void commit(long zxid) {
  if (pendingTxns.size() == 0) {
    LOG.warn("Committing " + Long.toHexString(zxid)
        + " without seeing txn");
    return;
  }
  long firstElementZxid = pendingTxns.element().zxid;
  if (firstElementZxid != zxid) {
    LOG.error("Committing zxid 0x" + Long.toHexString(zxid)
        + " but next pending txn 0x"
        + Long.toHexString(firstElementZxid));
    System.exit(ExitCode.UNMATCHED_TXN_COMMIT.getValue());
  }
  Request request = pendingTxns.remove();
  commitProcessor.commit(request);
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

/**
 * When a COMMIT message is received, eventually this method is called, 
 * which matches up the zxid from the COMMIT with (hopefully) the head of
 * the pendingTxns queue and hands it to the commitProcessor to commit.
 * @param zxid - must correspond to the head of pendingTxns if it exists
 */
public void commit(long zxid) {
  if (pendingTxns.size() == 0) {
    LOG.warn("Committing " + Long.toHexString(zxid)
        + " without seeing txn");
    return;
  }
  long firstElementZxid = pendingTxns.element().zxid;
  if (firstElementZxid != zxid) {
    LOG.error("Committing zxid 0x" + Long.toHexString(zxid)
        + " but next pending txn 0x"
        + Long.toHexString(firstElementZxid));
    System.exit(12);
  }
  Request request = pendingTxns.remove();
  commitProcessor.commit(request);
}

代码示例来源:origin: jankotek/mapdb

/**
 * element returns next element, or throws NSEE if empty
 */
public void testElement() {
  LinkedBlockingQueue q = populatedQueue(SIZE);
  for (int i = 0; i < SIZE; ++i) {
    assertEquals(i, q.element());
    assertEquals(i, q.poll());
  }
  try {
    q.element();
    shouldThrow();
  } catch (NoSuchElementException success) {}
}

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

Request request = fzk.pendingTxns.element();
SetDataTxn setDataTxn = (SetDataTxn) request.getTxn();                                                                                                      
QuorumVerifier qv = self.configFromString(new String(setDataTxn.getData()));

代码示例来源:origin: rhq-project/rhq

public Runnable element() {
  return m_queue.element();
}

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

public Runnable element() {
 return blockingQueue.element();
}

代码示例来源:origin: davidB/metrics-influxdb

public T element() {
  return delegate.element();
}

代码示例来源:origin: org.rhq/rhq-enterprise-comm

public Runnable element() {
  return m_queue.element();
}

代码示例来源:origin: org.apache.hadoop/zookeeper

/**
 * When a COMMIT message is received, eventually this method is called, 
 * which matches up the zxid from the COMMIT with (hopefully) the head of
 * the pendingTxns queue and hands it to the commitProcessor to commit.
 * @param zxid - must correspond to the head of pendingTxns if it exists
 */
public void commit(long zxid) {
  if (pendingTxns.size() == 0) {
    LOG.warn("Committing " + Long.toHexString(zxid)
        + " without seeing txn");
    return;
  }
  long firstElementZxid = pendingTxns.element().zxid;
  if (firstElementZxid != zxid) {
    LOG.fatal("Committing zxid 0x" + Long.toHexString(zxid)
        + " but next pending txn 0x"
        + Long.toHexString(firstElementZxid));
    System.exit(12);
  }
  Request request = pendingTxns.remove();
  commitProcessor.commit(request);
}

相关文章

微信公众号

最新文章

更多