public abstract class ZooKeeperUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ZooKeeperUtils.StripPathConverter
Converter from
ChildData to leaf name string. |
Modifier and Type | Field and Description |
---|---|
static ZooKeeperUtils.StripPathConverter |
stripPathConverter
Converter from ChildData to the leaf path name string. |
Constructor and Description |
---|
ZooKeeperUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
bytesToMap(byte[] bytes)
Convert a byte array containing a JSON string to a map of key/value pairs.
|
static void |
logCacheEvent(org.slf4j.Logger logger,
org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event)
Utility method to log
events . |
static byte[] |
mapToBytes(java.util.Map<java.lang.String,java.lang.String> map)
Convert a map of string key/value pairs to a JSON string in a byte array.
|
static void |
wrapAndThrowIgnoring(java.lang.Throwable t,
java.lang.Class... ignored)
Throw a wrapped exception ignoring specific Exception types, if any.
|
static java.lang.RuntimeException |
wrapThrowable(java.lang.Throwable t)
Utility method to wrap a Throwable in a
ZooKeeperAccessException . |
static java.lang.RuntimeException |
wrapThrowable(java.lang.Throwable t,
java.lang.String message)
Utility method to wrap a Throwable in a
ZooKeeperAccessException . |
public static final ZooKeeperUtils.StripPathConverter stripPathConverter
Converter
from ChildData
to the leaf path name string.public static byte[] mapToBytes(java.util.Map<java.lang.String,java.lang.String> map)
map
- map to convertpublic static java.util.Map<java.lang.String,java.lang.String> bytesToMap(byte[] bytes)
bytes
- byte array containing the key/value pair stringspublic static java.lang.RuntimeException wrapThrowable(java.lang.Throwable t)
ZooKeeperAccessException
.t
- the throwablepublic static java.lang.RuntimeException wrapThrowable(java.lang.Throwable t, java.lang.String message)
ZooKeeperAccessException
.t
- the throwablemessage
- use this message if not nullpublic static void wrapAndThrowIgnoring(java.lang.Throwable t, java.lang.Class... ignored)
t
- the throwableignored
- a varargs list of ignored exception typespublic static void logCacheEvent(org.slf4j.Logger logger, org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event)
events
.logger
- logger to write toevent
- event to log