git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1082530 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2011-03-17 15:15:27 +00:00
parent 2b456ddbd0
commit cc810aa4da
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package org.apache.activemq.util;
import org.slf4j.MDC;
import java.util.Hashtable;
import java.util.Map;
/**
* Helper class as MDC Log4J adapter doesn't behave well with null values
*/
public class MDCHelper {
public static Map getCopyOfContextMap() {
Map map = MDC.getCopyOfContextMap();
if (map == null) {
map = new Hashtable();
}
return map;
}
public static void setContextMap(Map map) {
if (map == null) {
map = new Hashtable();
}
MDC.setContextMap(map);
}
}