nextValues.remove( lowestKey, inner );
stealerToStolenPrimaryPartitions.remove(entry.getKey(), entry.getValue());
@Override synchronized void touch(final String bpid, final long blockId) { Map<Long, RamDiskReplicaLru> map = replicaMaps.get(bpid); RamDiskReplicaLru ramDiskReplicaLru = map.get(blockId); if (ramDiskReplicaLru == null) { return; } ramDiskReplicaLru.numReads.getAndIncrement(); // Reinsert the replica with its new timestamp. if (replicasPersisted.remove(ramDiskReplicaLru.lastUsedTime, ramDiskReplicaLru)) { ramDiskReplicaLru.lastUsedTime = Time.monotonicNow(); replicasPersisted.put(ramDiskReplicaLru.lastUsedTime, ramDiskReplicaLru); } }
/** * Discard any state we are tracking for the given replica. This could mean * the block is either deleted from the block space or the replica is no longer * on transient storage. * * @param deleteSavedCopies true if we should delete the saved copies on * persistent storage. This should be set by the * caller when the block is no longer needed. */ @Override synchronized void discardReplica( final String bpid, final long blockId, boolean deleteSavedCopies) { Map<Long, RamDiskReplicaLru> map = replicaMaps.get(bpid); if (map == null) { return; } RamDiskReplicaLru ramDiskReplicaLru = map.get(blockId); if (ramDiskReplicaLru == null) { return; } if (deleteSavedCopies) { ramDiskReplicaLru.deleteSavedFiles(); } map.remove(blockId); replicasPersisted.remove(ramDiskReplicaLru.lastUsedTime, ramDiskReplicaLru); // replicasNotPersisted will be lazily GC'ed. }
@Override synchronized void touch(final String bpid, final long blockId) { Map<Long, RamDiskReplicaLru> map = replicaMaps.get(bpid); RamDiskReplicaLru ramDiskReplicaLru = map.get(blockId); if (ramDiskReplicaLru == null) { return; } ramDiskReplicaLru.numReads.getAndIncrement(); // Reinsert the replica with its new timestamp. if (replicasPersisted.remove(ramDiskReplicaLru.lastUsedTime, ramDiskReplicaLru)) { ramDiskReplicaLru.lastUsedTime = Time.monotonicNow(); replicasPersisted.put(ramDiskReplicaLru.lastUsedTime, ramDiskReplicaLru); } }
private void releaseMessageID(InetSocketAddress remoteSocket, int messageID, Token token) { try{ lock.writeLock().lock(); if (this.allocations.remove(remoteSocket, messageID)) { log.info("Released message ID \"{}\" (Remote Socket: \"{}\", Token: {}", new Object[]{(messageID % MODULUS), remoteSocket, token}); } setChanged(); notifyObservers(new MessageIDRelease(remoteSocket, messageID % MODULUS, token)); } finally { lock.writeLock().unlock(); } }
/** * Discard any state we are tracking for the given replica. This could mean * the block is either deleted from the block space or the replica is no longer * on transient storage. * * @param deleteSavedCopies true if we should delete the saved copies on * persistent storage. This should be set by the * caller when the block is no longer needed. */ @Override synchronized void discardReplica( final String bpid, final long blockId, boolean deleteSavedCopies) { Map<Long, RamDiskReplicaLru> map = replicaMaps.get(bpid); if (map == null) { return; } RamDiskReplicaLru ramDiskReplicaLru = map.get(blockId); if (ramDiskReplicaLru == null) { return; } if (deleteSavedCopies) { ramDiskReplicaLru.deleteSavedFiles(); } map.remove(blockId); replicasPersisted.remove(ramDiskReplicaLru.lastUsedTime, ramDiskReplicaLru); // replicasNotPersisted will be lazily GC'ed. }
public void replace(T value, double score) { if (callback!=null) callback.execute(value); backingQueue.remove(score, value); backingQueue.put(score, value); }
Set<Integer> indexes = indexesByValue.get(value); if (!indexes.contains(i)) { valuesSortedByCount.remove(indexes.size(), value); indexes.add(i); valuesSortedByCount.put(indexes.size(), value);
this.localShards.get(sourceKey).scheduledMessages.remove(scheduledMessage.getFireTime(TimeUnit.MILLISECONDS), scheduledMessage); }); } catch(RetriableException e) {
/** * Asserts that a {@link JavaCheck} will raise the expected issue provided as method parameter, and not more. Expected issues are provided as a parameter. * * @see ExpectedIssuesCollector * @param testFileName the name of the test file that has to be checked for issues * @param check the {@link JavaCheck} that is to be run against the test file * @param expectedLine the line number on which the issue message is expected (or 0 if it is a file wide issue) * @param expectedMessage the expected message */ public static void assertHasSingleIssue(final String testFileName, final JavaFileScanner check, @Nonnull @Nonnegative final Integer expectedLine, final String expectedMessage) { final TreeMultimap<Integer, String> actualIssues = ActualIssuesCollector.collect(new File(testFileName), check); final SoftAssertions softly = new SoftAssertions(); softly.assertThat(actualIssues.get(expectedLine)) .overridingErrorMessage(EXPECTED_MESSAGE_PREFIX, formatIssue(expectedLine, expectedMessage)) .contains(expectedMessage); actualIssues.remove(expectedLine, expectedMessage); softly.assertThat(actualIssues.size()) .overridingErrorMessage(UNEXPECTED_MESSAGE_PREFIX, formatIssues(actualIssues)) .isEqualTo(0); softly.assertAll(); }