java.lang.Thread.toString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(127)

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

Thread.toString介绍

[英]Returns a string representation of this thread, including the thread's name, priority, and thread group.
[中]返回此线程的字符串表示形式,包括线程的名称、优先级和线程组。

代码示例

代码示例来源:origin: cucumber/cucumber-jvm

GroupData(Thread thread) {
    id = thread.getId();
    content = thread.toString();
  }
}

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

@Override
public void onCreate (final SurfaceHolder surfaceHolder) {
  if (DEBUG)
    Log.d(TAG, " > AndroidWallpaperEngine - onCreate() " + hashCode() + " running: " + engines + ", linked: "
      + (linkedEngine == this) + ", thread: " + Thread.currentThread().toString());
  super.onCreate(surfaceHolder);
}

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

@Override
public void onCreate (final SurfaceHolder surfaceHolder) {
  if (DEBUG)
    Log.d(TAG, " > AndroidWallpaperEngine - onCreate() " + hashCode() + " running: " + engines + ", linked: "
      + (linkedEngine == this) + ", thread: " + Thread.currentThread().toString());
  super.onCreate(surfaceHolder);
}

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

static public String stringDoubleCheck() {
  if (s == null) {
    synchronized (lock) {
      if (s == null)
        s = Thread.currentThread().toString();
    }
  }
  return s;
}

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

public LogRecord() {
 super();
 _millis = System.currentTimeMillis();
 _category = "Debug";
 _message = "";
 _level = LogLevel.INFO;
 _sequenceNumber = getNextId();
 _thread = Thread.currentThread().toString();
 _ndc = "";
 _location = "";
}

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

/**
 * The Constructor.
 * @param thread The Thread to capture.
 */
BasicThreadInformation(final Thread thread) {
  this.id = thread.getId();
  this.name = thread.getName();
  this.longName = thread.toString();
  this.state = thread.getState();
  this.priority = thread.getPriority();
  this.isAlive = thread.isAlive();
  this.isDaemon = thread.isDaemon();
  final ThreadGroup group = thread.getThreadGroup();
  threadGroupName = group == null ? null : group.getName();
}

代码示例来源:origin: ronmamo/reflections

public void run() {
    if (log != null) {
      log.debug("[{}] scanning {}", Thread.currentThread().toString(), url);
    }
    scan(url);
  }
}));

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

@ManagedOperation(description="Lists the in-flight threads")
protected String printInFlightThreads() {
  StringBuilder sb=new StringBuilder();
  for(Thread thread: in_flight_threads.keySet())
    sb.append(thread.toString()).append("\n");
  return sb.toString();
}

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

@Override
public String toString() {
  return "ReqContext{" +
      "realPrincipal=" + ((realPrincipal != null) ? realPrincipal.getName() : "null") +
      ", reqID=" + reqID +
      ", remoteAddr=" + remoteAddr +
      ", authZPrincipal=" + ((principal() != null) ? principal().getName() : "null") +
      ", ThreadId=" + Thread.currentThread().toString() +
      '}';
}

代码示例来源:origin: org.reflections/reflections

public void run() {
    if (log != null && log.isDebugEnabled()) log.debug("[" + Thread.currentThread().toString() + "] scanning " + url);
    scan(url);
  }
}));

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void uncaughtException(Thread thread, Throwable thrown) {
    listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown);
  }
});

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void uncaughtException(Thread thread, Throwable thrown) {
    listener.handleError("Exception thrown in " + thread.toString(), thrown);
  }
});

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void uncaughtException(Thread thread, Throwable thrown) {
    listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown);
  }
});

代码示例来源:origin: btraceio/btrace

private static String stackTraceAllStr(int numFrames, boolean printWarning) {
  Set<Map.Entry<Thread, StackTraceElement[]>> traces =
      Thread.getAllStackTraces().entrySet();
  StringBuilder buf = new StringBuilder();
  for (Map.Entry<Thread, StackTraceElement[]> t : traces) {
    buf.append(t.getKey().toString());
    buf.append(LINE_SEPARATOR);
    buf.append(LINE_SEPARATOR);
    StackTraceElement[] st = t.getValue();
    buf.append(stackTraceStr("\t", st, 0, numFrames, printWarning));
    buf.append(LINE_SEPARATOR);
  }
  return buf.toString();
}

代码示例来源:origin: oracle/helidon

@Override
  public String format(LogRecord record) {
    String message = super.format(record);

    return THREAD_PATTERN.matcher(message).replaceAll(Thread.currentThread().toString());
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
  public void uncaughtException(Thread thread, Throwable thrown) {
    listener.handleError("Uncaught exception thrown in " + thread.toString(), thrown);
    if (needClose.get()) {
      // listener.handleError() has requested the
      // context to close. Satisfy request.
      deinitInThread();
    }
  }
});

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void uncaughtException(Thread thread, Throwable thrown) {
    listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown);
    if (needClose.get()){
      // listener.handleError() has requested the
      // context to close. Satisfy request.
      deinitInThread();
    }
  }
});

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

}).toString(); //indent:4 exp:4

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

listener.handleError("Uncaught exception thrown in " + thread.toString(), thrown);
if (needClose.get()) {

代码示例来源:origin: ReactiveX/RxJava

assertTrue(unsubscribeThread.toString(), unsubscribeThread == uiEventLoop.getThread());

相关文章