Revision 40094
Added by Michele Artini over 8 years ago
ProcessCountingResultSetListener.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.List; |
4 | 4 |
|
5 |
import com.google.common.collect.Lists; |
|
6 | 5 |
import eu.dnetlib.enabling.resultset.ResultSet; |
7 | 6 |
import eu.dnetlib.enabling.resultset.ResultSetAware; |
8 | 7 |
import eu.dnetlib.enabling.resultset.ResultSetListener; |
9 | 8 |
import eu.dnetlib.enabling.resultset.rmi.ResultSetException; |
10 | 9 |
import eu.dnetlib.enabling.resultset.rmi.ResultSetService; |
11 |
import eu.dnetlib.msro.workflows.procs.WorkflowProcess;
|
|
10 |
import eu.dnetlib.msro.workflows.graph.Process;
|
|
12 | 11 |
import org.apache.commons.lang.StringUtils; |
13 | 12 |
import org.apache.commons.logging.Log; |
14 | 13 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
21 | 20 |
*/ |
22 | 21 |
private static final Log log = LogFactory.getLog(ProcessCountingResultSetListener.class); |
23 | 22 |
private int count; |
24 |
private WorkflowProcess process;
|
|
23 |
private Process process; |
|
25 | 24 |
private ResultSetService inputService; |
26 | 25 |
private String inputRsId; |
27 | 26 |
private ResultSet outputResulset; |
28 | 27 |
private int inputSize; |
29 | 28 |
private boolean inaccurate = false; |
30 | 29 |
|
31 |
public ProcessCountingResultSetListener(final WorkflowProcess process, final ResultSetService inputService, final String inputRsId)
|
|
30 |
public ProcessCountingResultSetListener(final Process process, final ResultSetService inputService, final String inputRsId) |
|
32 | 31 |
throws ResultSetException { |
33 | 32 |
super(); |
34 | 33 |
this.process = process; |
... | ... | |
40 | 39 |
|
41 | 40 |
@Override |
42 | 41 |
public List<String> getResult(final int from, final int to) { |
43 |
if (process.isCanceled()) {
|
|
42 |
if (process.getStatus() == Process.Status.KILLED) {
|
|
44 | 43 |
this.outputResulset.close(); |
45 |
return Lists.newArrayList();
|
|
44 |
throw new RuntimeException("The workflow has been killed");
|
|
46 | 45 |
} |
47 | 46 |
try { |
48 | 47 |
this.count = to; |
... | ... | |
58 | 57 |
|
59 | 58 |
@Override |
60 | 59 |
public int getSize() { |
61 |
if (process.isCanceled()) {
|
|
60 |
if (process.getStatus() == Process.Status.KILLED) {
|
|
62 | 61 |
this.outputResulset.close(); |
63 | 62 |
return count; |
64 | 63 |
} |
Also available in: Unified diff
partial reimplementation of the wf engine