public class RepUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RepUtils.Clock |
static interface |
RepUtils.ConsistencyPolicyFormat<T extends ReplicaConsistencyPolicy>
ReplicaConsistencyPolicy must be stored as a String for use with
ReplicationConfig and je.properties.
|
static class |
RepUtils.ExceptionAwareBlockingQueue<T>
Like
LinkedBlockingQueue, but provides a pollOrException() method that should be used instead of poll(),
so that callers don't have to treat exception cases specially. |
static class |
RepUtils.ExceptionAwareCountDownLatch
Like CountDownLatch, but makes provision in the await for the await, or
more specifically the new awaitOrException method to be exited via an
exception.
|
| Modifier and Type | Field and Description |
|---|---|
static DataChannel |
CHANNEL_EOF_MARKER |
static boolean |
DEBUG_PRINT_THREAD |
static boolean |
DEBUG_PRINT_TIME |
static TestHook<DataChannelFactory.ConnectOptions> |
openSocketChannelHook
If not null, called by openSocketChannel with the connect options before
opening the socket -- for unit testing.
|
| Constructor and Description |
|---|
RepUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addConsistencyPolicyFormat(String name,
RepUtils.ConsistencyPolicyFormat<?> format)
Define a new ConsistencyPolicyFormat.
|
static Throwable |
chainExceptionCause(Throwable newt,
Throwable oldt)
Chains an old outstanding exception to the tail of a new one, so it's
not lost.
|
static String |
exec(String... args)
A simple debugging utility used to obtain information about the
execution environment that's only available through some system utility,
like netstat, or jps, etc.
|
static String |
getPropertyString(ReplicaConsistencyPolicy policy)
Converts a policy into a string suitable for use as a property value
in a je.properties file or elsewhere.
|
static ReplicaConsistencyPolicy |
getReplicaConsistencyPolicy(String propertyValue)
Converts a property string into a policy instance.
|
static DataChannel |
openBlockingChannel(InetSocketAddress addr,
DataChannelFactory factory,
DataChannelFactory.ConnectOptions connectOpts)
Create a Data channel with the designated properties
|
static SocketChannel |
openSocketChannel(InetSocketAddress addr,
InetSocketAddress localAddr,
DataChannelFactory.ConnectOptions connectOpts)
Create a socket channel with the designated properties.
|
static Properties |
populateNetProps(Properties props,
File accessPropsFile)
Read replication access properties from a property file.
|
static void |
shutdownChannel(DataChannel channel) |
static void |
shutdownChannel(NamedChannel namedChannel)
Forces a shutdown of a blocking channel ignoring any errors that may be
encountered in the process.
|
static String |
writeTimesString(StatGroup stats) |
public static final boolean DEBUG_PRINT_THREAD
public static final boolean DEBUG_PRINT_TIME
public static final DataChannel CHANNEL_EOF_MARKER
public static volatile TestHook<DataChannelFactory.ConnectOptions> openSocketChannelHook
public static void addConsistencyPolicyFormat(String name, RepUtils.ConsistencyPolicyFormat<?> format)
name - must be the first part of the policy string with a
non-letter delimiter following it, or must be the entire policy string.format - to register.public static String getPropertyString(ReplicaConsistencyPolicy policy) throws IllegalArgumentException
policy - the policy being converted.IllegalArgumentException - if the specific policy does not have a
property value format, via ReplicationConfig(Properties) ctor and
setter.getReplicaConsistencyPolicy(String)public static ReplicaConsistencyPolicy getReplicaConsistencyPolicy(String propertyValue) throws IllegalArgumentException
propertyValue - the formatted string representing the policy.IllegalArgumentException - via ReplicationConfig(Properties) ctor
and setter.public static void shutdownChannel(NamedChannel namedChannel)
namedChannel - the channel to be shutdownpublic static void shutdownChannel(DataChannel channel)
public static SocketChannel openSocketChannel(InetSocketAddress addr, InetSocketAddress localAddr, DataChannelFactory.ConnectOptions connectOpts) throws IOException
addr - the remote endpoint socket addresslocalAddr - the local address the socket is bound to it may be nullconnectOpts - connect options to be applied to the channelIOExceptionpublic static DataChannel openBlockingChannel(InetSocketAddress addr, DataChannelFactory factory, DataChannelFactory.ConnectOptions connectOpts) throws IOException
addr - the remote endpoint socket addressfactory - DataChannel factory for channel creationconnectOpts - connect options to be applied to the channelIOExceptionpublic static Throwable chainExceptionCause(Throwable newt, Throwable oldt)
newt - the new throwableoldt - the old throwablepublic static Properties populateNetProps(Properties props, File accessPropsFile)
props - a Properties object into which the properties will be storedaccessPropsFile - an abstract File naming a file containing property
settings.IllegalArgumentException - if the accessPropsFile contains
invalid settings.public static String exec(String... args)
args - the arguments to a ProcessBuilder with args[0] being the
command and args[1-...] being its argsCopyright © 2024. All rights reserved.