public class RepUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
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 java.nio.channels.SocketChannel |
CHANNEL_EOF_MARKER |
static boolean |
DEBUG_PRINT_THREAD |
static boolean |
DEBUG_PRINT_TIME |
Constructor and Description |
---|
RepUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addConsistencyPolicyFormat(java.lang.String name,
RepUtils.ConsistencyPolicyFormat<?> format)
Define a new ConsistencyPolicyFormat.
|
static java.lang.Throwable |
chainExceptionCause(java.lang.Throwable newt,
java.lang.Throwable oldt)
Chains an old outstanding exception to the tail of a new one, so it's
not lost.
|
static java.lang.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(java.lang.String propertyValue)
Converts a property string into a policy instance.
|
static java.nio.channels.SocketChannel |
openBlockingChannel(java.net.InetSocketAddress addr,
boolean tcpNoDelay,
int timeout)
An overloading of the above when the receive buffer size is to be
defaulted.
|
static java.nio.channels.SocketChannel |
openBlockingChannel(java.net.InetSocketAddress addr,
boolean tcpNoDelay,
int receiveBufferSize,
int timeout)
Create a socket channel with the designated properties
|
static void |
shutdownChannel(NamedChannel namedChannel)
Forces a shutdown of the channel ignoring any errors that may be
encountered in the process.
|
static java.lang.String |
writeTimesString(StatGroup stats) |
public static final boolean DEBUG_PRINT_THREAD
public static final boolean DEBUG_PRINT_TIME
public static final java.nio.channels.SocketChannel CHANNEL_EOF_MARKER
public static void addConsistencyPolicyFormat(java.lang.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 java.lang.String getPropertyString(ReplicaConsistencyPolicy policy) throws java.lang.IllegalArgumentException
policy
- the policy being converted.java.lang.IllegalArgumentException
- if the specific policy does not have a
property value format, via ReplicationConfig(Properties) ctor and
setter.getReplicaConsistencyPolicy(String)
public static ReplicaConsistencyPolicy getReplicaConsistencyPolicy(java.lang.String propertyValue) throws java.lang.IllegalArgumentException
propertyValue
- the formatted string representing the policy.java.lang.IllegalArgumentException
- via ReplicationConfig(Properties) ctor
and setter.public static void shutdownChannel(NamedChannel namedChannel)
namedChannel
- the channel to be shutdownpublic static java.nio.channels.SocketChannel openBlockingChannel(java.net.InetSocketAddress addr, boolean tcpNoDelay, int receiveBufferSize, int timeout) throws java.io.IOException
addr
- the remote endpoint socket addresstcpNoDelay
- true, if the nagle algorithm is to be usedreceiveBufferSize
- the SO_RCVBUF value for the tcp window. A zero
value indicates that the os level defaults should be used.timeout
- the SO_TIMEOUT to be associated with the channeljava.io.IOException
public static java.nio.channels.SocketChannel openBlockingChannel(java.net.InetSocketAddress addr, boolean tcpNoDelay, int timeout) throws java.io.IOException
java.io.IOException
openBlockingChannel(InetSocketAddress, boolean, int, int)
public static java.lang.Throwable chainExceptionCause(java.lang.Throwable newt, java.lang.Throwable oldt)
newt
- the new throwableoldt
- the old throwablepublic static java.lang.String writeTimesString(StatGroup stats)
Copyright (c) 2004-2012 Oracle. All rights reserved.