Revision b83b73a7
Added by Andreas Kohlbecker about 4 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/springframework/remoting/httpinvoker/CachingHttpInvokerProxyFactoryBean.java | ||
---|---|---|
28 | 28 |
* <p> |
29 | 29 |
* <b>Performance measurement:</b></br> |
30 | 30 |
* Supports measuring the request processing time at the client side. Setting "{@value #PROP_KEY_MEASURE_DURATION}" |
31 |
* as system parameter enables the measurement. To make the measurements appear in the log, the log <code>Level</code> |
|
32 |
* for this class needs to be set to at least {@link org.apache.log4j.Level#INFO} |
|
31 |
* as system parameter enables the measurement. To make the measurements appear for each request in the log, the logging <code>Level</code> |
|
32 |
* for <code>HttpInvokerProxyFactoryBean</code> needs to be set to at least {@link org.apache.log4j.Level#INFO}. Otherwise the duration is |
|
33 |
* only reported in case of errors. |
|
33 | 34 |
* |
34 | 35 |
* |
35 | 36 |
* @author a.kohlbecker |
... | ... | |
150 | 151 |
if(measureDuration){ |
151 | 152 |
startTime = System.currentTimeMillis(); |
152 | 153 |
} |
153 |
RemoteInvocationResult result = super.executeRequest(invocation, originalInvocation); |
|
154 |
if(measureDuration){ |
|
155 |
double duration = System.currentTimeMillis() - startTime; |
|
156 |
logger.info(getServiceUrl() + "#" + invocation.getMethodName() + " [" + duration + " ms]"); |
|
154 |
try { |
|
155 |
RemoteInvocationResult result = super.executeRequest(invocation, originalInvocation); |
|
156 |
if(measureDuration){ |
|
157 |
double duration = System.currentTimeMillis() - startTime; |
|
158 |
logger.info(getServiceUrl() + "#" + invocation.getMethodName() + " [" + duration + " ms]"); |
|
159 |
} |
|
160 |
return result; |
|
161 |
} catch(Exception e) { |
|
162 |
if(measureDuration){ |
|
163 |
double duration = System.currentTimeMillis() - startTime; |
|
164 |
logger.error("(" + e.getClass().getName() + ": \"" + e.getMessage() + "\") interrupts " + getServiceUrl() + "#" + invocation.getMethodName() + " after [" + duration + " ms]"); |
|
165 |
} |
|
166 |
throw e; |
|
157 | 167 |
} |
158 |
return result; |
|
159 | 168 |
} |
160 | 169 |
|
161 | 170 |
/** |
Also available in: Unified diff
ref #8812 logging of request duration in case of socket timeouts