public class Util
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Util.AddressScope |
Modifier and Type | Field and Description |
---|---|
protected static int |
CCHM_CONCURRENCY_LEVEL |
protected static int |
CCHM_INITIAL_CAPACITY |
protected static float |
CCHM_LOAD_FACTOR |
static int |
DEFAULT_HEADERS |
static int |
MAX_LIST_PRINT_SIZE
The max size of an address list, e.g.
|
static int |
MAX_PORT |
protected static java.util.ResourceBundle |
resource_bundle |
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
protected static void |
_printThreads(java.lang.management.ThreadMXBean bean,
long[] ids,
java.lang.StringBuilder sb) |
static boolean |
all(java.util.Collection c,
java.lang.Object obj)
Returns true if all elements of c match obj
|
static boolean |
allChannelsHaveSameView(JChannel... channels) |
static <T> boolean |
allEqual(java.util.Collection<T> elements)
Returns true if all elements in the collection are the same
|
static void |
assertAllChannelsHaveSameView(JChannel... channels) |
static void |
assertEquals(java.lang.Object val1,
java.lang.Object val2) |
static void |
assertEquals(java.lang.String message,
java.lang.Object val1,
java.lang.Object val2) |
static void |
assertFalse(boolean condition) |
static void |
assertFalse(java.lang.String message,
boolean condition) |
static void |
assertNotNull(java.lang.Object val) |
static void |
assertNotNull(java.lang.String message,
java.lang.Object val) |
static void |
assertNull(java.lang.String message,
java.lang.Object val) |
static void |
assertTrue(boolean condition) |
static void |
assertTrue(java.lang.String message,
boolean condition) |
static java.lang.String |
attributeNameToMethodName(java.lang.String attr_name) |
static void |
bind(java.nio.channels.ServerSocketChannel ch,
java.net.InetAddress bind_addr,
int start_port,
int end_port) |
static void |
bind(java.nio.channels.ServerSocketChannel ch,
java.net.InetAddress bind_addr,
int start_port,
int end_port,
int backlog) |
static void |
bind(java.net.ServerSocket srv_sock,
java.net.InetAddress bind_addr,
int start_port,
int end_port) |
static void |
bind(java.net.ServerSocket srv_sock,
java.net.InetAddress bind_addr,
int start_port,
int end_port,
int backlog) |
static java.lang.String |
bold(java.lang.String msg) |
static void |
bufferToArray(Address sender,
java.nio.ByteBuffer buf,
Receiver target) |
static java.lang.String |
byteArrayToHexString(byte[] b) |
static java.lang.String |
byteArrayToHexString(byte[] b,
int offset,
int length) |
static Message |
byteBufferToMessage(byte[] buffer,
int offset,
int length) |
static java.lang.String |
bytesToString(byte[] bytes) |
static boolean |
checkForAndroid() |
static boolean |
checkForHp() |
static boolean |
checkForLinux() |
static boolean |
checkForMac() |
static boolean |
checkForSolaris() |
static boolean |
checkForWindows() |
static void |
checkIfValidAddress(java.net.InetAddress bind_addr,
java.lang.String prot_name) |
static byte |
clearFlags(byte bits,
byte flag) |
static void |
close(java.io.Closeable... closeables) |
static void |
close(java.io.Closeable closeable) |
static byte[] |
collectionToByteBuffer(java.util.Collection<Address> c) |
static int |
compare(byte[] left,
byte[] right)
Compares 2 byte arrays, elements are treated as unigned
|
static java.lang.String[] |
components(java.lang.String path,
java.lang.String separator) |
static java.util.List<Range> |
computeFragOffsets(byte[] buf,
int frag_size) |
static java.util.List<Range> |
computeFragOffsets(int offset,
int length,
int frag_size)
Given a buffer and a fragmentation size, compute a list of fragmentation offset/length pairs, and
return them in a list.
|
static boolean |
connect(java.nio.channels.SocketChannel ch,
java.net.SocketAddress dest) |
static void |
connect(java.net.Socket sock,
java.net.SocketAddress dest,
int sock_conn_timeout)
Utility method.
|
static <T> boolean |
contains(T key,
T[] list) |
static boolean |
containsId(short id,
short[] ids) |
static boolean |
containsViewId(java.util.Collection<View> views,
ViewId vid) |
static byte[] |
createAuthenticationDigest(java.lang.String passcode,
long t1,
double q1) |
static JChannel |
createChannel(Protocol... prots) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentMap(int initial_capacity) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentMap(int initial_capacity,
float load_factor,
int concurrency_level) |
static java.net.DatagramSocket |
createDatagramSocket(SocketFactory factory,
java.lang.String service_name,
java.net.InetAddress addr,
int port)
Creates a DatagramSocket bound to addr.
|
static byte[] |
createDigest(java.lang.String passcode,
long t1,
double q1) |
static java.net.MulticastSocket |
createMulticastSocket(SocketFactory factory,
java.lang.String service_name,
java.net.InetAddress mcast_addr,
int port,
Log log) |
static Address |
createRandomAddress() |
static Address |
createRandomAddress(java.lang.String name) |
static Address[] |
createRandomAddresses(int num)
Returns an array of num random addresses, named A, B, C etc
|
static Address[] |
createRandomAddresses(int num,
boolean use_numbers) |
static java.net.ServerSocket |
createServerSocket(SocketFactory factory,
java.lang.String service_name,
java.net.InetAddress bind_addr,
int start_port) |
static java.net.ServerSocket |
createServerSocket(SocketFactory factory,
java.lang.String service_name,
java.net.InetAddress bind_addr,
int start_port,
int end_port) |
static java.net.ServerSocket |
createServerSocketAndBind(SocketFactory factory,
java.lang.String service_name,
java.net.InetAddress bind_addr,
int start_port,
int end_port)
Finds first available port starting at start_port and returns server
socket.
|
static java.nio.channels.ServerSocketChannel |
createServerSocketChannel(java.net.InetAddress bind_addr,
int start_port,
int end_port) |
static java.nio.channels.ServerSocketChannel |
createServerSocketChannelAndBind(java.net.InetAddress bind_addr,
int start_port,
int end_port) |
static java.lang.Object[][] |
createTimer() |
static byte[] |
defragmentBuffer(byte[][] fragments)
Concatenates smaller fragments into entire buffers.
|
static java.util.List<View> |
detectDifferentViews(java.util.Map<Address,View> map) |
static java.util.Collection<Address> |
determineActualMergeCoords(java.util.Map<Address,View> map)
Similar to
determineMergeCoords(java.util.Map) but only actual coordinators are counted: an actual
coord is when the sender of a view is the first member of that view |
static java.util.List<Address> |
determineLeftMembers(java.util.List<Address> old_mbrs,
java.util.List<Address> new_mbrs)
Returns all members that left between 2 views.
|
static java.util.Collection<Address> |
determineMergeCoords(java.util.Map<Address,View> map)
This is the same or a subset of
determineMergeParticipants(java.util.Map) and contains only members
which are currently sub-partition coordinators. |
static java.util.Collection<Address> |
determineMergeParticipants(java.util.Map<Address,View> map)
Determines the members which take part in a merge.
|
static <T> boolean |
different(T one,
T two) |
static int |
discardUntilNewLine(java.io.InputStream in)
Reads and discards all characters from the input stream until a \r\n or EOF is encountered
|
static java.lang.String |
dumpQueue(Queue q)
Debugging method used to dump the content of a protocol queue in a
condensed form.
|
static java.lang.String |
dumpThreads() |
static java.util.List<java.lang.Class<?>> |
findClassesAnnotatedWith(java.lang.String packageName,
java.lang.Class<? extends java.lang.annotation.Annotation> a) |
static <T> java.util.Set<java.lang.Class<T>> |
findClassesAssignableFrom(java.lang.String packageName,
java.lang.Class<T> assignableFrom) |
static java.lang.reflect.Field |
findField(java.lang.Object target,
java.util.List<java.lang.String> possible_names) |
static java.lang.reflect.Method |
findMethod(java.lang.Class<?> root_class,
java.util.List<java.lang.String> possible_names,
java.lang.Class<?>... parameter_types) |
static java.lang.reflect.Method |
findMethod(java.lang.Object target,
java.util.List<java.lang.String> possible_names,
java.lang.Class<?>... parameter_types) |
static java.lang.String |
format(double value) |
static byte[][] |
fragmentBuffer(byte[] buf,
int frag_size,
int length)
Fragments a byte buffer into smaller fragments of (max.) frag_size.
|
static byte[] |
generateArray(int size) |
static java.lang.String |
generateLocalName() |
static java.net.InetAddress |
getAddress(java.net.NetworkInterface intf,
Util.AddressScope scope)
Returns the first address on the given interface on the current host, which satisfies scope
|
static java.net.InetAddress |
getAddress(Util.AddressScope scope)
Returns the first address on any interface of the current host, which satisfies scope
|
static java.net.InetAddress |
getAddressByPatternMatch(java.lang.String pattern)
Returns a valid interface address based on a pattern.
|
static java.util.Collection<java.net.InetAddress> |
getAllAvailableAddresses() |
static java.util.List<java.net.NetworkInterface> |
getAllAvailableInterfaces() |
static java.lang.reflect.Field[] |
getAllDeclaredFields(java.lang.Class clazz) |
static java.lang.reflect.Field[] |
getAllDeclaredFieldsWithAnnotations(java.lang.Class clazz,
java.lang.Class<? extends java.lang.annotation.Annotation>... annotations) |
static java.lang.reflect.Method[] |
getAllDeclaredMethodsWithAnnotations(java.lang.Class clazz,
java.lang.Class<? extends java.lang.annotation.Annotation>... annotations) |
static <A extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<?> clazz,
java.lang.Class<A> annotationClass) |
static java.net.NetworkInterface |
getByName(java.lang.String name)
Finds a network interface of sub-interface with the given name
|
static Address |
getCoordinator(View view) |
static java.lang.reflect.Field |
getField(java.lang.Class clazz,
java.lang.String field_name) |
static java.lang.Object |
getField(java.lang.reflect.Field field,
java.lang.Object target) |
static StackType |
getIpStackType() |
static java.net.InetAddress |
getLocalhost() |
static java.net.InetAddress |
getLocalhost(StackType ip_version)
IP related utilities
|
static javax.management.MBeanServer |
getMBeanServer() |
static java.lang.String |
getMessage(java.lang.String key) |
static int |
getNextHigherPowerOfTwo(int num) |
static java.net.InetAddress |
getNonLoopbackAddress()
Returns the first non-loopback address on any interface on the current host.
|
static java.lang.String |
getProperty(java.lang.String s) |
static java.lang.String |
getProperty(java.lang.String[] system_props,
java.util.Properties props,
java.lang.String prop_name,
java.lang.String default_value)
Returns a value associated wither with one or more system properties, or found in the props map
|
static int |
getRank(java.util.Collection<Address> members,
Address addr) |
static int |
getRank(View view,
Address addr)
Returns the rank of a member in a given view
|
static java.io.InputStream |
getResourceAsStream(java.lang.String name,
java.lang.Class clazz) |
static short |
getScope(Message msg) |
static Protocol[] |
getTestStack(Protocol... additional_protocols)
Returns a default stack for testing with transport = SHARED_LOOPBACK
|
static java.lang.Class<?>[] |
getUnicastProtocols() |
static boolean |
interfaceHasIPAddresses(java.net.NetworkInterface intf,
StackType ip_version)
A function to check if an interface supports an IP version (i.e has addresses
defined for that IP version).
|
static boolean |
interruptAndWaitToDie(java.lang.Thread t) |
static boolean |
interruptAndWaitToDie(java.lang.Thread t,
long timeout) |
static boolean |
isAsciiString(java.lang.String str) |
static boolean |
isCoordinator(JChannel ch) |
static boolean |
isCoordinator(View view,
Address local_addr) |
static boolean |
isFlagSet(byte bits,
byte flag) |
static boolean |
isStackAvailable(boolean ipv4) |
static int |
keyPress(java.lang.String msg) |
static java.util.List<Address> |
leftMembers(java.util.Collection<Address> old_list,
java.util.Collection<Address> new_list) |
static java.lang.Class |
loadClass(java.lang.String classname,
java.lang.Class clazz)
Tries to load the class from the current thread's context class loader.
|
static java.lang.Class<?> |
loadClass(java.lang.String classname,
java.lang.ClassLoader preferredLoader)
Tries to load the class from the preferred loader.
|
static java.lang.String |
mapToString(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map) |
protected static byte[] |
marshalPrimitiveType(byte type,
java.lang.Object obj) |
static boolean |
match(long[] a1,
long[] a2) |
static <T> boolean |
match(T obj1,
T obj2) |
static java.lang.String |
md5(java.lang.String source)
Converts a java.lang.String in to a MD5 hashed String
|
static Buffer |
messageToByteBuffer(Message msg) |
static java.lang.String |
methodNameToAttributeName(java.lang.String methodName)
Converts a method name to an attribute name, e.g.
|
static java.lang.String |
methodNameToJavaAttributeName(java.lang.String methodName)
Converts a method name to a Java attribute name, e.g.
|
static long |
micros() |
static <T> java.util.List<T> |
newElements(java.util.List<T> old_list,
java.util.List<T> new_list) |
static java.util.List<Address> |
newMembers(java.util.List<Address> old_list,
java.util.List<Address> new_list) |
static java.lang.Object |
objectFromByteBuffer(byte[] buffer)
Creates an object from a byte buffer
|
static java.lang.Object |
objectFromByteBuffer(byte[] buffer,
int offset,
int length) |
static java.lang.Object |
objectFromByteBuffer(byte[] buffer,
int offset,
int length,
java.lang.ClassLoader loader) |
static java.lang.Object |
objectFromStream(java.io.DataInput in) |
static java.lang.Object |
objectFromStream(java.io.DataInput in,
java.lang.ClassLoader loader) |
static Buffer |
objectToBuffer(java.lang.Object obj) |
static byte[] |
objectToByteBuffer(java.lang.Object obj)
Serializes/Streams an object into a byte buffer.
|
static void |
objectToStream(java.lang.Object obj,
java.io.DataOutput out) |
static java.util.List<PhysicalAddress> |
parseCommaDelimitedHosts(java.lang.String hosts,
int port_range)
Input is "daddy[8880],sindhu[8880],camille[5555].
|
static java.util.List<java.net.InetSocketAddress> |
parseCommaDelimitedHosts2(java.lang.String hosts,
int port_range)
Input is "daddy[8880],sindhu[8880],camille[5555].
|
static int[] |
parseCommaDelimitedInts(java.lang.String s)
Parses comma-delimited longs; e.g., 2000,4000,8000.
|
static long[] |
parseCommaDelimitedLongs(java.lang.String s)
Parses comma-delimited longs; e.g., 2000,4000,8000.
|
static java.util.Map<java.lang.String,java.lang.String> |
parseCommaDelimitedProps(java.lang.String s) |
static java.util.List<java.lang.String> |
parseCommaDelimitedStrings(java.lang.String l)
e.g.
|
static java.util.List<java.net.NetworkInterface> |
parseInterfaceList(java.lang.String s) |
static java.util.concurrent.RejectedExecutionHandler |
parseRejectionPolicy(java.lang.String rejection_policy) |
static java.util.List<java.lang.String> |
parseStringList(java.lang.String l,
java.lang.String separator) |
static boolean |
patternMatch(java.lang.String pattern,
java.lang.String str) |
static <T> T |
pickNext(java.util.List<T> list,
T obj)
Returns the object next to element in list
|
static <T> java.util.List<T> |
pickNext(java.util.List<T> list,
T obj,
int num)
Returns the next min(N,list.size()) elements after obj
|
static <T> T |
pickRandomElement(java.util.List<T> list) |
static <T> T |
pickRandomElement(T[] array) |
static java.util.List<Address> |
pickSubset(java.util.List<Address> members,
double subset_percentage)
Selects a random subset of members according to subset_percentage and returns them.
|
static java.lang.String |
print(java.nio.ByteBuffer buf) |
static <T> java.lang.String |
print(java.util.Collection<T> objs) |
static java.lang.String |
print(java.util.List<java.net.NetworkInterface> interfaces) |
static <T> java.lang.String |
print(java.util.Map<T,T> map) |
static java.lang.String |
printBytes(double bytes) |
static java.lang.String |
printBytes(long bytes)
MByte nowadays doesn't mean 1024 * 1024 bytes, but 1 million bytes, see http://en.wikipedia.org/wiki/Megabyte
|
static <T> java.lang.String |
printListWithDelimiter(java.util.Collection<T> list,
java.lang.String delimiter) |
static <T> java.lang.String |
printListWithDelimiter(java.util.Collection<T> list,
java.lang.String delimiter,
int limit) |
static <T> java.lang.String |
printListWithDelimiter(java.util.Collection<T> list,
java.lang.String delimiter,
int limit,
boolean print_size) |
static <T> java.lang.String |
printListWithDelimiter(T[] list,
java.lang.String delimiter,
int limit) |
static <T> java.lang.String |
printMapWithDelimiter(java.util.Map<T,T> map,
java.lang.String delimiter) |
static java.lang.String |
printNanos(double time_ns) |
static java.lang.String |
printPingData(java.util.List<PingData> rsps) |
static java.lang.String |
printTime(long time,
java.util.concurrent.TimeUnit unit) |
static java.lang.String |
printViews(java.util.Collection<View> views) |
static java.lang.String |
printViews(JChannel... channels) |
static boolean |
productGreaterThan(long n1,
long n2,
long val) |
static long |
random(long range)
Returns a random value in the range [1 - range]
|
static <T extends Streamable> |
read(java.lang.Class<T> clazz,
java.io.DataInput in) |
static Address |
readAddress(java.io.DataInput in) |
static Address[] |
readAddresses(java.io.DataInput in) |
static java.util.Collection<? extends Address> |
readAddresses(java.io.DataInput in,
java.lang.Class cl) |
static byte[] |
readByteBuffer(java.io.DataInput in) |
static double |
readBytesDouble(java.lang.String input) |
static int |
readBytesInteger(java.lang.String input) |
static long |
readBytesLong(java.lang.String input) |
static java.lang.Class<?> |
readClass(java.io.DataInput in) |
static java.lang.String |
readContents(java.io.InputStream input) |
static double |
readDoubleFromStdin(java.lang.String message) |
static java.lang.String |
readFile(java.lang.String filename) |
static byte[] |
readFileContents(java.io.InputStream input) |
static Streamable |
readGenericStreamable(java.io.DataInput in) |
static Streamable |
readGenericStreamable(java.io.DataInput in,
java.lang.ClassLoader loader) |
static int |
readIntFromStdin(java.lang.String message) |
static java.lang.String |
readLine(java.io.InputStream in)
Reads a line of text.
|
static long |
readLongFromStdin(java.lang.String message) |
static Message |
readMessage(java.io.DataInput instream) |
static MessageBatch[] |
readMessageBatch(java.io.DataInput in,
boolean multicast)
Reads a list of messages into 4 MessageBatches:
regular
OOB
INTERNAL-OOB (INTERNAL and OOB)
INTERNAL (INTERNAL)
|
static java.util.List<Message> |
readMessageList(java.io.DataInput in,
short transport_id) |
static java.lang.Object |
readObject(java.io.DataInput in) |
static Streamable |
readStreamable(java.lang.Class clazz,
java.io.DataInput in) |
static java.lang.String |
readStringFromStdin(java.lang.String message) |
static java.lang.String |
readToken(java.io.InputStream in)
Returns whitespace-separated strings from the input stream, or null if the end of the stream has been reached
|
static View |
readView(java.io.DataInput in) |
static ViewId |
readViewId(java.io.DataInput in) |
static void |
registerChannel(JChannel channel,
java.lang.String name) |
static java.lang.String |
replaceProperties(java.lang.String string,
java.util.Properties props)
Go through the input string and replace any occurance of ${p} with the
props.getProperty(p) value.
|
static boolean |
sameAddresses(java.net.InetAddress one,
java.net.InetAddress two)
Returns true if the 2 addresses are of the same type (IPv4 or IPv6)
|
static boolean |
sameHost(Address one,
Address two)
Checks whether 2 Addresses are on the same host
|
static void |
setField(java.lang.reflect.Field field,
java.lang.Object target,
java.lang.Object value) |
static byte |
setFlag(byte bits,
byte flag) |
static void |
setScope(Message msg,
short scope) |
static java.lang.String |
sha(java.lang.String source)
Converts a java.lang.String in to a SHA hashed String
|
static java.lang.String |
shortName(java.net.InetAddress hostname) |
static java.lang.String |
shortName(java.lang.String hostname) |
static void |
shutdown(Channel ch)
Drops messages to/from other members and then closes the channel.
|
static int |
size(Address addr) |
static long |
size(Address[] addrs) |
static int |
size(byte[] buf) |
static long |
size(java.util.Collection<? extends Address> addrs)
Returns the marshalled size of a Collection of Addresses.
|
static int |
size(java.lang.String s) |
static int |
size(View view) |
static int |
size(ViewId vid) |
static void |
sleep(long timeout)
Sleep for timeout msecs.
|
static void |
sleep(long timeout,
int nanos) |
static void |
sleepRandom(long floor,
long ceiling)
Sleeps between floor and ceiling milliseconds, chosen randomly
|
static boolean |
startFlush(Channel c)
Performs the flush of the given channel
|
static boolean |
startFlush(Channel c,
int numberOfAttempts,
long randomSleepTimeoutFloor,
long randomSleepTimeoutCeiling)
Performs the flush of the given channel within the specfied number of attempts along with random
sleep time after each such attempt.
|
static boolean |
startFlush(Channel c,
java.util.List<Address> flushParticipants)
Performs the flush of the given channel and the specified flush participants
|
static boolean |
startFlush(Channel c,
java.util.List<Address> flushParticipants,
int numberOfAttempts,
long randomSleepTimeoutFloor,
long randomSleepTimeoutCeiling)
Performs the flush of the given channel for the specified flush participants and the given
number of attempts along with random sleep time after each such attempt.
|
static <T extends Streamable> |
streamableFromBuffer(java.lang.Class<T> clazz,
byte[] buffer,
int offset,
int length) |
static Streamable |
streamableFromByteBuffer(java.lang.Class<? extends Streamable> cl,
byte[] buffer) |
static <T extends Streamable> |
streamableFromByteBuffer(java.lang.Class<? extends Streamable> cl,
byte[] buffer,
int offset,
int length) |
static Buffer |
streamableToBuffer(Streamable obj) |
static byte[] |
streamableToByteBuffer(Streamable obj) |
static byte[] |
stringToBytes(java.lang.String str) |
static java.lang.String |
substituteVariable(java.lang.String val)
Replaces variables of ${var:default} with System.getProperty(var, default).
|
static boolean |
tossWeightedCoin(double probability)
Tosses a coin weighted with probability and returns true or false.
|
static java.net.InetAddress |
validateBindAddressFromInterface(java.net.InetAddress bind_addr,
java.lang.String bind_interface_str)
Method used by PropertyConverters.BindInterface to check that a bind_address is
consistent with a specified interface
Idea:
1.
|
static void |
waitUntilAllChannelsHaveSameView(long timeout,
long interval,
Channel... channels)
Blocks until all channels have the same view
|
static <T> void |
waitUntilListHasSize(java.util.List<T> list,
int expected_size,
long timeout,
long interval)
Waits until a list has the expected number of elements.
|
static <T extends Streamable> |
write(T[] array,
java.io.DataOutput out) |
static void |
writeAddress(Address addr,
java.io.DataOutput out) |
static void |
writeAddresses(Address[] addrs,
java.io.DataOutput out) |
static void |
writeAddresses(java.util.Collection<? extends Address> v,
java.io.DataOutput out)
Writes a list of Addresses.
|
static void |
writeByteBuffer(byte[] buf,
java.io.DataOutput out) |
static void |
writeByteBuffer(byte[] buf,
int offset,
int length,
java.io.DataOutput out) |
static void |
writeClass(java.lang.Class<?> classObject,
java.io.DataOutput out) |
static void |
writeGenericStreamable(Streamable obj,
java.io.DataOutput out) |
static void |
writeMessage(Message msg,
java.io.DataOutput dos,
boolean multicast)
This method needs to be synchronized on out_stream when it is called
|
static void |
writeMessageList(Address dest,
Address src,
byte[] cluster_name,
java.util.List<Message> msgs,
java.io.DataOutput dos,
boolean multicast,
short transport_id)
Write a list of messages with the *same* destination and src addresses.
|
static void |
writeMessageListHeader(Address dest,
Address src,
byte[] cluster_name,
int numMsgs,
java.io.DataOutput dos,
boolean multicast) |
static void |
writeObject(java.lang.Object obj,
java.io.DataOutput out) |
static void |
writeStreamable(Streamable obj,
java.io.DataOutput out) |
static void |
writeView(View view,
java.io.DataOutput out) |
static void |
writeViewId(ViewId vid,
java.io.DataOutput out) |
public static final int MAX_PORT
protected static int CCHM_INITIAL_CAPACITY
protected static float CCHM_LOAD_FACTOR
protected static int CCHM_CONCURRENCY_LEVEL
public static final int DEFAULT_HEADERS
public static int MAX_LIST_PRINT_SIZE
protected static java.util.ResourceBundle resource_bundle
public static final java.lang.Class<?>[] getUnicastProtocols()
public static void assertTrue(boolean condition)
public static void assertTrue(java.lang.String message, boolean condition)
public static void assertFalse(boolean condition)
public static void assertFalse(java.lang.String message, boolean condition)
public static void assertEquals(java.lang.String message, java.lang.Object val1, java.lang.Object val2)
public static void assertEquals(java.lang.Object val1, java.lang.Object val2)
public static void assertNotNull(java.lang.String message, java.lang.Object val)
public static void assertNotNull(java.lang.Object val)
public static void assertNull(java.lang.String message, java.lang.Object val)
public static int getNextHigherPowerOfTwo(int num)
public static java.lang.String bold(java.lang.String msg)
public static java.lang.String getMessage(java.lang.String key)
public static Protocol[] getTestStack(Protocol... additional_protocols)
additional_protocols
- Any number of protocols to add to the top of the returned protocol listpublic static void waitUntilAllChannelsHaveSameView(long timeout, long interval, Channel... channels) throws TimeoutException
timeout
- How long to wait (max in ms)interval
- Check every interval mschannels
- The channels which should form the view. The expected view size is channels.length.
Must be non-nullTimeoutException
public static boolean allChannelsHaveSameView(JChannel... channels)
public static void assertAllChannelsHaveSameView(JChannel... channels)
public static java.lang.String printViews(JChannel... channels)
public static <T> void waitUntilListHasSize(java.util.List<T> list, int expected_size, long timeout, long interval)
T
- The type of the listlist
- The listexpected_size
- The expected sizetimeout
- The time to wait (in ms)interval
- The interval at which to get the size of the list (in ms)public static void setScope(Message msg, short scope)
public static short getScope(Message msg)
public static byte[] createAuthenticationDigest(java.lang.String passcode, long t1, double q1) throws java.io.IOException, java.security.NoSuchAlgorithmException
java.io.IOException
java.security.NoSuchAlgorithmException
public static byte[] createDigest(java.lang.String passcode, long t1, double q1) throws java.io.IOException, java.security.NoSuchAlgorithmException
java.io.IOException
java.security.NoSuchAlgorithmException
public static void connect(java.net.Socket sock, java.net.SocketAddress dest, int sock_conn_timeout) throws java.io.IOException
sock
- dest
- sock_conn_timeout
- java.io.IOException
public static boolean connect(java.nio.channels.SocketChannel ch, java.net.SocketAddress dest) throws java.io.IOException
java.io.IOException
public static void close(java.io.Closeable closeable)
public static void close(java.io.Closeable... closeables)
public static void shutdown(Channel ch) throws java.lang.Exception
java.lang.Exception
public static byte setFlag(byte bits, byte flag)
public static boolean isFlagSet(byte bits, byte flag)
public static byte clearFlags(byte bits, byte flag)
public static java.lang.Object objectFromByteBuffer(byte[] buffer) throws java.lang.Exception
java.lang.Exception
public static java.lang.Object objectFromByteBuffer(byte[] buffer, int offset, int length) throws java.lang.Exception
java.lang.Exception
public static java.lang.Object objectFromByteBuffer(byte[] buffer, int offset, int length, java.lang.ClassLoader loader) throws java.lang.Exception
java.lang.Exception
public static byte[] objectToByteBuffer(java.lang.Object obj) throws java.lang.Exception
java.lang.Exception
public static Buffer objectToBuffer(java.lang.Object obj) throws java.lang.Exception
java.lang.Exception
protected static byte[] marshalPrimitiveType(byte type, java.lang.Object obj)
public static void objectToStream(java.lang.Object obj, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static java.lang.Object objectFromStream(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static java.lang.Object objectFromStream(java.io.DataInput in, java.lang.ClassLoader loader) throws java.lang.Exception
java.lang.Exception
public static Streamable streamableFromByteBuffer(java.lang.Class<? extends Streamable> cl, byte[] buffer) throws java.lang.Exception
java.lang.Exception
public static void bufferToArray(Address sender, java.nio.ByteBuffer buf, Receiver target)
public static <T extends Streamable> Streamable streamableFromByteBuffer(java.lang.Class<? extends Streamable> cl, byte[] buffer, int offset, int length) throws java.lang.Exception
java.lang.Exception
public static <T extends Streamable> T streamableFromBuffer(java.lang.Class<T> clazz, byte[] buffer, int offset, int length) throws java.lang.Exception
java.lang.Exception
public static byte[] streamableToByteBuffer(Streamable obj) throws java.lang.Exception
java.lang.Exception
public static Buffer streamableToBuffer(Streamable obj)
public static byte[] collectionToByteBuffer(java.util.Collection<Address> c) throws java.lang.Exception
java.lang.Exception
public static byte[] stringToBytes(java.lang.String str)
public static java.lang.String bytesToString(byte[] bytes)
public static java.lang.String byteArrayToHexString(byte[] b)
public static java.lang.String byteArrayToHexString(byte[] b, int offset, int length)
public static boolean isAsciiString(java.lang.String str)
public static int compare(byte[] left, byte[] right)
public static void writeMessage(Message msg, java.io.DataOutput dos, boolean multicast) throws java.lang.Exception
msg
- java.io.IOException
java.lang.Exception
public static Message readMessage(java.io.DataInput instream) throws java.lang.Exception
java.lang.Exception
public static void writeMessageList(Address dest, Address src, byte[] cluster_name, java.util.List<Message> msgs, java.io.DataOutput dos, boolean multicast, short transport_id) throws java.lang.Exception
List: * | version | flags | dest | src | cluster-name | [Message*] | Message: | presence | leading | flags | [src] | length | [buffer] | size | [Headers*] |
dest
- src
- msgs
- dos
- multicast
- java.lang.Exception
public static void writeMessageListHeader(Address dest, Address src, byte[] cluster_name, int numMsgs, java.io.DataOutput dos, boolean multicast) throws java.lang.Exception
java.lang.Exception
public static java.util.List<Message> readMessageList(java.io.DataInput in, short transport_id) throws java.lang.Exception
java.lang.Exception
public static MessageBatch[] readMessageBatch(java.io.DataInput in, boolean multicast) throws java.lang.Exception
in
- java.lang.Exception
public static void writeView(View view, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static View readView(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static void writeViewId(ViewId vid, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static ViewId readViewId(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static void writeAddress(Address addr, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static Address readAddress(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static int size(Address addr)
public static int size(View view)
public static int size(ViewId vid)
public static int size(java.lang.String s)
public static int size(byte[] buf)
public static void writeAddresses(java.util.Collection<? extends Address> v, java.io.DataOutput out) throws java.lang.Exception
v
- A Collectionout
- java.lang.Exception
public static void writeAddresses(Address[] addrs, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static java.util.Collection<? extends Address> readAddresses(java.io.DataInput in, java.lang.Class cl) throws java.lang.Exception
in
- cl
- The type of Collection, e.g. ArrayList.classjava.lang.Exception
public static Address[] readAddresses(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static long size(java.util.Collection<? extends Address> addrs)
addrs
- Collectionpublic static long size(Address[] addrs)
public static void writeStreamable(Streamable obj, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static Streamable readStreamable(java.lang.Class clazz, java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static void writeGenericStreamable(Streamable obj, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static Streamable readGenericStreamable(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static Streamable readGenericStreamable(java.io.DataInput in, java.lang.ClassLoader loader) throws java.lang.Exception
java.lang.Exception
public static <T extends Streamable> void write(T[] array, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static <T extends Streamable> T[] read(java.lang.Class<T> clazz, java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static void writeClass(java.lang.Class<?> classObject, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static java.lang.Class<?> readClass(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static void writeObject(java.lang.Object obj, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static java.lang.Object readObject(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static java.lang.String readFile(java.lang.String filename) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public static java.lang.String readContents(java.io.InputStream input)
public static byte[] readFileContents(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static java.lang.String readToken(java.io.InputStream in)
public static java.lang.String readStringFromStdin(java.lang.String message) throws java.lang.Exception
java.lang.Exception
public static long readLongFromStdin(java.lang.String message) throws java.lang.Exception
java.lang.Exception
public static double readDoubleFromStdin(java.lang.String message) throws java.lang.Exception
java.lang.Exception
public static int readIntFromStdin(java.lang.String message) throws java.lang.Exception
java.lang.Exception
public static void writeByteBuffer(byte[] buf, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static void writeByteBuffer(byte[] buf, int offset, int length, java.io.DataOutput out) throws java.lang.Exception
java.lang.Exception
public static byte[] readByteBuffer(java.io.DataInput in) throws java.lang.Exception
java.lang.Exception
public static Buffer messageToByteBuffer(Message msg) throws java.lang.Exception
java.lang.Exception
public static Message byteBufferToMessage(byte[] buffer, int offset, int length) throws java.lang.Exception
java.lang.Exception
public static <T> boolean match(T obj1, T obj2)
public static boolean match(long[] a1, long[] a2)
public static boolean patternMatch(java.lang.String pattern, java.lang.String str)
public static boolean productGreaterThan(long n1, long n2, long val)
public static <T> boolean different(T one, T two)
public static void sleep(long timeout)
public static void sleep(long timeout, int nanos)
public static int keyPress(java.lang.String msg)
public static long micros()
public static long random(long range)
public static void sleepRandom(long floor, long ceiling)
public static boolean tossWeightedCoin(double probability)
public static java.lang.String dumpThreads()
protected static void _printThreads(java.lang.management.ThreadMXBean bean, long[] ids, java.lang.StringBuilder sb)
public static boolean interruptAndWaitToDie(java.lang.Thread t)
public static boolean interruptAndWaitToDie(java.lang.Thread t, long timeout)
public static java.lang.String dumpQueue(Queue q)
public static java.lang.String mapToString(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map)
public static java.lang.String printBytes(long bytes)
bytes
- public static java.lang.String printNanos(double time_ns)
public static java.lang.String printTime(long time, java.util.concurrent.TimeUnit unit)
public static java.lang.String format(double value)
public static long readBytesLong(java.lang.String input)
public static int readBytesInteger(java.lang.String input)
public static double readBytesDouble(java.lang.String input)
public static java.lang.String printBytes(double bytes)
public static java.lang.String[] components(java.lang.String path, java.lang.String separator)
public static byte[][] fragmentBuffer(byte[] buf, int frag_size, int length)
byte[]
).public static java.util.List<Range> computeFragOffsets(int offset, int length, int frag_size)
frag_size
- public static java.util.List<Range> computeFragOffsets(byte[] buf, int frag_size)
public static byte[] defragmentBuffer(byte[][] fragments)
fragments
- An array of byte buffers (byte[]
)public static <T> boolean allEqual(java.util.Collection<T> elements)
public static <T> java.lang.String printListWithDelimiter(java.util.Collection<T> list, java.lang.String delimiter)
public static <T> java.lang.String printListWithDelimiter(java.util.Collection<T> list, java.lang.String delimiter, int limit)
public static <T> java.lang.String printListWithDelimiter(java.util.Collection<T> list, java.lang.String delimiter, int limit, boolean print_size)
public static <T> java.lang.String printListWithDelimiter(T[] list, java.lang.String delimiter, int limit)
public static <T> java.lang.String printMapWithDelimiter(java.util.Map<T,T> map, java.lang.String delimiter)
public static boolean all(java.util.Collection c, java.lang.Object obj)
public static java.util.List<Address> leftMembers(java.util.Collection<Address> old_list, java.util.Collection<Address> new_list)
public static java.util.List<Address> newMembers(java.util.List<Address> old_list, java.util.List<Address> new_list)
public static <T> java.util.List<T> newElements(java.util.List<T> old_list, java.util.List<T> new_list)
public static java.util.List<Address> pickSubset(java.util.List<Address> members, double subset_percentage)
public static <T> boolean contains(T key, T[] list)
public static boolean containsId(short id, short[] ids)
public static java.util.List<View> detectDifferentViews(java.util.Map<Address,View> map)
public static java.util.Collection<Address> determineMergeParticipants(java.util.Map<Address,View> map)
map
- public static java.util.Collection<Address> determineMergeCoords(java.util.Map<Address,View> map)
determineMergeParticipants(java.util.Map)
and contains only members
which are currently sub-partition coordinators.map
- public static java.util.Collection<Address> determineActualMergeCoords(java.util.Map<Address,View> map)
determineMergeCoords(java.util.Map)
but only actual coordinators are counted: an actual
coord is when the sender of a view is the first member of that viewmap
- public static int getRank(View view, Address addr)
view
- The viewaddr
- The address of a memberpublic static <T> T pickRandomElement(java.util.List<T> list)
public static <T> T pickRandomElement(T[] array)
public static <T> T pickNext(java.util.List<T> list, T obj)
T
- list
- obj
- public static <T> java.util.List<T> pickNext(java.util.List<T> list, T obj, int num)
public static JChannel createChannel(Protocol... prots) throws java.lang.Exception
java.lang.Exception
public static byte[] generateArray(int size)
public static Address createRandomAddress()
public static Address[] createRandomAddresses(int num)
public static Address[] createRandomAddresses(int num, boolean use_numbers)
public static Address createRandomAddress(java.lang.String name)
public static java.lang.Object[][] createTimer()
public static java.util.List<Address> determineLeftMembers(java.util.List<Address> old_mbrs, java.util.List<Address> new_mbrs)
public static java.lang.String printViews(java.util.Collection<View> views)
public static <T> java.lang.String print(java.util.Collection<T> objs)
public static <T> java.lang.String print(java.util.Map<T,T> map)
public static java.lang.String printPingData(java.util.List<PingData> rsps)
public static java.lang.String print(java.nio.ByteBuffer buf)
public static java.lang.Class loadClass(java.lang.String classname, java.lang.Class clazz) throws java.lang.ClassNotFoundException
classname
- Desired class.clazz
- Class object used to obtain a class loader
if no context class loader is available.java.lang.ClassNotFoundException
public static java.lang.Class<?> loadClass(java.lang.String classname, java.lang.ClassLoader preferredLoader) throws java.lang.ClassNotFoundException
classname
- Desired class name.preferredLoader
- The preferred class loaderjava.lang.ClassNotFoundException
- if the class could not be loaded by any loaderpublic static java.lang.reflect.Field[] getAllDeclaredFields(java.lang.Class clazz)
public static java.lang.reflect.Field[] getAllDeclaredFieldsWithAnnotations(java.lang.Class clazz, java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
public static java.lang.reflect.Method[] getAllDeclaredMethodsWithAnnotations(java.lang.Class clazz, java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
public static <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<?> clazz, java.lang.Class<A> annotationClass)
public static java.lang.reflect.Field getField(java.lang.Class clazz, java.lang.String field_name)
public static void setField(java.lang.reflect.Field field, java.lang.Object target, java.lang.Object value)
public static java.lang.Object getField(java.lang.reflect.Field field, java.lang.Object target)
public static java.lang.reflect.Field findField(java.lang.Object target, java.util.List<java.lang.String> possible_names)
public static java.lang.reflect.Method findMethod(java.lang.Object target, java.util.List<java.lang.String> possible_names, java.lang.Class<?>... parameter_types)
public static java.lang.reflect.Method findMethod(java.lang.Class<?> root_class, java.util.List<java.lang.String> possible_names, java.lang.Class<?>... parameter_types)
public static <T> java.util.Set<java.lang.Class<T>> findClassesAssignableFrom(java.lang.String packageName, java.lang.Class<T> assignableFrom) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public static java.util.List<java.lang.Class<?>> findClassesAnnotatedWith(java.lang.String packageName, java.lang.Class<? extends java.lang.annotation.Annotation> a) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public static java.io.InputStream getResourceAsStream(java.lang.String name, java.lang.Class clazz)
public static boolean sameHost(Address one, Address two)
public static java.util.concurrent.RejectedExecutionHandler parseRejectionPolicy(java.lang.String rejection_policy)
public static int[] parseCommaDelimitedInts(java.lang.String s)
public static long[] parseCommaDelimitedLongs(java.lang.String s)
public static java.util.List<java.lang.String> parseCommaDelimitedStrings(java.lang.String l)
public static java.util.List<PhysicalAddress> parseCommaDelimitedHosts(java.lang.String hosts, int port_range) throws java.net.UnknownHostException
java.net.UnknownHostException
public static java.util.List<java.net.InetSocketAddress> parseCommaDelimitedHosts2(java.lang.String hosts, int port_range)
public static java.util.List<java.lang.String> parseStringList(java.lang.String l, java.lang.String separator)
public static java.util.Map<java.lang.String,java.lang.String> parseCommaDelimitedProps(java.lang.String s)
public static int discardUntilNewLine(java.io.InputStream in)
in
- public static java.lang.String readLine(java.io.InputStream in) throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic static java.util.List<java.net.NetworkInterface> parseInterfaceList(java.lang.String s) throws java.lang.Exception
s
- java.lang.Exception
public static java.lang.String print(java.util.List<java.net.NetworkInterface> interfaces)
public static java.lang.String shortName(java.lang.String hostname)
public static boolean startFlush(Channel c, java.util.List<Address> flushParticipants, int numberOfAttempts, long randomSleepTimeoutFloor, long randomSleepTimeoutCeiling)
c
- the channelflushParticipants
- the flush participants in this flush attemptnumberOfAttempts
- the number of flush attemptsrandomSleepTimeoutFloor
- the minimum sleep time between attempts in msrandomSleepTimeoutCeiling
- the maximum sleep time between attempts in msChannel.startFlush(List,boolean)
public static boolean startFlush(Channel c, java.util.List<Address> flushParticipants)
c
- the channelflushParticipants
- the flush participants in this flush attemptChannel.startFlush(List,boolean)
public static boolean startFlush(Channel c, int numberOfAttempts, long randomSleepTimeoutFloor, long randomSleepTimeoutCeiling)
c
- the channelnumberOfAttempts
- the number of flush attemptsrandomSleepTimeoutFloor
- the minimum sleep time between attempts in msrandomSleepTimeoutCeiling
- the maximum sleep time between attempts in msChannel.startFlush(boolean)
public static boolean startFlush(Channel c)
c
- the channelChannel.startFlush(boolean)
public static java.lang.String shortName(java.net.InetAddress hostname)
public static java.lang.String generateLocalName()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentMap(int initial_capacity, float load_factor, int concurrency_level)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentMap(int initial_capacity)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentMap()
public static java.net.ServerSocket createServerSocket(SocketFactory factory, java.lang.String service_name, java.net.InetAddress bind_addr, int start_port)
public static java.net.ServerSocket createServerSocket(SocketFactory factory, java.lang.String service_name, java.net.InetAddress bind_addr, int start_port, int end_port) throws java.lang.Exception
java.lang.Exception
public static java.net.ServerSocket createServerSocketAndBind(SocketFactory factory, java.lang.String service_name, java.net.InetAddress bind_addr, int start_port, int end_port) throws java.lang.Exception
java.lang.Exception
public static void bind(java.net.ServerSocket srv_sock, java.net.InetAddress bind_addr, int start_port, int end_port) throws java.lang.Exception
java.lang.Exception
public static void bind(java.net.ServerSocket srv_sock, java.net.InetAddress bind_addr, int start_port, int end_port, int backlog) throws java.lang.Exception
java.lang.Exception
public static java.nio.channels.ServerSocketChannel createServerSocketChannelAndBind(java.net.InetAddress bind_addr, int start_port, int end_port) throws java.lang.Exception
java.lang.Exception
public static java.nio.channels.ServerSocketChannel createServerSocketChannel(java.net.InetAddress bind_addr, int start_port, int end_port) throws java.lang.Exception
java.lang.Exception
public static void bind(java.nio.channels.ServerSocketChannel ch, java.net.InetAddress bind_addr, int start_port, int end_port) throws java.lang.Exception
java.lang.Exception
public static void bind(java.nio.channels.ServerSocketChannel ch, java.net.InetAddress bind_addr, int start_port, int end_port, int backlog) throws java.lang.Exception
java.lang.Exception
public static java.net.DatagramSocket createDatagramSocket(SocketFactory factory, java.lang.String service_name, java.net.InetAddress addr, int port) throws java.lang.Exception
addr
- The InetAddress to which the socket should be bound. If null, the socket will not be bound.port
- The port which the socket should use. If 0, a random port will be used. If > 0, but port is already
in use, it will be incremented until an unused port is found, or until MAX_PORT is reached.java.lang.Exception
public static java.net.MulticastSocket createMulticastSocket(SocketFactory factory, java.lang.String service_name, java.net.InetAddress mcast_addr, int port, Log log) throws java.io.IOException
java.io.IOException
public static java.net.InetAddress validateBindAddressFromInterface(java.net.InetAddress bind_addr, java.lang.String bind_interface_str) throws java.net.UnknownHostException, java.net.SocketException
java.net.UnknownHostException
java.net.SocketException
public static java.net.NetworkInterface getByName(java.lang.String name) throws java.net.SocketException
java.net.SocketException
public static boolean checkForLinux()
public static boolean checkForHp()
public static boolean checkForSolaris()
public static boolean checkForWindows()
public static boolean checkForAndroid()
public static boolean checkForMac()
public static java.net.InetAddress getLocalhost(StackType ip_version) throws java.net.UnknownHostException
java.net.UnknownHostException
public static java.net.InetAddress getLocalhost() throws java.net.UnknownHostException
java.net.UnknownHostException
public static java.net.InetAddress getNonLoopbackAddress() throws java.net.SocketException
java.net.SocketException
public static java.net.InetAddress getAddress(Util.AddressScope scope) throws java.net.SocketException
java.net.SocketException
public static java.net.InetAddress getAddressByPatternMatch(java.lang.String pattern) throws java.lang.Exception
pattern
- Can be "match-addr:java.lang.Exception
public static java.net.InetAddress getAddress(java.net.NetworkInterface intf, Util.AddressScope scope)
intf
- the interface to be checkedpublic static boolean interfaceHasIPAddresses(java.net.NetworkInterface intf, StackType ip_version) throws java.net.UnknownHostException
intf
- java.net.UnknownHostException
public static StackType getIpStackType()
public static boolean sameAddresses(java.net.InetAddress one, java.net.InetAddress two)
public static boolean isStackAvailable(boolean ipv4)
public static java.util.List<java.net.NetworkInterface> getAllAvailableInterfaces() throws java.net.SocketException
java.net.SocketException
public static java.util.Collection<java.net.InetAddress> getAllAvailableAddresses()
public static void checkIfValidAddress(java.net.InetAddress bind_addr, java.lang.String prot_name) throws java.lang.Exception
java.lang.Exception
public static java.lang.String getProperty(java.lang.String[] system_props, java.util.Properties props, java.lang.String prop_name, java.lang.String default_value)
system_props
- props
- List of properties read from the configuration fileprop_name
- The name of the property, will be removed from props if founddefault_value
- Used to return a default value if the properties or system properties didn't have the valuepublic static boolean isCoordinator(JChannel ch)
public static javax.management.MBeanServer getMBeanServer()
public static void registerChannel(JChannel channel, java.lang.String name)
public static java.lang.String replaceProperties(java.lang.String string, java.util.Properties props)
string
- -
the string with possible ${} referencesprops
- -
the source for ${x} property ref values, null means use
System.getProperty(){@link
- java.security.AccessControlException}
when not authorised to retrieved system propertiespublic static java.lang.String substituteVariable(java.lang.String val)
val
- public static java.lang.String getProperty(java.lang.String s)
public static java.lang.String md5(java.lang.String source)
source
- the source Stringpublic static java.lang.String sha(java.lang.String source)
source
- the source Stringpublic static java.lang.String methodNameToAttributeName(java.lang.String methodName)
methodName
- public static java.lang.String methodNameToJavaAttributeName(java.lang.String methodName)
methodName
- public static java.lang.String attributeNameToMethodName(java.lang.String attr_name)
Copyright © 1998-2020 Red Hat. All Rights Reserved.