Package org.jgroups.util
package org.jgroups.util
Provides useful functionality which cannot be assigned to any particular other package.
-
ClassDescriptionCollects acks from a number of nodes, waits for all acks.Manages ACKs from receivers in
NAKACK4AgeOutCache<K>Cache which removes its elements after a certain timeIterator over an array of elements of type T.Simple string implemented as a byte[] array.Used to execute asynchronous tasks, e.g.Maintains an approximation of an average of positive (>= 0) values in a window and adding new values at random indices.
This class is lock-less, at the expense of incorrect reads and writes (by multiple threads), but the noise of these errors should be negligible.Measures min and max in addition to averageEncodes and decodes to and from Base64 notation.ABase64.InputStreamwill read data from another java.io.InputStream, given in the constructor, and encode/decode to/from Base64 notation on the fly.ABase64.OutputStreamwill write data to another java.io.OutputStream, given in the constructor, and encode/decode to/from Base64 notation on the fly.ImplementsDataOutputin a generic manner, so that subclasses can implement specific behavior.Class (similar to (and partly copied from) java.nio.Bits) containing helper methods to encode variables (e.g.Bounded input stream.BoundedHashMap<K,V> Bounded linked hashmap; used by SEQUENCERBoundedList<T>A bounded subclass of LinkedList, oldest elements are removed once max capacity is exceeded.Buffer<T>Base class for message buffers.Helper for profiling of bundler methods.Byte array with an offset and length.
Note that the underlying byte array must not be changed as long as this instance is in use !ImplementsDataInputover a byte[] buffer.ImplementsDataOutputover a byte[] buffer.Class usingByteBufferand implementingDataInput.Class usingByteBufferand implementingDataOutput.Tools to (1) dump all protocols and the names of their attributes (ManagedAttribute) and properties (Property) to file, (2) read from that file (old) and compare whether old is a proper subset of new, ie.Utility class withCompletableFutureandCompletionStageuseful methods.MPSC queue, based on a ring buffer implementation which optionally blocks on adding or removing of elements.Concurrent queue which offers optional blocking on empty / full.A condition variable with methods for (timed) waiting and signallingMaintains credits for a unicast destination.Maintains credits for senders, when credits fall below 0, a sender blocks until new credits have been received.// TODO: Document thisDefault implementation, ignores service namesThread factory mainly responsible for naming of threads.Delayer<T>Collects actions by key and executes them - if a predicate is true - every N ms.A message digest containing - for each member - the highest seqno delivered (hd) and the highest seqno received (hr).Keeps track of one members plus its highest delivered and received seqnosExecutor which runs the command on the caller's threadRecords samples (e.g.Copy ofTable.ExpiryCache<K>Cache which maintains timestamps for keys, and methods to remove/replace expired keys.Subclass ofUUIDaccommodating additional data such as a flag and a small hashmap.FastArray<T>SimpleFixedBuffer<T>Ring buffer of fixed capacity.Class copied fromBitSet.Subclass ofUUIDaccommodating additional data such as a flag.Given a class, generates code for getters and setters for all attributes and writes it to stdoutTakes a list of methods to profile and generates the Byteman script from them.Lists all network interfaces on a systemHelper class providing functions to manipulate the headers array inBaseMessage.ExtendsInputStreamfrom aByteArrayDataInputStream.IntHashMap<T>A hashmap where keys have to be ints.LazyRemovalCache<K,V> Cache which doesn't remove elements on remove(), removeAll() or retainAll(), but only removes elements when a configurable size limit has been exceeded.List which doesn't remove elements on remove(), removeAll() or retainAll(), but only removes elements when a configurable size limit has been exceeded.Lazily names threads: whenever the address or cluster name is changed, all threads are renamedLongTuple<V>A tuple with a long (primitive) first valueMessageProcessingPolicywhich processes regular messages and message batches by assigning a max of 1 thread per message from the same sender.ID to uniquely identify a mergeRepresents a message batch; multiple messages from the same sender to the same receiver(s).A cache associating members and messagesExtracts all attributes and methods annotated withManagedAttributeand returns them as a map of names associated with [getter-method/description tuples].Address with current time as key.Generates addresses with current time as key.A dummy implementation ofTPA mutable version of Digest.MyReceiver<T>Generic receiver for a JChannelMaintains the mappings between addresses and logical names (moved out of UUID.cache into a separate class)Generates GraalVM native-image reachability metadata (reachability-metadata.json) from jg-magic-map.xml and jg-protocol-ids.xml.OverrideObjectInputStream.resolveClass(java.io.ObjectStreamClass)using the passed-in classloader.Wraps a primitive object (e.g.Wraps an object and its serialized form.Implementation ofAddressGeneratorwhich is configured with an initial value, and after that random values are generated.ExtendsOutputStreamfrom aByteArrayDataOutputStream.Represents an 'owner', which is an address and thread IDDecorates an output stream (DataOutput) and writes only a subset [start..end] (both indices inclusive) of the original data to the underlying output stream.
Example:MessageProcessingPolicywhich passes all messages and message batches up directly (on the same thread).MessageProcessingPolicywhich passes regular messages and message batches up directly (on the same thread), but passes OOB messages to the thread pool.A queue with many producers and consumers.Maintains averages for time values measured betweenProfiler.start()andProfiler.stop().Generic helper for profiling of methods.Promise<T>Allows a thread to submit an asynchronous request and to wait for the result.MembershipChangePolicy which promotes the newest member when the existing coordinator leaves.Iterates over all concrete Protocol classes and creates tables with Protocol's properties.Ref<T>Keeps a reference to another objectAX509ExtendedKeyManagerwhich uses a @FileWatcherto check for changes.AX509ExtendedTrustManagerwhich uses a @FileWatcherto check for changes.RequestTable<T>Table for storing requests associated with monotonically increasing sequence numbers (seqnos).Manages resources such as multicast addresses and multicast ports, and TCP ports.Similar to AckCollector, but collects responses from cluster members, not just acks.Manages responses for the discovery protocol.Keeps track of stats for sync and async unicasts and multicastsRsp<T>Class that represents a response from a communicationRspList<T>Contains responses from all members.Measures round-trip times (RTT) between nodesRuns a given function in a loop (in a separate thread) until it is stoppedA bitset of missing messages with a fixed size.ShutdownRejectedExecutionHandler is a decorator RejectedExecutionHandler used in all JGroups ThreadPoolExecutor(s).Wraps another input stream and counts the bytes it reads from it.ExtendsOutputStreambut only counts bytes written, doesn't actually write anything.Interface implementing Streamable and returning the size of the marshalled object.Factory to create various types of sockets and NIO selector provider and channels.SslContextFactory.Encapsulates the result of a state transfer.Implementations of Streamable can add their state directly to the output stream, enabling them to bypass costly serializationDefault message processing policy.Cache which keeps a timestamp and counter for every key.SuppressLog<T>Log (usingSuppressCache) which suppresses (certain) messages from the same member for a given timeTable<T>A store for elements (typically messages) to be retransmitted or delivered.Common functions for all testsHelper class to create regular or virtual threads.Thread pool based onThreadPoolExecutorTimer-like interface which allows for execution of tasks.The interface that dynamic tasks (TimeScheduler.scheduleWithDynamicInterval(org.jgroups.util.TimeScheduler.Task)) must implementImplementation ofTimeScheduler.Provides a coarse grained time service.Lists the types of client authTriple<V1,V2, V3> Holds 3 values, useful when we have a map with a key, but more than 1 value and we don't want to create a separate holder object for the values, and don't want to pass the values as a list or array.Tuple<V1,V2> Holds 2 values, useful when we have a map with a key, but more than 1 value and we don't want to create a separate holder object for the values, and don't want to pass the values as a list or array.Same asMaxOneThreadPerSender, but for OOB message batches, every message of the batch is passed to the thread pool separately (https://issues.redhat.com/browse/JGRP-2800).Collection of various utility routines that can not be assigned to other classes.Logical address which is unique over space and time.Extracts version and codename from pom.xml and writes them to ./classes/JGROUPS_VERSION.propertiesIterates over all concrete Protocol classes and creates XML schema used for validation of configuration files.