/** * is running job * @return */ public boolean isRunningOrHasQueue() { return running || triggerQueue.size()>0; }
/** * Return number cached records. * * @return number cached records. */ public int getNumCachedRecords() { return readAheadRecords.size(); }
@Override public Integer getValue() { return messages.getIndexFailureQueue().size(); } });
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("LearnerHandler ").append(sock); sb.append(" tickOfNextAckDeadline:").append(tickOfNextAckDeadline()); sb.append(" synced?:").append(synced()); sb.append(" queuedPacketLength:").append(queuedPackets.size()); return sb.toString(); }
@Override public boolean isQueueSpaceAvailable() { return queue.size() < rejectionQueueSizeThreshold; }
private void setReadAheadCallback(ReadAheadCallback callback) { synchronized (sharedLock) { this.readAheadCallback = callback; if (readAheadRecords.size() < maxNumCachedRecords) { invokeReadAheadCallback(); } } }
@Override public void setDone() throws InterruptedException { if (LlapIoImpl.LOG.isDebugEnabled()) { LlapIoImpl.LOG.debug("setDone called; closed {}, interrupted {}, err {}, pending {}", isClosed, isInterrupted, pendingError.get(), queue.size()); } enqueueInternal(DONE_OBJECT); }
@Override public void consumeData(ColumnVectorBatch data) throws InterruptedException { if (LlapIoImpl.LOG.isTraceEnabled()) { LlapIoImpl.LOG.trace("consume called; closed {}, interrupted {}, err {}, pending {}", isClosed, isInterrupted, pendingError.get(), queue.size()); } enqueueInternal(data); }
@Override public void setError(Throwable t) throws InterruptedException { counters.incrCounter(LlapIOCounters.NUM_ERRORS); LlapIoImpl.LOG.debug("setError called; closed {}, interrupted {}, err {}, pending {}", isClosed, isInterrupted, pendingError.get(), queue.size()); LlapIoImpl.LOG.warn("setError called with an error", t); assert t != null; pendingError.compareAndSet(null, t); enqueueInternal(t); }
public void expireAll() { if (FileDownloadLog.NEED_LOG) { FileDownloadLog.d(this, "expire %d tasks", mWorkQueue.size()); } mPool.shutdownNow(); init(); }
/** {@inheritDoc} */ @Override public long getPendingMessages() { log.debug("Checking pending queue size. Session id: {} closing: {} state: {}", sessionId, closing, state); if (state.getState() == RTMP.STATE_DISCONNECTED) { log.debug("Connection is disconnected"); pendingOutMessages.clear(); } return pendingOutMessages.size(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); SocketAddress local = sendThread.getClientCnxnSocket().getLocalSocketAddress(); SocketAddress remote = sendThread.getClientCnxnSocket().getRemoteSocketAddress(); sb .append("sessionid:0x").append(Long.toHexString(getSessionId())) .append(" local:").append(local) .append(" remoteserver:").append(remote) .append(" lastZxid:").append(lastZxid) .append(" xid:").append(xid) .append(" sent:").append(sendThread.getClientCnxnSocket().getSentCount()) .append(" recv:").append(sendThread.getClientCnxnSocket().getRecvCount()) .append(" queuedpkts:").append(outgoingQueue.size()) .append(" pendingresp:").append(pendingQueue.size()) .append(" queuedevents:").append(eventThread.waitingEvents.size()); return sb.toString(); }
@Override public void onSuccess(LogRecordWithDLSN record) { this.lastSeenDLSN = record.getDlsn(); if (!startTransactionId.isPresent() || record.getTransactionId() >= startTransactionId.get()) { readAheadRecords.add(record); } if (readAheadRecords.size() >= maxNumCachedRecords) { setReadAheadCallback(this); } else { scheduleReadNext(); } }
private static void replayEvents() { final LinkedBlockingQueue<SubstituteLoggingEvent> queue = SUBST_FACTORY.getEventQueue(); final int queueSize = queue.size(); int count = 0; final int maxDrain = 128; List<SubstituteLoggingEvent> eventList = new ArrayList<SubstituteLoggingEvent>(maxDrain); while (true) { int numDrained = queue.drainTo(eventList, maxDrain); if (numDrained == 0) break; for (SubstituteLoggingEvent event : eventList) { replaySingleEvent(event); if (count++ == 0) emitReplayOrSubstituionWarning(event, queueSize); } eventList.clear(); } }
private static void checkErrors(TaskStateMachine taskStateMachine) { if (taskStateMachine.getFailureCauses().size() > 0) { Throwable exception = requireNonNull(taskStateMachine.getFailureCauses().peek()); throw new RuntimeException(exception.getMessage(), exception); } }
/** * Modifications do not cause iterators to fail */ public void testWeaklyConsistentIteration() { final LinkedBlockingQueue q = new LinkedBlockingQueue(3); q.add(one); q.add(two); q.add(three); for (Iterator it = q.iterator(); it.hasNext();) { q.remove(); it.next(); } assertEquals(0, q.size()); }
@Test public void testIterationHeadWatermarkEmission() throws Exception { StreamTaskTestHarness<Integer> harness = new StreamTaskTestHarness<>( StreamIterationHead::new, BasicTypeInfo.INT_TYPE_INFO); harness.setupOutputForSingletonOperatorChain(); harness.getStreamConfig().setIterationId("1"); harness.getStreamConfig().setIterationWaitTime(1); harness.invoke(); harness.waitForTaskCompletion(); assertEquals(1, harness.getOutput().size()); assertEquals(new Watermark(Long.MAX_VALUE), harness.getOutput().peek()); } }