gpt4 book ai didi

java - 在 BTrace 中将 char[] 转换为 String

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:28:37 24 4
gpt4 key购买 nike

我正在使用 btrace 分析应用程序并面临限制。我尝试获取当前 java.lang.Thread 的名称。通常你可以调用 getName() 但它在 btrace 脚本中是被禁止的(任何调用异常 BTraceUtils)。
知道如何从 char[] 获取字符串吗?

最初的任务是检查线程名称是否包含子字符串,然后才注销跟踪信息(减少输出)。

最佳答案

一些可能对他人有帮助的信息:

https://btrace.dev.java.net/source/browse/btrace/docs/usersguide.html?rev=1.7

In particular, a BTrace class

  • can not create new objects.
  • can not create new arrays.
  • can not throw exceptions.
  • can not catch exceptions.
  • can not make arbitrary instance or static method calls - only the public static methods of com.sun.btrace.BTraceUtils class may be called from a BTrace program.
  • can not assign to static or instance fields of target program's classes and objects. But, BTrace class can assign to it's own static fields ("trace state" can be mutated).
  • can not have instance fields and methods. Only static public void returning methods are allowed for a BTrace class. And all fields have to be static.
  • can not have outer, inner, nested or local classes.
  • can not have synchronized blocks or synchronized methods.
  • can not have loops (for, while, do..while)
  • can not extend arbitrary class (super class has to be java.lang.Object)
  • can not implement interfaces.
  • can not contains assert statements.
  • can not use class literals.

http://btrace.kenai.com/javadoc/1.1/com/sun/btrace/BTraceUtils.html

关于java - 在 BTrace 中将 char[] 转换为 String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3055163/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com