/** * Returns a string representation of the arithmetic mean of all recorded durations. * * @return the string representation of the average duration; never null but possibly {@link Duration#ZERO}. */ default public String getAverageAsString() { return asString(getAverage()); } }
private void removeFromSegment(Set<HashEntry<K, V>> evicted) { for ( HashEntry<K, V> e : evicted ) { ( (LIRSHashEntry<K, V>) e ).evict(); segment.evictionListener.onEntryChosenForEviction( e.value ); segment.remove( e.key, e.hash, null ); } }
public ChangeEventSourceCoordinator(OffsetContext previousOffset, ErrorHandler errorHandler, Class<? extends SourceConnector> connectorType, String logicalName, ChangeEventSourceFactory changeEventSourceFactory, EventDispatcher<?> eventDispatcher) { this.previousOffset = previousOffset; this.errorHandler = errorHandler; this.changeEventSourceFactory = changeEventSourceFactory; this.executor = Threads.newSingleThreadExecutor(connectorType, logicalName, "change-event-source-coordinator"); this.eventDispatcher = eventDispatcher; }
public static Statistics completionTime() { return sw.durations().statistics(); }
/** * Create a directory within the test data directory at the given relative path. * * @param relativePath the path of the directory within the test data directory; may not be null * @return the reference to the existing readable and writable directory */ public static File createTestingDirectory(String relativePath) { Path dirPath = createTestingPath(relativePath); return IoUtil.createDirectory(dirPath); }
/** * Create a file within the test data directory at the given relative path. * * @param relativePath the path of the file within the test data directory; may not be null * @return the reference to the existing readable and writable file */ public static File createTestingFile(String relativePath) { Path path = createTestingPath(relativePath); return IoUtil.createFile(path); }
/** * Returns a string representation of the minimum of all recorded durations. * * @return the string representation of the minimum duration; never null but possibly {@link Duration#ZERO}. */ default public String getMinimumAsString() { return asString(getMinimum()); }
/** * Returns a string representation of the maximum of all recorded durations. * * @return the string representation of the maximum duration; never null but possibly {@link Duration#ZERO}. */ default public String getMaximumAsString() { return asString(getMaximum()); }
@Override public Iterator<Entry> iterator() { return Iterators.around(Sequences.infiniteIntegers(0), values, CONVERT_PAIR_TO_ENTRY); }
/** * Moves this entry to the end of the queue. */ private void moveToQueueEnd() { tempRemoveFromQueue(); addToQueueBefore( owner.header ); }
/** * Removes this entry from the stack. */ private void removeFromStack() { tempRemoveFromStack(); previousInStack = null; nextInStack = null; }
/** * Removes this entry from the queue. */ private void removeFromQueue() { tempRemoveFromQueue(); previousInQueue = null; nextInQueue = null; }
@Override public Set<HashEntry<K, V>> onEntryMiss(HashEntry<K, V> en) { LIRSHashEntry<K, V> e = (LIRSHashEntry<K, V>) en; Set<HashEntry<K, V>> evicted = e.miss(); removeFromSegment( evicted ); return evicted; }
@Override public HashEntry<K, V> createNewEntry(K key, int hash, HashEntry<K, V> next, V value) { return new LIRSHashEntry<K, V>( this, key, hash, next, value ); } }
/** * Returns an enumeration of the keys in this table. * * @return an enumeration of the keys in this table * * @see #keySet() */ public Enumeration<K> keys() { return new KeyIterator(); }
/** * Returns an enumeration of the values in this table. * * @return an enumeration of the values in this table * * @see #values() */ public Enumeration<V> elements() { return new ValueIterator(); }
/** * Compute a combined hash code from the supplied objects. This method always returns 0 if no objects are supplied. * * @param objects the objects that should be used to compute the hash code * @return the hash code */ public static int compute(Object... objects) { return computeHashCode(0, objects); }
/** * Create a directory within the test data directory at the given relative path. * * @param relativePath the path of the directory within the test data directory; may not be null * @param removeExistingContent true if any existing content should be removed * @return the reference to the existing readable and writable directory * @throws IOException if there is a problem deleting the files at this path */ public static File createTestingDirectory(String relativePath, boolean removeExistingContent) throws IOException { Path dirPath = createTestingPath(relativePath); return IoUtil.createDirectory(dirPath, removeExistingContent); }