【发布时间】:2015-03-10 18:03:50
【问题描述】:
我正在尝试使用 Instrumentation 来计算 Web 应用程序中多个对象的内存使用量(准确地说,是基于请求)。
不幸的是,WebLogic 似乎没有插入静态 void premain 或 agentmain。
为了完整起见,这里是 Intrumentation 实例化类:
public class InstrumentationInstance {
private static Instrumentation instrumentation;
public static void premain(String args, Instrumentation ins){
instrumentation = ins;
}
public static void agentmain(String args, Instrumentation ins){
instrumentation = ins;
}
public static Instrumentation instrumentation(){
return instrumentation;
}
}
我尝试将这些添加到清单中,但 Instrumentation 仍然为空:
Manifest-Version: 1.0
Premain-Class: com.things.monitoring.InstrumentationInstance
Agent-Class: com.things.monitoring.InstrumentationInstance
Class-Path:
看起来这个应用程序需要使用 java 选项 -javaagent 启动,以便注意到 premain 和 agentmain 方法。我认为这将在web.xml/weblogic.xml 文件中完成?但我似乎找不到任何例子或证据表明如何......
【问题讨论】:
标签: java performance web-applications weblogic monitoring