private void clearNotOwnedInodeCacheIfTooLarge() { if(socketInodesNotOwnedByThisProcess.size() >= MAX_NOT_OWNED_INODE_CACHE_SIZE) { socketInodesNotOwnedByThisProcess.clear(); } } }
private void clearNotOwnedInodeCacheIfTooLarge() { if(socketInodesNotOwnedByThisProcess.size() >= MAX_NOT_OWNED_INODE_CACHE_SIZE) { socketInodesNotOwnedByThisProcess.clear(); } } }
/** * Clear and populate the supplied LongHashSet with the inodes associated with sockets owned by this process. * @param targetForOwnedSocketInodes the container for the retrieved inodes */ @Override public void accept(final LongHashSet targetForOwnedSocketInodes) { targetForOwnedSocketInodes.clear(); try { Files.list(Paths.get("/proc/self/fd")). filter(Files::isSymbolicLink). mapToLong(CurrentProcessSocketInodeRetriever::socketLinkInode). filter(inode -> inode != NOT_A_SOCKET). forEach(targetForOwnedSocketInodes::add); } catch(final IOException e) { throw new UncheckedIOException(e); } }
public void reset(final File backupLocation) { if (!currentlyAuthenticatedSessionIds.isEmpty()) { throw new IllegalStateException( "There are currently authenticated sessions: " + currentlyAuthenticatedSessionIds); } counter = LOWEST_VALID_SESSION_ID; currentlyAuthenticatedSessionIds.clear(); compositeToContext.clear(); if (backupLocation != null) { mappedFile.transferTo(backupLocation); } buffer.setMemory(0, buffer.capacity(), (byte)0); initialiseBuffer(); }
public void purgeEntriesOlderThan(final long latestUpdateCount) { keysForRemoval.clear(); final Long2ObjectHashMap<T>.KeyIterator iterator = monitoredSocketInstances.keySet().iterator(); while(iterator.hasNext()) { final long key = iterator.nextLong(); if(monitoredSocketInstances.get(key).getUpdateCount() != latestUpdateCount) { keysForRemoval.add(key); } } final LongIterator keyIterator = keysForRemoval.iterator(); while(keyIterator.hasNext()) { final long key = keyIterator.nextValue(); final T staleEntry = monitoredSocketInstances.remove(key); staleEntry.describeTo(socketDescriptor); lifecycleListener.socketMonitoringStopped( socketDescriptor.getAddress(), socketDescriptor.getPort(), socketDescriptor.getInode()); } } }
sessionIds.clear(); while (sessionsDecoder.hasNext())