org.jboss.threads.JBossExecutors.clearContextClassLoader()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(80)

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

JBossExecutors.clearContextClassLoader介绍

[英]Privileged method to clear the context class loader of the given thread to a safe non- null value.
[中]特权方法将给定线程的上下文类装入器清除为安全的非空值。

代码示例

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

void safeRun(final Runnable task) {
  assert ! holdsLock(headLock) && ! holdsLock(tailLock);
  try {
    if (task != null) task.run();
  } catch (Throwable t) {
    try {
      exceptionHandler.uncaughtException(Thread.currentThread(), t);
    } catch (Throwable ignored) {
      // nothing else we can safely do here
    }
  } finally {
    // clear TCCL
    JBossExecutors.clearContextClassLoader(Thread.currentThread());
    // clear interrupt status
    Thread.interrupted();
  }
}

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

private Thread createThread(final Runnable target) {
    final ThreadNameInfo nameInfo = new ThreadNameInfo(globalThreadIndexSequence.getAndIncrement(), factoryThreadIndexSequence.getAndIncrement(), factoryIndex);
    final JBossThread thread;
    if (stackSize != null) {
      thread = new JBossThread(threadGroup, target, "<new>", stackSize.longValue());
    } else {
      thread = new JBossThread(threadGroup, target);
    }
    thread.setThreadNameInfo(nameInfo);
    thread.setName(nameInfo.format(thread, namePattern));
    if (initialPriority != null) thread.setPriority(initialPriority.intValue());
    if (daemon != null) thread.setDaemon(daemon.booleanValue());
    if (uncaughtExceptionHandler != null) thread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    JBossExecutors.clearContextClassLoader(thread);
    return thread;
  }
}

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

JBossExecutors.clearContextClassLoader(currentThread);

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

void safeRun(final Runnable task) {
  assert ! holdsLock(headLock) && ! holdsLock(tailLock);
  try {
    if (task != null) task.run();
  } catch (Throwable t) {
    try {
      exceptionHandler.uncaughtException(Thread.currentThread(), t);
    } catch (Throwable ignored) {
      // nothing else we can safely do here
    }
  } finally {
    // clear TCCL
    JBossExecutors.clearContextClassLoader(Thread.currentThread());
    // clear interrupt status
    Thread.interrupted();
  }
}

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

void safeRun(final Runnable task) {
  assert ! holdsLock(headLock) && ! holdsLock(tailLock);
  try {
    if (task != null) task.run();
  } catch (Throwable t) {
    try {
      exceptionHandler.uncaughtException(Thread.currentThread(), t);
    } catch (Throwable ignored) {
      // nothing else we can safely do here
    }
  } finally {
    // clear TCCL
    JBossExecutors.clearContextClassLoader(Thread.currentThread());
    // clear interrupt status
    Thread.interrupted();
  }
}

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

private Thread createThread(final Runnable target) {
    final ThreadNameInfo nameInfo = new ThreadNameInfo(globalThreadIndexSequence.getAndIncrement(), factoryThreadIndexSequence.getAndIncrement(), factoryIndex);
    final JBossThread thread;
    if (stackSize != null) {
      thread = new JBossThread(threadGroup, target, "<new>", stackSize.longValue());
    } else {
      thread = new JBossThread(threadGroup, target);
    }
    thread.setThreadNameInfo(nameInfo);
    thread.setName(nameInfo.format(thread, namePattern));
    if (initialPriority != null) thread.setPriority(initialPriority.intValue());
    if (daemon != null) thread.setDaemon(daemon.booleanValue());
    if (uncaughtExceptionHandler != null) thread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    JBossExecutors.clearContextClassLoader(thread);
    return thread;
  }
}

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

private Thread createThread(final Runnable target) {
    final ThreadNameInfo nameInfo = new ThreadNameInfo(globalThreadIndexSequence.getAndIncrement(), factoryThreadIndexSequence.getAndIncrement(), factoryIndex);
    final JBossThread thread;
    if (stackSize != null) {
      thread = new JBossThread(threadGroup, target, "<new>", stackSize.longValue());
    } else {
      thread = new JBossThread(threadGroup, target);
    }
    thread.setThreadNameInfo(nameInfo);
    thread.setName(nameInfo.format(thread, namePattern));
    if (initialPriority != null) thread.setPriority(initialPriority.intValue());
    if (daemon != null) thread.setDaemon(daemon.booleanValue());
    if (uncaughtExceptionHandler != null) thread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    JBossExecutors.clearContextClassLoader(thread);
    return thread;
  }
}

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

JBossExecutors.clearContextClassLoader(currentThread);

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

JBossExecutors.clearContextClassLoader(currentThread);

相关文章

微信公众号

最新文章

更多