本文整理了Java中java.util.concurrent.BlockingQueue.clear()
方法的一些代码示例,展示了BlockingQueue.clear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockingQueue.clear()
方法的具体详情如下:
包路径:java.util.concurrent.BlockingQueue
类名称:BlockingQueue
方法名:clear
暂无
代码示例来源:origin: apache/incubator-druid
@Override
public void handleCancel(String consumerTag)
{
_queue.clear();
}
代码示例来源:origin: apache/incubator-druid
@Override
public void handleShutdownSignal(String consumerTag, ShutdownSignalException sig)
{
_queue.clear();
}
代码示例来源:origin: aws/aws-sdk-java
public synchronized void release() {
if (refCount > 0) {
--refCount;
}
if (refCount == 0 && initialized) {
exec.shutdown();
tasks.clear();
exec = null;
tasks = null;
initialized = false;
}
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void clear() {
queArray.clear();
done.set( false );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void clear() {
queArray.clear();
done.set( false );
}
代码示例来源:origin: alibaba/cobar
@Override
protected void offerDataError() {
dataQueue.clear();
resultStatus = RESULT_STATUS_INIT;
throw new RuntimeException("offer data error!");
}
代码示例来源:origin: apache/hbase
@VisibleForTesting
void clearChunksInPool() {
if (dataChunksPool != null) {
dataChunksPool.reclaimedChunks.clear();
}
if (indexChunksPool != null) {
indexChunksPool.reclaimedChunks.clear();
}
}
代码示例来源:origin: TooTallNate/Java-WebSocket
@Override
public final void onWriteDemand( WebSocket w ) {
WebSocketImpl conn = (WebSocketImpl) w;
try {
conn.getSelectionKey().interestOps( SelectionKey.OP_READ | SelectionKey.OP_WRITE );
} catch ( CancelledKeyException e ) {
// the thread which cancels key is responsible for possible cleanup
conn.outQueue.clear();
}
selector.wakeup();
}
代码示例来源:origin: alibaba/cobar
@Override
protected void offerDataError() {
dataQueue.clear();
resultStatus = RESULT_STATUS_INIT;
throw new HeartbeatException("offer data error!");
}
代码示例来源:origin: alibaba/cobar
@Override
protected void handleDataError(Throwable t) {
dataQueue.clear();
resultStatus = RESULT_STATUS_INIT;
source.error(ErrorCode.ERR_HANDLE_DATA, t);
}
代码示例来源:origin: alibaba/cobar
@Override
protected void handleDataError(Throwable t) {
dataQueue.clear();
resultStatus = RESULT_STATUS_INIT;
responseHandler.connectionError(t, source);
}
代码示例来源:origin: alibaba/cobar
@Override
protected void handleDataError(Throwable t) {
dataQueue.clear();
resultStatus = RESULT_STATUS_INIT;
source.error(ErrorCode.ERR_HANDLE_DATA, t);
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void setDone() {
super.setDone();
if ( putIndex > 0 && putIndex < size && inputBuffer != null ) {
inputBuffer[putIndex] = null; // signal the end of buffer
for ( int i = putIndex + 1; i < size; i++ ) {
inputBuffer[i] = null;
}
getArray.offer( inputBuffer );
}
putArray.clear();
}
代码示例来源:origin: alibaba/cobar
@Override
protected void offerDataError() {
dataQueue.clear();
resultStatus = RESULT_STATUS_INIT;
throw new HeartbeatException("offer data error!");
}
代码示例来源:origin: apache/pulsar
@Override
public void redeliverUnacknowledgedMessages() {
lock.writeLock().lock();
try {
consumers.values().stream().forEach(consumer -> consumer.redeliverUnacknowledgedMessages());
incomingMessages.clear();
unAckedMessageTracker.clear();
} finally {
lock.writeLock().unlock();
}
resumeReceivingFromPausedConsumersIfNeeded();
}
代码示例来源:origin: jersey/jersey
@Override
public void close() throws IOException {
if (closed.compareAndSet(false, true)) {
closeQueue();
// we can now safely clear the queue - any blocking read waiting for a buffer
// has been resumed by the EOF buffer
buffers.clear();
}
checkThrowable();
}
代码示例来源:origin: jersey/jersey
@Override
public void close() throws IOException {
if (closed.compareAndSet(false, true)) {
closeQueue();
// we can now safely clear the queue - any blocking read waiting for a buffer
// has been resumed by the EOF buffer
buffers.clear();
}
checkThrowable();
}
代码示例来源:origin: Netflix/eureka
public void stop() throws Exception {
server.stop();
server = null;
port = 0;
registrationStatusesQueue.clear();
registrationStatuses.clear();
applicationMap.clear();
remoteRegionApps.clear();
remoteRegionAppsDelta.clear();
applicationDeltaMap.clear();
}
代码示例来源:origin: alibaba/jstorm
private void cleanupCommittingJobs() {
asyncCommittingThread.deactivate();
asyncCommittingThread.interrupt();
committingQueue.clear();
asyncCommittingThread.activate();
}
}
代码示例来源:origin: google/guava
public void testListeningDecorator_cancelled() throws Exception {
ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(1);
BlockingQueue<?> delegateQueue = delegate.getQueue();
ListeningScheduledExecutorService service = listeningDecorator(delegate);
ListenableFuture<?> future;
ScheduledFuture<?> delegateFuture;
Runnable runnable =
new Runnable() {
@Override
public void run() {}
};
future = service.schedule(runnable, 5, TimeUnit.MINUTES);
future.cancel(true);
assertTrue(future.isCancelled());
delegateFuture = (ScheduledFuture<?>) delegateQueue.element();
assertTrue(delegateFuture.isCancelled());
delegateQueue.clear();
future = service.scheduleAtFixedRate(runnable, 5, 5, TimeUnit.MINUTES);
future.cancel(true);
assertTrue(future.isCancelled());
delegateFuture = (ScheduledFuture<?>) delegateQueue.element();
assertTrue(delegateFuture.isCancelled());
delegateQueue.clear();
future = service.scheduleWithFixedDelay(runnable, 5, 5, TimeUnit.MINUTES);
future.cancel(true);
assertTrue(future.isCancelled());
delegateFuture = (ScheduledFuture<?>) delegateQueue.element();
assertTrue(delegateFuture.isCancelled());
}
内容来源于网络,如有侵权,请联系作者删除!