Search in sources :

Example 1 with OnMethod

use of com.sun.btrace.annotations.OnMethod in project Gargoyle by callakrsos.

the class SosRequestCapture method beforeDoRequest_entry.

@OnMethod(clazz = DS_CLASS, method = "doRequest", location = @Location(Kind.ENTRY))
public static void beforeDoRequest_entry(@Self Object obj) {
    println("beforeDoRequest");
    println(obj);
    println("Print Fields");
    BTraceUtils.printFields(obj);
    BTraceUtils.printFields(obj, true);
    println("Field");
    Class<?> classOf = BTraceUtils.classOf(obj);
    //		BTraceUtils.print(classOf);
    Class<?> superclass = BTraceUtils.getSuperclass(classOf);
    println("AbstractMain ::: #####");
    BTraceUtils.println(superclass);
    Class<?> superclass2 = BTraceUtils.getSuperclass(superclass);
    println("#####");
    println("AbstractScreen ::: #####");
    BTraceUtils.println(superclass2);
    println("#####1");
    Field field = BTraceUtils.field(superclass2, "abstractSVO");
    println("#####2");
    Object object = BTraceUtils.get(field, obj);
    println("#####3");
    println("AbstractSVO ::: #####");
    BTraceUtils.print(object);
    BTraceUtils.printFields(object);
    String xml = BTraceUtils.toXML(object);
    BTraceUtils.println(xml);
}
Also used : Field(java.lang.reflect.Field) OnMethod(com.sun.btrace.annotations.OnMethod)

Example 2 with OnMethod

use of com.sun.btrace.annotations.OnMethod in project btrace by btraceio.

the class VerifierVisitor method checkSampling.

private boolean checkSampling(MethodTree node) {
    TreePath mPath = verifier.getTreeUtils().getPath(verifier.getCompilationUnit(), node);
    ExecutableElement ee = (ExecutableElement) verifier.getTreeUtils().getElement(mPath);
    Sampled s = ee.getAnnotation(Sampled.class);
    OnMethod om = ee.getAnnotation(OnMethod.class);
    if (s != null && om != null) {
        Kind k = om.location().value();
        switch(k) {
            case ENTRY:
            case RETURN:
            case ERROR:
            case CALL:
                {
                    return true;
                }
            default:
                {
                // noop
                }
        }
        reportError("sampler.invalid.location", node);
        return false;
    }
    return true;
}
Also used : TreePath(com.sun.source.util.TreePath) Sampled(com.sun.btrace.annotations.Sampled) OnMethod(com.sun.btrace.annotations.OnMethod) ExecutableElement(javax.lang.model.element.ExecutableElement) Kind(com.sun.btrace.annotations.Kind) ElementKind(javax.lang.model.element.ElementKind)

Example 3 with OnMethod

use of com.sun.btrace.annotations.OnMethod in project btrace by btraceio.

the class ServicesTest method testSingletonService.

@OnMethod(clazz = "resources.OnMethodTest", method = "args$static")
public static void testSingletonService(String a, long b, String[] c, int[] d) {
    DummySimpleService ds = Service.simple("getInstance", DummySimpleService.class);
    ds.doit("hello", 10);
}
Also used : DummySimpleService(services.DummySimpleService) OnMethod(com.sun.btrace.annotations.OnMethod)

Example 4 with OnMethod

use of com.sun.btrace.annotations.OnMethod in project btrace by btraceio.

the class ServicesTest method testRuntimeService.

@OnMethod(clazz = "resources.OnMethodTest", method = "args")
public static void testRuntimeService(String a, long b, String[] c, int[] d) {
    DummyRuntimService ds = Service.runtime(DummyRuntimService.class);
    ds.doit(10, "hello");
}
Also used : DummyRuntimService(services.DummyRuntimService) OnMethod(com.sun.btrace.annotations.OnMethod)

Example 5 with OnMethod

use of com.sun.btrace.annotations.OnMethod in project btrace by btraceio.

the class ServicesTest method testSimpleService.

@OnMethod(clazz = "resources.OnMethodTest", method = "noargs")
public static void testSimpleService() {
    DummySimpleService ds = Service.simple(DummySimpleService.class);
    ds.doit("hello", 10);
}
Also used : DummySimpleService(services.DummySimpleService) OnMethod(com.sun.btrace.annotations.OnMethod)

Aggregations

OnMethod (com.sun.btrace.annotations.OnMethod)5 DummySimpleService (services.DummySimpleService)2 Kind (com.sun.btrace.annotations.Kind)1 Sampled (com.sun.btrace.annotations.Sampled)1 TreePath (com.sun.source.util.TreePath)1 Field (java.lang.reflect.Field)1 ElementKind (javax.lang.model.element.ElementKind)1 ExecutableElement (javax.lang.model.element.ExecutableElement)1 DummyRuntimService (services.DummyRuntimService)1