slots = new ByteSlot[numSlots]; slotsCache = new LinkedTransferQueue<>(); while (slotsCache.size() < numSlots) { slotsCache.offer(new ByteSlot());
@Override public final int size() { return queue.size(); }
private void checkStarted() { if (checkQueueSize) { if (queue.size() > checkQueueSizeWarnIfOver) { logger.warn("{} :: name {} queue is filling up", this.getClass().getSimpleName(), name); } } if (checkStart) { if (checkEveryStarted % checkStartWarnEvery == 0) { if (!owner.started()) { logger.warn("{} :: name {} send queue NOT STARTED", this.getClass().getSimpleName(), name); } } checkEveryStarted++; } }
/** * Will flush to secondary storage if needed. This is used mostly by REMOTE_DB at the moment. */ protected void flushReadsIfNeeded() throws InterruptedException { long now = timer.time(); /* Every 250 ms flush the read queue. */ if (now - lastReadFlushTime > flushQueueInterval && readList.size() > 0) { if (!loadQueue.offer(new ArrayList<>(readList))) { logger.warn("MySQL LOAD QUEUE IS FULL", loadQueue.size()); } else { readList.clear(); } lastReadFlushTime = now; } }
if (outputMap.size() > 0 && writeQueue.size() == 0) { try { writeQueue.put(new HashMap<>(outputMap)); } catch (Exception ex) { logger.error(ex, "MySQL Store, Unable to add an item to the store queue, this means we can't write to MySQL buf size", outputMap.size(), "queue size", writeQueue.size()); outputMap.size(), "queue size", writeQueue.size());
private void handleRemove(List<DataStoreRequest> operations) { for (DataStoreRequest dataItem : operations) { if (dataItem instanceof RemoveRequest) { RemoveRequest request = (RemoveRequest) dataItem; if (hasBlackList) { if (keyblackList.contains(request.key())) { continue; } } removeList.add(request.key()); if (removeList.size() >= maxWriteBatch) { try { writeQueue.put(outputMap); removeList.clear(); } catch (Exception ex) { logger.fatal(ex, "MySQL Store, Unable to add an item to the store queue for REMOVE, this means we can't write to MySQL", removeList.size(), "queue size", writeQueue.size()); } } } } }
/** * Will flush to secondary storage if needed. This is used mostly by REMOTE_DB at the moment. */ protected void flushWritesIfNeeded() throws InterruptedException { long now = timer.time(); /* Every 30 seconds flush the write queue. */ if (now - lastWriteFlushTime > dataStoreConfig.dbWriteFlushQueueIntervalMS()) { if (outputMap.size() > 0) { if (!writeQueue.offer(new LinkedHashMap(outputMap))) { logger.warn("MySQL STORE QUEUE IS FULL", writeQueue.size()); } else { outputMap.clear(); } lastWriteFlushTime = now; } if (removeList.size() > 0) { if (!writeQueue.offer(new ArrayList<>(removeList))) { logger.warn("MySQL LOAD QUEUE IS FULL", writeQueue.size()); } else { removeList.clear(); } } } }
slots = new ByteSlot[numSlots]; slotsCache = new LinkedTransferQueue(); while (slotsCache.size() < numSlots) { slotsCache.offer(new ByteSlot());
slots = new ByteSlot[numSlots]; slotsCache = new LinkedTransferQueue<>(); while (slotsCache.size() < numSlots) { slotsCache.offer(new ByteSlot());
slots = new ByteSlot[numSlots]; slotsCache = new LinkedTransferQueue(); while (slotsCache.size() < numSlots) { slotsCache.offer(new ByteSlot());
if (loadQueue.size() == 0) {