java.lang.SecurityManager.getThreadGroup()方法的使用及代码示例

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

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

SecurityManager.getThreadGroup介绍

[英]Returns the current thread's thread group.
[中]返回当前线程的线程组。

代码示例

代码示例来源:origin: apache/incubator-dubbo

public NamedThreadFactory(String prefix, boolean daemon) {
  mPrefix = prefix + "-thread-";
  mDaemon = daemon;
  SecurityManager s = System.getSecurityManager();
  mGroup = (s == null) ? Thread.currentThread().getThreadGroup() : s.getThreadGroup();
}

代码示例来源:origin: apache/incubator-dubbo

public NamedThreadFactory(String prefix, boolean daemon) {
  mPrefix = prefix + "-thread-";
  mDaemon = daemon;
  SecurityManager s = System.getSecurityManager();
  mGroup = (s == null) ? Thread.currentThread().getThreadGroup() : s.getThreadGroup();
}

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

public DefaultThreadFactory(String poolName, boolean daemon, int priority) {
  this(poolName, daemon, priority, System.getSecurityManager() == null ?
      Thread.currentThread().getThreadGroup() : System.getSecurityManager().getThreadGroup());
}

代码示例来源:origin: alibaba/canal

public NamedThreadFactory(String name, boolean daemon){
  this.name = name;
  this.daemon = daemon;
  SecurityManager s = System.getSecurityManager();
  group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
}

代码示例来源:origin: apache/storm

public NettyRenameThreadFactory(String name) {
  SecurityManager s = System.getSecurityManager();
  group = (s != null) ? s.getThreadGroup() :
    Thread.currentThread().getThreadGroup();
  this.name = name;
}

代码示例来源:origin: springside/springside4

private NamedThreadFactory(String name) {
  final SecurityManager s = System.getSecurityManager();
  this.group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
  this.namePrefix = name;
}

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

public DefaultThreadFactory(String poolName, boolean daemon, int priority) {
  this(poolName, daemon, priority, System.getSecurityManager() == null ?
      Thread.currentThread().getThreadGroup() : System.getSecurityManager().getThreadGroup());
}

代码示例来源:origin: alibaba/Sentinel

public NamedThreadFactory(String namePrefix, boolean daemon) {
  this.daemon = daemon;
  SecurityManager s = System.getSecurityManager();
  group = (s != null) ? s.getThreadGroup() :
    Thread.currentThread().getThreadGroup();
  this.namePrefix = namePrefix;
}

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

@Deprecated
public NamedThreadFactory( String threadNamePrefix, int priority, Monitor monitor, boolean daemon )
{
  this.threadNamePrefix = threadNamePrefix;
  SecurityManager securityManager = System.getSecurityManager();
  group = (securityManager != null) ?
      securityManager.getThreadGroup() :
      Thread.currentThread().getThreadGroup();
  this.priority = priority;
  this.daemon = daemon;
  this.monitor = monitor;
}

代码示例来源:origin: apache/zookeeper

DaemonThreadFactory(String name, int firstThreadNum) {
  threadNumber.set(firstThreadNum);
  SecurityManager s = System.getSecurityManager();
  group = (s != null)? s.getThreadGroup() :
             Thread.currentThread().getThreadGroup();
  namePrefix = name + "-";
}

代码示例来源:origin: sohutv/cachecloud

public NamedThreadFactory(String prefix, boolean daemo) {
  mPrefix = prefix + "-thread-";
  mDaemo = daemo;
  SecurityManager s = System.getSecurityManager();
  mGroup = (s == null) ? Thread.currentThread().getThreadGroup() : s.getThreadGroup();
}

代码示例来源:origin: sohutv/cachecloud

public NamedThreadFactory(String prefix, boolean daemo) {
  mPrefix = prefix + "-thread-";
  mDaemo = daemo;
  SecurityManager s = System.getSecurityManager();
  mGroup = (s == null) ? Thread.currentThread().getThreadGroup() : s.getThreadGroup();
}

代码示例来源:origin: alibaba/jstorm

NettyRenameThreadFactory(String name) {
  SecurityManager s = System.getSecurityManager();
  group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
  this.name = name;
}

代码示例来源:origin: sohutv/cachecloud

public NamedThreadFactory(String prefix, boolean daemo) {
  mPrefix = prefix + "-thread-";
  mDaemo = daemo;
  SecurityManager s = System.getSecurityManager();
  mGroup = (s == null) ? Thread.currentThread().getThreadGroup() : s.getThreadGroup();
}

代码示例来源:origin: weibocom/motan

public DefaultThreadFactory(String prefix, boolean isDaemon, int priority) {
  SecurityManager s = System.getSecurityManager();
  this.threadGroup = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
  this.namePrefix = prefix + "-" + poolNumber.getAndIncrement() + "-thread-";
  this.isDaemon = isDaemon;
  this.priority = priority;
}

代码示例来源:origin: looly/hutool

/**
 * 获取当前线程的线程组
 * 
 * @return 线程组
 * @since 3.1.2
 */
public static ThreadGroup currentThreadGroup() {
  final SecurityManager s = System.getSecurityManager();
  return (null != s) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
}

代码示例来源:origin: objectbox/objectbox-java

ObjectBoxThreadFactory() {
  SecurityManager securityManager = System.getSecurityManager();
  group = (securityManager != null) ? securityManager.getThreadGroup() :
      Thread.currentThread().getThreadGroup();
}

代码示例来源:origin: looly/hutool

/**
 * 获取当前线程的线程组
 * 
 * @return 线程组
 * @since 3.1.2
 */
public static ThreadGroup currentThreadGroup() {
  final SecurityManager s = System.getSecurityManager();
  return (null != s) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
}

代码示例来源:origin: apache/hbase

public DaemonThreadFactory(String name) {
 SecurityManager s = System.getSecurityManager();
 group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
 namePrefix = name + poolNumber.getAndIncrement() + "-thread-";
}

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

@Override
public ThreadGroup getThreadGroup()
{
  return managerExists() ? securityManager.getThreadGroup() : super.getThreadGroup();
}

相关文章