Hi,
I want to implement a server interceptor to collect how much time used in server side from message received to process complete.
so i write a server interceptor which return a SimpleForwardingServerCallListener which have a long field. then i record the start time in the onMessage method, set it to the long field and calculate the total time used in onComplete by using this field value.
it's basically like this:
return new SimpleForwardingServerCallListener(...){
private long start;
public void onMesage(...){
start = System.currentTimeMillis();
.....
}
public void onComplete(...){
log.info("time used:", System.currentTimeMillis() - start);
.....
}
}
is this implementation correct? is there any thread-safe issue here?
Thanks!