本文整理汇总了Java中com.sun.tools.hat.internal.oql.OQLEngine类的典型用法代码示例。如果您正苦于以下问题:Java OQLEngine类的具体用法?Java OQLEngine怎么用?Java OQLEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OQLEngine类属于com.sun.tools.hat.internal.oql包,在下文中一共展示了OQLEngine类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.sun.tools.hat.internal.oql.OQLEngine; //导入依赖的package包/类
public static void main(String[] args) throws IOException, OQLException {
final Snapshot snapshot = new NIOHeapLoader().load("C:/Projects/eclipse-mat/heap.bin");
// Snapshot snapshot = new HeapLoader().load("C:/Projects/eclipse-mat/heap.bin");
OQLEngine oqlEngine = new OQLEngine(snapshot);
CountingVisitor counter = new CountingVisitor();
ObjectVisitor inspector = new InspectingVisitor(oqlEngine, snapshot,
new JavaHeapObjectCallback() {
@Override public void run(JavaHeapObject obj, Accessor accessor) throws Exception {
if (obj.toString().contains("java.lang.Thread")) {
System.out.println("It is a thread!!");
System.out.println("NAME=" + accessor.asString("name", obj));
Map<String, JavaThing> fields = accessor.fields(obj);
for (String k : fields.keySet()) {
System.out.println(k + " = " + fields.get(k));
}
}
}
}
);
ObjectVisitor compositeVisitor = new CompositeVisitor(counter, inspector);
oqlEngine.executeQuery("select t from java.lang.Thread t", compositeVisitor);
if (counter.getCount() > 6) System.out.println("Too many threads!!!");
System.out.println(counter.getCount());
}
示例2: output
import com.sun.tools.hat.internal.oql.OQLEngine; //导入依赖的package包/类
private void output(Enumeration iterator, OQLEngine engine) throws Exception {
while (iterator.hasMoreElements()) {
Object o = iterator.nextElement();
JavaHeapObject unwrapped = (JavaHeapObject) engine.call("unwrapJavaObject", new Object[]{o});
System.out.println(o);
}
}
示例3: HttpReader
import com.sun.tools.hat.internal.oql.OQLEngine; //导入依赖的package包/类
public HttpReader (Socket s, Snapshot snapshot, OQLEngine engine) {
this.socket = s;
this.snapshot = snapshot;
this.engine = engine;
}
示例4: setModel
import com.sun.tools.hat.internal.oql.OQLEngine; //导入依赖的package包/类
public void setModel(Snapshot ss) {
this.snapshot = ss;
if (OQLEngine.isOQLSupported()) {
this.engine = new OQLEngine(ss);
}
}
示例5: InspectingVisitor
import com.sun.tools.hat.internal.oql.OQLEngine; //导入依赖的package包/类
public InspectingVisitor(OQLEngine engine, Snapshot snapshot, JavaHeapObjectCallback callback) {
this.engine = engine;
this.snapshot = snapshot;
this.callback = callback;
}
示例6: Accessor
import com.sun.tools.hat.internal.oql.OQLEngine; //导入依赖的package包/类
public Accessor(OQLEngine engine) {
this.engine = engine;
}