org.apache.logging.log4j.ThreadContext.clearStack()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(113)

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

ThreadContext.clearStack介绍

[英]Clears the stack for this thread.
[中]清除此线程的堆栈。

代码示例

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

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-api

/**
 * Clears the context map and stack.
 */
public static void clearAll() {
  clearMap();
  clearStack();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-api

@Override
protected void before() throws Throwable {
  threadContextHolder = new ThreadContextHolder(restoreMap, restoreStack);
  if (restoreMap) {
    ThreadContext.clearMap();
  }
  if (restoreStack) {
    ThreadContext.clearStack();
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-api

public static void testGetImmutableStackReturnsEmptyStackIfEmpty() {
  ThreadContext.clearStack();
  assertTrue(ThreadContext.getImmutableStack().asList().isEmpty());
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

ThreadContext.push("stack2");
final ThreadContext.ContextStack stack = ThreadContext.getImmutableStack();
ThreadContext.clearStack();

代码示例来源:origin: org.apache.logging.log4j/log4j-core

ThreadContext.push("stack2");
final ThreadContext.ContextStack stack = ThreadContext.getImmutableStack();
ThreadContext.clearStack();

代码示例来源:origin: zstackio/zstack

@Override
protected void beforeExecute(Thread t, Runnable r) {
  ThreadContext.clearMap();
  ThreadContext.clearStack();
  ThreadAroundHook debugHook = null;
  List<ThreadAroundHook> tmpHooks;       
  synchronized (_hooks) {
    tmpHooks = new ArrayList<ThreadAroundHook>(_hooks);
  }
  
  for (ThreadAroundHook hook : tmpHooks) {
    debugHook = hook;
    try {
      hook.beforeExecute(t, r);
    } catch (Exception e) {
      _logger.warn("Unhandle exception happend during executing ThreadAroundHook: " + debugHook.getClass().getCanonicalName(), e);
    }
  }
}

代码示例来源:origin: zstackio/zstack

@Override
  protected void afterExecute(Runnable r, Throwable t) {
    ThreadContext.clearMap();
    ThreadContext.clearStack();

    ThreadAroundHook debugHook = null;
    List<ThreadAroundHook> tmpHooks;
    synchronized (_hooks) {
      tmpHooks = new ArrayList<ThreadAroundHook>(_hooks);
    }
    
    for (ThreadAroundHook hook : tmpHooks) {
      debugHook = hook;
      try {
        hook.afterExecute(r, t);
      } catch (Exception e) {
        _logger.warn("Unhandle exception happend during executing ThreadAroundHook: " + debugHook.getClass().getCanonicalName(), e);
      }
    }
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j12-api

/**
 * Clear any nested diagnostic information if any. This method is
 * useful in cases where the same thread can be potentially used
 * over and over in different unrelated contexts.
 * <p/>
 * <p>This method is equivalent to calling the {@link #setMaxDepth}
 * method with a zero <code>maxDepth</code> argument.
 */
public static void clear() {
  org.apache.logging.log4j.ThreadContext.clearStack();
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-1.2-api

/**
 * Clear any nested diagnostic information if any. This method is
 * useful in cases where the same thread can be potentially used
 * over and over in different unrelated contexts.
 * <p>
 * This method is equivalent to calling the {@link #setMaxDepth}
 * method with a zero <code>maxDepth</code> argument.
 * </p>
 */
public static void clear() {
  org.apache.logging.log4j.ThreadContext.clearStack();
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

代码示例来源:origin: org.apache.logging.log4j.adapters/log4j-1.2-api

/**
 * Clear any nested diagnostic information if any. This method is
 * useful in cases where the same thread can be potentially used
 * over and over in different unrelated contexts.
 * <p/>
 * <p>This method is equivalent to calling the {@link #setMaxDepth}
 * method with a zero <code>maxDepth</code> argument.
 */
public static void clear() {
  org.apache.logging.log4j.ThreadContext.clearStack();
}

代码示例来源:origin: org.jboss.weld.se/weld-se

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

代码示例来源:origin: weld/core

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

代码示例来源:origin: weld/core

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

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

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

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

@Override
public void clearNdc() {
  ThreadContext.clearStack();
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

/**
 * Clears the context map and stack.
 */
public static void clearAll() {
  clearMap();
  clearStack();
}

相关文章