Class MDCs
- java.lang.Object
 - 
- org.opendaylight.infrautils.utils.mdc.MDCs
 
 
- 
@Beta public final class MDCs extends Object
Utility methods forMDC.- Author:
 - Michael Vorburger.ch
 
 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidput(String key, String val)Minor improvement overMDC.put(String, String).static voidputRunRemove(Runnable runnable, MDCEntry... keysValues)static voidputRunRemove(String key, String val, Runnable runnable)put(String, String)a key/val into the MDC, runs the providedRunnable, and (ensure that) the given key isMDC.remove(String)'d (even if there was an exception).static voidputRunRemove(Map<String,String> keysValues, Runnable runnable)put(String, String)each key/val of the passed Map into the MDC, runs the providedRunnable, and (ensure that) the all keys of the Map areMDC.remove(String)'d (even if there was an exception).static voidputRunRemove(MDCEntry entry, Runnable runnable) 
 - 
 
- 
- 
Method Detail
- 
put
public static void put(String key, String val)
Minor improvement overMDC.put(String, String). Specifically, it:- tests if there already is an entry for the given 
key(to detect forgottenremove, instead of overwriting) - does not accept 
nullasval 
- Throws:
 IllegalArgumentException- if val is value is already set (and was previously notMDC.remove(String))
 - tests if there already is an entry for the given 
 
- 
putRunRemove
public static void putRunRemove(String key, String val, Runnable runnable)
put(String, String)a key/val into the MDC, runs the providedRunnable, and (ensure that) the given key isMDC.remove(String)'d (even if there was an exception). 
- 
putRunRemove
public static void putRunRemove(Map<String,String> keysValues, Runnable runnable)
put(String, String)each key/val of the passed Map into the MDC, runs the providedRunnable, and (ensure that) the all keys of the Map areMDC.remove(String)'d (even if there was an exception). 
 - 
 
 -