读书人

btrace事例

发布时间: 2013-07-09 09:50:47 作者: rapoo

btrace例子

@BTracepublic class OracleTimeoutTracer {    @OnMethod(clazz = "oracle.net.nt.ConnStrategy", method = "createSocketOptions", location = @Location(value = Kind.ENTRY))    public static void strategy(@Self Object self, Properties paramProperties) {        println(str(paramProperties));    }    @OnMethod(clazz = "oracle.net.nt.TcpNTAdapter", method = "connect", location = @Location(value = Kind.ENTRY))    public static void adapter(@Self Object self) {        Field socketTimeoutField = field("oracle.net.nt.TcpNTAdapter", "sockTimeout");        Field hostField = field("oracle.net.nt.TcpNTAdapter", "host");        Field portField = field("oracle.net.nt.TcpNTAdapter", "port");        int scoketTimeout = (Integer) get(socketTimeoutField, self);        int port = (Integer) get(portField, self);        String host = (String) get(hostField, self);        println(strcat(strcat(strcat(strcat(strcat("host : ", host), ", port : "), str(port)), " , socketTimeout : "),                       str(scoketTimeout)));    }}

?

读书人网 >其他相关

热点推荐