|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.util.Util
public final class Util
General utility methods used throughout the Infinispan code base.
Nested Class Summary | |
---|---|
static class |
Util.MapModifications
Static inner class that holds 3 maps - for data added, removed and modified. |
Method Summary | ||
---|---|---|
static
|
asSet(T... a)
|
|
static
|
cloneWithMarshaller(Marshaller marshaller,
T x)
Clones parameter x of type T with a given Marshaller reference; |
|
static void |
close(Closeable... cls)
|
|
static void |
close(Closeable cl)
|
|
static void |
close(Context ctx)
|
|
static void |
close(Socket s)
|
|
static void |
flushAndCloseOutput(ObjectOutput o)
|
|
static void |
flushAndCloseStream(OutputStream o)
|
|
static String |
formatString(Object message,
Object... params)
|
|
static ClassLoader[] |
getClassLoaders(ClassLoader appClassLoader)
|
|
static
|
getInstance(Class<T> clazz)
Instantiates a class by first attempting a static factory method named getInstance() on the class and then falling back to an empty constructor. |
|
static
|
getInstance(String classname,
ClassLoader cl)
Instantiates a class based on the class name provided. |
|
static
|
getInstanceStrict(Class<T> clazz)
Similar to getInstance(Class) except that exceptions are propagated to the caller. |
|
static
|
getInstanceStrict(String classname,
ClassLoader cl)
Similar to #getInstance(String) except that exceptions are propagated to the caller. |
|
static String |
hexDump(byte[] buffer)
|
|
static String |
hexIdHashCode(Object o)
Prints the identity hash code of the object passed as parameter in an hexadecimal format in order to safe space. |
|
static
|
loadClass(String classname,
ClassLoader cl)
Loads the specified class using the passed classloader, or, if it is null the Inifinispan classes'
classloader. |
|
static
|
loadClassStrict(String classname,
ClassLoader userClassLoader)
Loads the specified class using the passed classloader, or, if it is null the Inifinispan classes' classloader. |
|
static String |
padString(String s,
int minWidth)
|
|
static String |
prettyPrintTime(long millis)
Prints a time for display |
|
static String |
prettyPrintTime(long time,
TimeUnit unit)
|
|
static String |
printArray(byte[] array,
boolean withHash)
|
|
static CacheException |
rewrapAsCacheException(Throwable t)
|
|
static boolean |
safeEquals(Object a,
Object b)
Null-safe equality test. |
|
static void |
safeRelease(Lock toRelease)
Releases a lock and swallows any IllegalMonitorStateExceptions - so it is safe to call this method even if the lock is not locked, or not locked by the current thread. |
|
static String |
threadDump()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> Class<T> loadClass(String classname, ClassLoader cl)
Loads the specified class using the passed classloader, or, if it is null
the Inifinispan classes'
classloader.
If loadtime instrumentation via GenerateInstrumentedClassLoader is used, this class may be loaded by the bootstrap classloader.
If the class is not found, the ClassNotFoundException
or NoClassDefFoundError
is wrapped as a
ConfigurationException
and is re-thrown.
classname
- name of the class to loadcl
- the application classloader which should be used to load the class, or null if the class is always packaged with
Infinispan
ConfigurationException
- if the class cannot be loadedpublic static ClassLoader[] getClassLoaders(ClassLoader appClassLoader)
public static <T> Class<T> loadClassStrict(String classname, ClassLoader userClassLoader) throws ClassNotFoundException
Loads the specified class using the passed classloader, or, if it is null
the Inifinispan classes' classloader.
If loadtime instrumentation via GenerateInstrumentedClassLoader is used, this class may be loaded by the bootstrap classloader.
classname
- name of the class to loadcl
- the application classloader which should be used to load the class, or null if the class is always packaged with
Infinispan
ClassNotFoundException
- if the class cannot be loadedpublic static <T> T getInstance(Class<T> clazz)
ConfigurationException
and rethrown.
clazz
- class to instantiate
public static <T> T getInstanceStrict(Class<T> clazz) throws IllegalAccessException, InstantiationException
getInstance(Class)
except that exceptions are propagated to the caller.
clazz
- class to instantiate
IllegalAccessException
InstantiationException
public static <T> T getInstance(String classname, ClassLoader cl)
ConfigurationException
.
classname
- class to instantiate
public static <T> T getInstanceStrict(String classname, ClassLoader cl) throws ClassNotFoundException, InstantiationException, IllegalAccessException
#getInstance(String)
except that exceptions are propagated to the caller.
classname
- class to instantiate
ClassNotFoundException
InstantiationException
IllegalAccessException
public static <T> T cloneWithMarshaller(Marshaller marshaller, T x)
public static boolean safeEquals(Object a, Object b)
a
- first object to compareb
- second object to compare
public static String prettyPrintTime(long time, TimeUnit unit)
public static String prettyPrintTime(long millis)
millis
- time in millis
public static void close(Closeable cl)
public static void close(Socket s)
public static void close(Closeable... cls)
public static void close(Context ctx)
public static void flushAndCloseStream(OutputStream o)
public static void flushAndCloseOutput(ObjectOutput o)
public static String formatString(Object message, Object... params)
public static String printArray(byte[] array, boolean withHash)
public static String padString(String s, int minWidth)
public static final void safeRelease(Lock toRelease)
toRelease
- lock to releasepublic static String threadDump()
public static CacheException rewrapAsCacheException(Throwable t)
public static <T> Set<T> asSet(T... a)
public static String hexIdHashCode(Object o)
public static String hexDump(byte[] buffer)
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |