org.slf4j.spi.MDCAdapter.getCopyOfContextMap()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中org.slf4j.spi.MDCAdapter.getCopyOfContextMap()方法的一些代码示例,展示了MDCAdapter.getCopyOfContextMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MDCAdapter.getCopyOfContextMap()方法的具体详情如下:
包路径:org.slf4j.spi.MDCAdapter
类名称:MDCAdapter
方法名:getCopyOfContextMap

MDCAdapter.getCopyOfContextMap介绍

[英]Return a copy of the current thread's context map, with keys and values of type String. Returned value may be null.
[中]返回当前线程上下文映射的副本,其中包含字符串类型的键和值。返回值可能为空。

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: wildfly/wildfly

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: ch.qos.logback/logback-classic

public Map<String, String> getMDCPropertyMap() {
  // populate mdcPropertyMap if null
  if (mdcPropertyMap == null) {
    MDCAdapter mdc = MDC.getMDCAdapter();
    if (mdc instanceof LogbackMDCAdapter)
      mdcPropertyMap = ((LogbackMDCAdapter) mdc).getPropertyMap();
    else
      mdcPropertyMap = mdc.getCopyOfContextMap();
  }
  // mdcPropertyMap still null, use emptyMap()
  if (mdcPropertyMap == null)
    mdcPropertyMap = Collections.emptyMap();
  return mdcPropertyMap;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map getCopyOfContextMap() {
 if (mdcAdapter == null) {
  throw new IllegalStateException("MDCAdapter cannot be null. See also "
    + NULL_MDCA_URL);
 }
 return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: camunda/camunda-bpm-platform

public Map<String, String> getMDCPropertyMap() {
 // populate mdcPropertyMap if null
 if (mdcPropertyMap == null) {
  MDCAdapter mdc = MDC.getMDCAdapter();
  if (mdc instanceof LogbackMDCAdapter)
   mdcPropertyMap = ((LogbackMDCAdapter) mdc).getPropertyMap();
  else
   mdcPropertyMap = mdc.getCopyOfContextMap();
 }
 // mdcPropertyMap still null, use CACHED_NULL_MAP
 if (mdcPropertyMap == null)
  mdcPropertyMap = CACHED_NULL_MAP;
 return mdcPropertyMap;
}

代码示例来源:origin: org.echocat.jomon/runtime

@Override
public Map<String, String> getCopyOfContextMap() {
  return _delegate.getCopyOfContextMap();
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: uk.co.nichesolutions/slf4j-api

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: com.github.oshi/oshi-core-shaded

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: org.apache.activemq/activemq-all

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: wolpi/prim-ftpd

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map getCopyOfContextMap() {
 if (mdcAdapter == null) {
  throw new IllegalStateException("MDCAdapter cannot be null. See also "
    + NULL_MDCA_URL);
 }
 return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.slf4j.api

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map getCopyOfContextMap() {
 if (mdcAdapter == null) {
  throw new IllegalStateException("MDCAdapter cannot be null. See also "
    + NULL_MDCA_URL);
 }
 return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map getCopyOfContextMap() {
 if (mdcAdapter == null) {
  throw new IllegalStateException("MDCAdapter cannot be null. See also "
    + NULL_MDCA_URL);
 }
 return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

/**
 * Return a copy of the current thread's context map, with keys and values of
 * type String. Returned value may be null.
 * 
 * @return A copy of the current thread's context map. May be null.
 * @since 1.5.1
 */
public static Map<String, String> getCopyOfContextMap() {
  if (mdcAdapter == null) {
    throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
  }
  return mdcAdapter.getCopyOfContextMap();
}

代码示例来源:origin: rancher/cattle

@SuppressWarnings("unchecked")
public EventVO() {
  id = io.cattle.platform.util.resource.UUID.randomUUID().toString();
  time = new Date();
  context = MDC.getMDCAdapter().getCopyOfContextMap();
}

代码示例来源:origin: tony19/logback-android

public Map<String, String> getMDCPropertyMap() {
 // populate mdcPropertyMap if null
 if (mdcPropertyMap == null) {
  MDCAdapter mdc = MDC.getMDCAdapter();
  if (mdc instanceof LogbackMDCAdapter)
   mdcPropertyMap = ((LogbackMDCAdapter) mdc).getPropertyMap();
  else
   mdcPropertyMap = mdc.getCopyOfContextMap();
 }
 // mdcPropertyMap still null, use emptyMap()
 if (mdcPropertyMap == null)
  mdcPropertyMap = Collections.emptyMap();
 return mdcPropertyMap;
}

代码示例来源:origin: Nextdoor/bender

public Map<String, String> getMDCPropertyMap() {
  // populate mdcPropertyMap if null
  if (mdcPropertyMap == null) {
    MDCAdapter mdc = MDC.getMDCAdapter();
    if (mdc instanceof LogbackMDCAdapter)
      mdcPropertyMap = ((LogbackMDCAdapter) mdc).getPropertyMap();
    else
      mdcPropertyMap = mdc.getCopyOfContextMap();
  }
  // mdcPropertyMap still null, use emptyMap()
  if (mdcPropertyMap == null)
    mdcPropertyMap = Collections.emptyMap();
  return mdcPropertyMap;
}

相关文章