com.sun.jersey.spi.monitoring
Interface MonitoringProvider


public interface MonitoringProvider

Provider for "monitoring" calls.

Methods are called right before some event happens, statistics are not generated by default, you have to register MonitoringProvider via MonitoringProviderAdapter and compute them by yourself. Id parameter is context ID, which is equal for events generated from processing single request (starts with requestStart and ends with requestEnd). Context IDs might be reused.

RequestStart and requestEnd are called during processing every request. Other methods might not be called, for example resource method might not be found.

Metrics examples:

Total Invocation count - count number of requestStart calls

Average Invocation Count - Total invocation count / server uptime

Last Invoke Clock Time - remember when requestStart was called

Total Execution Time - ? what exactly is this supposed to mean ? - remember time period between reqestStart and requestEnd call (and add it to some total sum)

Average Time per invoke - Total Execution Time / Total Invocation count?

Execution Time Low - shortest invocation time

Execution Time High - longest invocation time

Total Error Count - count number of requestEnd calls

Average Error Count per Period - Total Error Count / Period

Last Error Detail - remember last Exception from requestEnd call

Last Error Clock Time - remember when error(Exception ex) was called

Author:
Jakub.Podlesak@Oracle.Com

Method Summary
 void error(long id, java.lang.Throwable ex)
          Called when exception is thrown during dispatching and not mapped via ExceptionMapper.
 void requestEnd(long id, javax.servlet.http.HttpServletResponse response)
          Called when Jersey has finalized response and handles it back to container.
 void requestResourceMethodPreDispatch(long id, AbstractResourceMethod method)
          Called right before resource method invocation.
 void requestStart(long id, javax.servlet.http.HttpServletRequest request)
          Called when Jersey receives request from lower layer.
 void requestSubResourcePreDispatch(long id, java.lang.Class subResource)
          Called when Jersey finds suitable sub resource which will be used during request processing.
 

Method Detail

requestStart

void requestStart(long id,
                  javax.servlet.http.HttpServletRequest request)
Called when Jersey receives request from lower layer.

Parameters:
id - Context ID.
request - request instance. It MUST NOT be modified.

requestSubResourcePreDispatch

void requestSubResourcePreDispatch(long id,
                                   java.lang.Class subResource)
Called when Jersey finds suitable sub resource which will be used during request processing.

Parameters:
id - Context ID.
subResource - class representing matched sub resource.

requestResourceMethodPreDispatch

void requestResourceMethodPreDispatch(long id,
                                      AbstractResourceMethod method)
Called right before resource method invocation.

Parameters:
id - Context ID.
method - method used for dispatching. It MUST NOT be modified.

error

void error(long id,
           java.lang.Throwable ex)
Called when exception is thrown during dispatching and not mapped via ExceptionMapper.

Parameters:
id - Context ID.
ex - thrown exception.

requestEnd

void requestEnd(long id,
                javax.servlet.http.HttpServletResponse response)
Called when Jersey has finalized response and handles it back to container.

Parameters:
id - Context ID.
response - response instance. It MUST NOT be modified.


Copyright © 2011 Oracle Corporation. All Rights Reserved.