@SuppressWarnings({ "rawtypes", "unchecked" })
    @Override
    public void setContextMap(Map<String, String> contextMap) {
        Map old = org.apache.log4j.MDC.getContext();
        
        // we must cater for the case where the contextMap argument is null 
        if (contextMap == null) {
            if (old != null) {
                old.clear();
            }
            return;
        }
        
        if (old == null) {
            for (Map.Entry<String, String> mapEntry : contextMap.entrySet()) {
                org.apache.log4j.MDC.put(mapEntry.getKey(), mapEntry.getValue());
            }
        } else {
            old.clear();
            old.putAll(contextMap);
        }
    }
Put a context value (the <code>val</code> parameter) as identified with
the <code>key</code> parameter into the current thread's context map. The
<code>key</code> parameter cannot be null. Log4j does <em>not</em>
support null for the <code>val</code> parameter.

<p>
This method delegates all work to log4j's MDC.

@throws IllegalArgumentException
            in case the "key" or <b>"val"</b> parameter is null
slf4j-reload4j/src/main/java/org/slf4j/reload4j/Reload4jMDCAdapter.java