1
|
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
|
logger.error(message, ex);
|
21
|
} else {
|
22
|
logger.debug(message);
|
23
|
}
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
protected boolean isInterceptorEnabled(final MethodInvocation invocation, final Log logger) {
|
28
|
return true;
|
29
|
}
|
30
|
}
|