public abstract class GridClientUtils extends Object
| Constructor and Description |
|---|
GridClientUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Collection<T> |
applyFilter(Iterable<? extends T> elements,
GridClientPredicate<? super T>... filters)
Applies filter and returns filtered collection of nodes.
|
static void |
closeQuiet(Closeable closeable)
Closes resource without reporting any error.
|
static <T> GridClientPredicate<T> |
contains(Collection<T> c)
Creates a predicates that checks if given value is contained in collection c.
|
static <T> T |
first(Iterable<? extends T> c)
Gets first element from given collection or returns
null if the collection is empty. |
static String |
getSimpleName(Class<?> cls)
Gets simple class name taking care of empty names.
|
static boolean |
restAvailable(GridClientNode node,
GridClientProtocol p)
Checks if given REST protocol available for given node.
|
static int |
safeAbs(int i)
Gets absolute value for integer.
|
static void |
shutdownNow(Class<?> owner,
ExecutorService exec,
Logger log)
Shutdowns given
ExecutorService and wait for executor service to stop. |
public static void closeQuiet(@Nullable Closeable closeable)
closeable - Resource to close.public static <T> GridClientPredicate<T> contains(Collection<T> c)
T - Type of elements in collection.c - Collection to check.@Nullable public static <T> T first(@Nullable Iterable<? extends T> c)
null if the collection is empty.T - Type of the collection.c - A collection.null in case if the collection is empty.public static <T> Collection<T> applyFilter(Iterable<? extends T> elements, GridClientPredicate<? super T>... filters)
elements - Nodes to be filtered.filters - Filters to apply. Elements of this array are allowed to be null.public static boolean restAvailable(GridClientNode node, GridClientProtocol p)
node - Node.p - Protocol.true if protocol p available for node,
false otherwise.public static void shutdownNow(Class<?> owner, ExecutorService exec, Logger log)
ExecutorService and wait for executor service to stop.owner - The ExecutorService owner.exec - ExecutorService to shutdown.log - The logger to possible exceptions and warnings.public static String getSimpleName(Class<?> cls)
cls - Class to get the name for.public static int safeAbs(int i)
Integer.MIN_VALUE, then 0 is returned.i - Integer.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015