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

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

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

LinkedBlockingDeque.take介绍

暂无

代码示例

代码示例来源:origin: alibaba/jstorm

@Override
public void nextTuple() {
  OnsTuple OnsTuple = null;
  try {
    OnsTuple = sendingQueue.take();
  } catch (InterruptedException ignored) {
  }
  if (OnsTuple == null) {
    return;
  }
  sendTuple(OnsTuple);
}

代码示例来源:origin: alibaba/jstorm

@Override
public void run() {
  LOG.info("Start");
  while (isRunning) {
    Signal signal;
    try {
      signal = waitingSignals.take();
      if (signal != null) {
        handle(signal);
      }
    } catch (Throwable e) {
      LOG.error("Failed to handle " + e.getCause(), e);
    }
  }
  LOG.info("End");
}

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

@Override
public int read() throws IOException {
  if (end) {
    return -1;
  }
  try {
    InputStream take = isList.take();
    if (checkEndOfInput(take)) {
      return -1;
    }
    int read = take.read();
    if (take.available() > 0) {
      isList.addFirst(take);
    }
    return read;
  } catch (InterruptedException e) {
    throw new IOException("Interrupted.", e);
  }
}

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

@Override
public int read(byte[] b, int off, int len) throws IOException {
  if (end) {
    return -1;
  }
  InputStream take;
  try {
    take = isList.take();
    if (checkEndOfInput(take)) {
      return -1;
    }
    int read = take.read(b, off, len);
    if (take.available() > 0) {
      isList.addFirst(take);
    }
    return read;
  } catch (InterruptedException e) {
    throw new IOException("Interrupted.", e);
  }
}

代码示例来源:origin: alibaba/nacos

@Override
  public void run() {
    String domName = null;
    String serverIP = null;
    try {
      while (true) {
        DomainKey domainKey = null;
        try {
          domainKey = toBeUpdatedDomsQueue.take();
        } catch (Exception e) {
          Loggers.EVT_LOG.error("[UPDATE-DOMAIN] Exception while taking item from LinkedBlockingDeque.");
        }
        if (domainKey == null) {
          continue;
        }
        domName = domainKey.getDomName();
        serverIP = domainKey.getServerIP();
        domainUpdateExecutor.execute(new DomUpdater(domainKey.getNamespaceId(), domName, serverIP));
      }
    } catch (Exception e) {
      Loggers.EVT_LOG.error("[UPDATE-DOMAIN] Exception while update dom: {} from {}, error: {}", domName, serverIP, e);
    }
  }
}

代码示例来源:origin: linkedin/cruise-control

boolean retryHandling = false;
try {
 anomaly = _anomalies.take();
 LOG.trace("Received anomaly {}", anomaly);
 if (anomaly == SHUTDOWN_ANOMALY) {

代码示例来源:origin: saki4510t/libcommon

/** 要求メッセージを取り出す処理(要求メッセージがなければブロックされる) */
protected Request takeRequest() throws InterruptedException {
  return mRequestQueue.take();
}

代码示例来源:origin: eventsourcing/es4j

/**
 * Returns entity UUID. Generates one if none assigned.
 *
 * @return Entity UUID
 */
@Override
public UUID uuid() {
  while (uuid == null) {
    try {
      uuid = uuids.take();
    } catch (InterruptedException e) {
    }
  }
  return uuid;
}

代码示例来源:origin: espertechinc/esper

public void next() throws InterruptedException {
  Object next = emittables.take();
  graphContext.submit(next);
}

代码示例来源:origin: lucastheisen/jsch-nio

@Override
  public WatchKey take() throws InterruptedException {
    ensureOpen();
    return pendingKeys.take();
  }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

@Override
public RawFragmentBatch take() throws IOException, InterruptedException {
 RawFragmentBatch batch = buffer.take();
 batch.sendOk();
 return batch;
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

@Override
public RawFragmentBatch take() throws IOException, InterruptedException {
 return buffer.take().get();
}

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

@Override
public final WatchKey take()
    throws InterruptedException {
  checkOpen();
  WatchKey key = pendingKeys.take();
  checkKey(key);
  return key;
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public final WatchKey take() throws InterruptedException {
  checkOpen();
  WatchKey key = pendingKeys.take();
  checkKey(key);
  return key;
}

代码示例来源:origin: io.restx/restx-barbarywatch

@Override
public final WatchKey take()
    throws InterruptedException {
  checkOpen();
  WatchKey key = pendingKeys.take();
  checkKey(key);
  return key;
}

代码示例来源:origin: com.baidu/jprotobuf-rpc-core

@Override
  public void run() {
    while (!stop) {
      RegisterInfo registerInfo  = null;
      try {
        registerInfo = asyncQueue.take();
        doRegister(registerInfo);
      } catch (Exception e) {
        // any exception do retry
        if (registerInfo != null) {
          asyncQueue.addLast(registerInfo);
        }
      }
    }
  }
});

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Override
 public Boolean call() throws Exception {
  Compressor c = queue.take();
  CodecPool.returnCompressor(c);
  return c != null;
 }
};

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Override
 public Boolean call() throws Exception {
  Compressor c = queue.take();
  CodecPool.returnCompressor(c);
  return c != null;
 }
};

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Override
 public Boolean call() throws Exception {
  Decompressor dc = queue.take();
  CodecPool.returnDecompressor(dc);
  return dc != null;
 }
};

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Override
 public Boolean call() throws Exception {
  Decompressor dc = queue.take();
  CodecPool.returnDecompressor(dc);
  return dc != null;
 }
};

相关文章

微信公众号

最新文章

更多