Package org.apache.cassandra.utils
package org.apache.cassandra.utils
-
ClassDescriptionThis is fork of the Guava AbstractIterator, the only difference is that the next variable is now protected so that the KeyRangeIterator.skipTo method can avoid early state changed.AsymmetricOrdering<T1,
T2> BiLongAccumulator<T,A> BiMultiValMap<K,V> A variant of BiMap which does not enforce uniqueness of values.The following calculations are taken from: http://www.cs.wisc.edu/~cao/papers/summary-cache/node8.html "Bloom Filters - the math" This class's static methods are meant to facilitate the use of the Bloom Filter class by helping to choose correct values of 'bits per element' and 'number of hash functions, k'.A wrapper class that holds two key parameters for a Bloom Filter: the number of hash functions used, and the number of buckets per element used.Annotation to have JMX breaking APIs not trigger test failures, each example must explain why it is ok to expose a JMX breaking APIBulkIterator<V>Utility methods to make ByteBuffers less painful The following should illustrate the different ways byte buffers can be used public void testArrayOffet() { byte[] b = "test_slice_array".getBytes(); ByteBuffer bb = ByteBuffer.allocate(1024); assert bb.position() == 0; assert bb.limit() == 1024; assert bb.capacity() == 1024; bb.put(b); assert bb.position() == b.length; assert bb.remaining() == bb.limit() - bb.position(); ByteBuffer bb2 = bb.slice(); assert bb2.position() == 0; //slice should begin at other buffers current position assert bb2.arrayOffset() == bb.position(); //to match the position in the underlying array one needs to //track arrayOffset assert bb2.limit()+bb2.arrayOffset() == bb.limit(); assert bb2.remaining() == bb.remaining(); } }This class packages several UInt utility methods so we can easily change it's implementation when needed.Implements versioning used in Cassandra and CQL.Wrapper around time related functions that are either implemented by using the default JVM calls or by using a custom implementation for testing purposes.Some extra Collector implementations.Utility methods linked to comparing comparable values.ConcurrentBiMap<K,V> A variant of BiMap that permits concurrent access, and expects uniqueness of values in both domain and range.DefaultValue<T>Provides a means to take snapshots when triggered by anomalous events or when the breaking of invariants is detected.Walks directory recursively, summing up total contents of files within.DynamicList<E>An implementation similar to Guava's Suppliers.memoizeWithExpiration(Supplier) but allowing for memoization to be skipped.Sample-based exponential moving average.FailingBiConsumer<A,B> Utility code to do optimized byte-array comparison.Utility to log heap histogram.Simple class for constructing an EsimtatedHistogram from a set of predetermined valuesIMergeIterator<In,Out> ANavigableSetthat enforces in-order insertion of elements.Mutable integer interval class, thread-safe.A mutable set of closed integer intervals, stored in normalized form (i.e.Interval<C,D> IntervalTree<C extends Comparable<? super C>,D extends Comparable<? super D>, I extends Interval<C, D>> Tells jvm-dtest that a class should be isolated and loaded into the instance class loader.Utility method to retrieve information about the JRE.Responsible for deciding whether to kill the JVM if it gets in an "unstable" state (think OOM).This class is usually used to avoid JVM exit when running junit tests.A stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when running on partially sorted arrays, while offering performance comparable to a traditional mergesort when run on random arrays.Helper class to avoid catching and rethrowing checked exceptions on MBean and allow turning of MBean registration for test purposes.The result of the computation of an MD5 digest.MergeIterator<In,Out> Merges sorted input iterators which individually contain unique items.MergeIterator.Reducer<In,Out> Accumulator that collects values of type A, and outputs a value of type B.A MerkleTree implemented as a binary tree.Hash value representing a row, to be used to pass hashes to the MerkleTree.The public interface to a range in the tree.Returns the leaf (range) of a given tree in increasing order.Wrapper class for handling of multiple MerkleTrees at once.Wrapper around time related functions that are either implemented by using the default JVM calls or by using a custom implementation for testing purposes.This is a very fast, non-cryptographic hash suitable for general hash-based lookup.If mx4j-tools is in the classpath call maybeLoad to load the HTTP interface of mx4j.ANativeLibraryWrapperimplementation for Darwin/Mac.ANativeLibraryWrapperimplementation for Linux.An interface to implement for using OS specific native methods.Annotate fields, particularly important volatile fields, where the system should adversarially schedule thread events around memory accesses (read or write).Logging that limits each log statement to firing based on time since the statement last fired.Levels for programmatically specifying the severity of a log statementA convenience class for wrapping access to MemoryMeter.A class for iterating sequentially through an ordered collection and efficiently finding the overlapping set of matching intervals.Overlaps.BucketMaker<E,B> Pair<T1,T2> Supplier that caches the last computed value until it is reset, forcing every caller ofRecomputingSupplier.get(long, TimeUnit)to wait until this value is computed if it was not computed yet.SearchIterator<K,V> Tells jvm-dtest that a class should be shared across allClassLoaders.Enable certain features for a specific method or class.SortedBiMultiValMap<K,V> The mode of compatibility with older Cassandra versions.Throwables.DiscreteAction<E extends Exception>TimeUUID.AbstractSerializer<T extends TimeUUID>TimeUUID.Generator.Factory<T extends TimeUUID>The goods are here: www.ietf.org/rfc/rfc4122.txt.A generic interface for encapsulating a Runnable task with related work before and after execution, using the built-in try-with-resources functionality offered byCloseable.Wrapped<T>Simple wrapper class to be used when a lambda function needs to modify a variable outside it's scope.Simple wrapper for native boolean typeWrapped runtime exception for lambda functions