logback-android/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java
public void put(String key, String val) throws IllegalArgumentException {
    if (key == null) {
      throw new IllegalArgumentException("key cannot be null");
    }

    Map<String, String> oldMap = copyOnThreadLocal.get();
    Integer lastOp = getAndSetLastOperation(WRITE_OPERATION);

    if (wasLastOpReadOrNull(lastOp) || oldMap == null) {
      Map<String, String> newMap = duplicateAndInsertNewMap(oldMap);
      newMap.put(key, val);
    } else {
      oldMap.put(key, val);
    }
  }
public void put(String key, String val) throws IllegalArgumentException {
    if (key == null) {
      throw new IllegalArgumentException("key cannot be null");
    }

    Map<String, String> oldMap = copyOnThreadLocal.get();
    Integer lastOp = getAndSetLastOperation(WRITE_OPERATION);

    if (wasLastOpReadOrNull(lastOp) || oldMap == null) {
      Map<String, String> newMap = duplicateAndInsertNewMap(oldMap);
      newMap.put(key, val);
    } else {
      oldMap.put(key, val);
    }
  }
public void put ( String key , String val ) throws IllegalArgumentException { if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null" ) ; } Map < String , String > oldMap = copyOnThreadLocal . get ( ) ; Integer lastOp = getAndSetLastOperation ( WRITE_OPERATION ) ; if ( wasLastOpReadOrNull ( lastOp ) || oldMap == null ) { Map < String , String > newMap = duplicateAndInsertNewMap ( oldMap ) ; newMap . put ( key , val ) ; } else { oldMap . put ( key , val ) ; } }
Put a context value (the <code>val</code> parameter) as identified with the
<code>key</code> parameter into the current thread's context map. Note that
contrary to log4j, the <code>val</code> parameter can be null.
<p>
If the current thread does not have a context map it is created as a side
effect of this call.

@throws IllegalArgumentException in case the "key" parameter is null
Put a context value ( the <code > val< / code > parameter ) as identified with the <code > key< / code > parameter into the current thread s context map . Note that contrary to log4j the <code > val< / code > parameter can be null . <p > If the current thread does not have a context map it is created as a side effect of this call .