1 |
26600
|
sandro.lab
|
package eu.dnetlib.data.information.oai.publisher.core;
|
2 |
|
|
|
3 |
|
|
import org.aopalliance.intercept.MethodInvocation;
|
4 |
|
|
import org.apache.commons.logging.Log;
|
5 |
|
|
import org.springframework.aop.interceptor.CustomizableTraceInterceptor;
|
6 |
|
|
|
7 |
|
|
/**
|
8 |
|
|
* This class intercepts calls to the OAICore to measure its execution time. It uses Spring AOP.
|
9 |
|
|
*
|
10 |
|
|
* @author alessia
|
11 |
|
|
*
|
12 |
|
|
*/
|
13 |
|
|
public class CoreInterceptor extends CustomizableTraceInterceptor {
|
14 |
|
|
|
15 |
|
|
private static final long serialVersionUID = -9063818317778608736L;
|
16 |
|
|
|
17 |
|
|
@Override
|
18 |
|
|
protected void writeToLog(final Log logger, final String message, final Throwable ex) {
|
19 |
|
|
if (ex != null) {
|
20 |
29828
|
alessia.ba
|
logger.error(message, ex);
|
21 |
26600
|
sandro.lab
|
} else {
|
22 |
29828
|
alessia.ba
|
logger.debug(message);
|
23 |
26600
|
sandro.lab
|
}
|
24 |
|
|
}
|
25 |
|
|
|
26 |
29828
|
alessia.ba
|
@Override
|
27 |
26600
|
sandro.lab
|
protected boolean isInterceptorEnabled(final MethodInvocation invocation, final Log logger) {
|
28 |
|
|
return true;
|
29 |
|
|
}
|
30 |
|
|
}
|