1
|
package eu.dnetlib.index.actors;
|
2
|
|
3
|
import eu.dnetlib.enabling.resultset.client.ResultSetClient;
|
4
|
import eu.dnetlib.index.action.BBParam;
|
5
|
import eu.dnetlib.rmi.common.ResultSet;
|
6
|
import org.apache.commons.logging.Log;
|
7
|
import org.apache.commons.logging.LogFactory;
|
8
|
import org.quartz.Job;
|
9
|
import org.quartz.JobExecutionContext;
|
10
|
import org.quartz.JobExecutionException;
|
11
|
|
12
|
public class ResultsetKeepAliveJob implements Job {
|
13
|
|
14
|
public static final String JOB_NAME = "resultsetKeepaliveJob";
|
15
|
public static final String JOB_GROUP = "keepalive";
|
16
|
private static final Log log = LogFactory.getLog(ResultsetKeepAliveJob.class); // NOPMD by marko on 11/24/08 5:02 PM
|
17
|
|
18
|
private ResultSetClient resultSetClient;
|
19
|
|
20
|
@Override
|
21
|
public void execute(final JobExecutionContext context) throws JobExecutionException {
|
22
|
|
23
|
final String rsEpr = (String) context.getTrigger().getJobDataMap().get(BBParam.RS_EPR);
|
24
|
|
25
|
ResultSet<?> resultSet = ResultSet.fromJson(rsEpr);
|
26
|
try {
|
27
|
log.debug("\n\n keepalive resultset: " + resultSet.getId() + " triggerId: " + context.getTrigger().getCalendarName() + "\n\n");
|
28
|
|
29
|
// TODO: change to a getRSStatus call, getNumberOfElements could be potentially slow (ticket #1569)
|
30
|
resultSetClient.info(resultSet);
|
31
|
} catch (Throwable e) {
|
32
|
log.warn("couldn't invoke the resultset call to keep-it-alive");
|
33
|
throw new RuntimeException(e);
|
34
|
}
|
35
|
}
|
36
|
|
37
|
public ResultSetClient getResultSetClient() {
|
38
|
return resultSetClient;
|
39
|
}
|
40
|
|
41
|
public void setResultSetClient(final ResultSetClient resultSetClient) {
|
42
|
this.resultSetClient = resultSetClient;
|
43
|
}
|
44
|
}
|