Package com.rabbitmq.utility
Class Utility
- java.lang.Object
-
- com.rabbitmq.utility.Utility
-
public class Utility extends java.lang.ObjectCatch-all holder class for static helper methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classUtility.ThrowableCreatedElsewhere
-
Constructor Summary
Constructors Constructor Description Utility()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> java.util.List<E>copy(java.util.List<E> list)Synchronizes on the list and then returns a copy of the list that is safe to iterate over.static <K,V>
java.util.Map<K,V>copy(java.util.Map<K,V> map)Synchronizes on the map and then returns a copy of the map that is safe to iterate over.static <E> java.util.Set<E>copy(java.util.Set<E> set)Synchronizes on the set and then returns a copy of the set that is safe to iterate over.static <T extends java.lang.Throwable & SensibleClone<T>>
TfixStackTrace(T throwable)static java.lang.StringmakeStackTrace(java.lang.Throwable throwable)Deprecated.use logging library instead for logging stack traces somewhere
-
-
-
Method Detail
-
fixStackTrace
public static <T extends java.lang.Throwable & SensibleClone<T>> T fixStackTrace(T throwable)
-
makeStackTrace
public static java.lang.String makeStackTrace(java.lang.Throwable throwable)
Deprecated.use logging library instead for logging stack traces somewhere- Parameters:
throwable-- Returns:
-
copy
public static <E> java.util.Set<E> copy(java.util.Set<E> set)
Synchronizes on the set and then returns a copy of the set that is safe to iterate over. Useful when wanting to do thread-safe iteration over a Set wrapped inCollections.synchronizedSet(Set).- Parameters:
set- The set, which may not benull- Returns:
- LinkedHashSet copy of the set
-
copy
public static <E> java.util.List<E> copy(java.util.List<E> list)
Synchronizes on the list and then returns a copy of the list that is safe to iterate over. Useful when wanting to do thread-safe iteration over a List wrapped inCollections.synchronizedList(List).- Parameters:
list- The list, which may not benull- Returns:
- ArrayList copy of the list
-
copy
public static <K,V> java.util.Map<K,V> copy(java.util.Map<K,V> map)
Synchronizes on the map and then returns a copy of the map that is safe to iterate over. Useful when wanting to do thread-safe iteration over a Map wrapped inCollections.synchronizedMap(Map)- Parameters:
map- The map, which may not benull- Returns:
- LinkedHashMap copy of the map
-
-