public void expire(ITaskHunter.IStarter starter) { /** * @see LaunchTaskRunnable#equals(Object) */ //noinspection SuspiciousMethodCalls mWorkQueue.remove(starter); }
/** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { LinkedBlockingQueue q = populatedQueue(SIZE); LinkedBlockingQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE - i, q.size()); for (int j = 0; j < i; ++j) { Integer x = (Integer)(p.remove()); assertFalse(q.contains(x)); } } }
/** * Bring memory usage below totalMemoryAllowed. */ private synchronized void freeIndexInformation() { while (totalMemoryUsed.get() > totalMemoryAllowed) { String s = queue.remove(); IndexInformation info = cache.remove(s); if (info != null) { totalMemoryUsed.addAndGet(-info.getSize()); } } }
public Runnable deleteByName(String name) { NamedRunnable e = (NamedRunnable) keysInProgress.remove(name); if (e != null) { e.cancel(); super.remove(e); } return e; } }
@SuppressWarnings("all") @Override public void unregister(RegisterMeta meta) { if (!queue.remove(meta)) { registerMetaMap.remove(meta); doUnregister(meta); } }
@SuppressWarnings("all") @Override public void unregister(RegisterMeta meta) { if (!queue.remove(meta)) { registerMetaMap.remove(meta); doUnregister(meta); } }
/** * 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); }
/** * This method removes the map from the cache if index information for this * map is loaded(size>0), index information entry in cache will not be * removed if it is in the loading phrase(size=0), this prevents corruption * of totalMemoryUsed. It should be called when a map output on this tracker * is discarded. * @param mapId The taskID of this map. */ public void removeMap(String mapId) { IndexInformation info = cache.get(mapId); if (info == null || ((info != null) && isUnderConstruction(info))) { return; } info = cache.remove(mapId); if (info != null) { totalMemoryUsed.addAndGet(-info.getSize()); if (!queue.remove(mapId)) { LOG.warn("Map ID" + mapId + " not found in queue!!"); } } else { LOG.info("Map ID " + mapId + " not found in cache"); } }
@Override public boolean remove(Object o) { if (super.remove(o)) { this.stats.remove(); postRemove(o); return true; } else { return false; } }
/** * 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); }
private void push() { final int delayMillis; synchronized (queueLock) { if (!disposingList.isEmpty()) { // is disposing. return; } if (waitingQueue.isEmpty()) { // not messenger need be handled. return; } if (!isIntervalValid()) { waitingQueue.drainTo(disposingList); delayMillis = 0; } else { delayMillis = INTERVAL; final int size = Math.min(waitingQueue.size(), SUB_PACKAGE_SIZE); for (int i = 0; i < size; i++) { disposingList.add(waitingQueue.remove()); } } } handler.sendMessageDelayed(handler.obtainMessage(DISPOSE_MESSENGER_LIST, disposingList), delayMillis); }
/** * 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()); }
/** * An add following remove(x) succeeds */ public void testRemoveElementAndAdd() throws InterruptedException { LinkedBlockingQueue q = new LinkedBlockingQueue(); assertTrue(q.add(new Integer(1))); assertTrue(q.add(new Integer(2))); assertTrue(q.remove(new Integer(1))); assertTrue(q.remove(new Integer(2))); assertTrue(q.add(new Integer(3))); assertNotNull(q.take()); }
session.transfer(messageFlowfile, REL_MESSAGE); session.commit(); if (!mqttQueue.remove(mqttMessage) && logger.isWarnEnabled()) { logger.warn(new StringBuilder("FlowFile ") .append(messageFlowfile.getAttribute(CoreAttributes.UUID.key()))
outgoingBuffers.remove();
HdfsUtils.Pair<MessageId, List<Object>> pair = retryList.remove(); emitData(pair.getValue(), pair.getKey()); return;
/** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { LinkedBlockingQueue q = populatedQueue(SIZE); LinkedBlockingQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE - i, q.size()); p.remove(); } }
@Override public void run() { if (verifyConnection(cassandraHost)) { if (((CassandraClientFactory) clientFactory).addCassandraHost(cassandraHost)) { downedHostQueue.remove(cassandraHost); } } } });
@Override public void run() { if(downedHostQueue.contains(cassandraHost) && verifyConnection(cassandraHost)) { if (connectionManager.addCassandraHost(cassandraHost)) { listenerHandler.fireOnHostRestored(cassandraHost); downedHostQueue.remove(cassandraHost); } return; } } });