Revision 48139
Added by Alessia Bardi over 6 years ago
SwitchIndexesJobNode.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
/** |
13 | 13 |
* SwitchIndexesJobNode guides the index switches on all search services whose ids are in the queue available in the parameter named 'searchService_ids'. |
14 |
* |
|
15 |
* @author claudio, alessia |
|
14 | 16 |
* @see eu.dnetlib.msro.openaireplus.workflows.nodes.index.FindSearchServicesJobNode |
15 | 17 |
* @see eu.dnetlib.msro.openaireplus.workflows.nodes.index.SwitchIndexJobNode |
16 |
* |
|
17 |
* @author claudio, alessia |
|
18 |
* |
|
19 | 18 |
*/ |
20 | 19 |
public class SwitchIndexesJobNode extends SimpleJobNode { |
21 | 20 |
|
... | ... | |
24 | 23 |
@Override |
25 | 24 |
protected String execute(final NodeToken token) throws Exception { |
26 | 25 |
Queue<String> q = (Queue<String>) token.getEnv().getTransientAttribute("searchService_ids"); |
27 |
log.debug("Got the searchService_ids queue: "+q.toString());
|
|
28 |
if(q == null) throw new MSROException("Transient param 'searchService_ids' with queue of string could not be found"); |
|
29 |
if(q.isEmpty()) { |
|
26 |
log.debug("Got the searchService_ids queue: " + q.toString());
|
|
27 |
if (q == null) throw new MSROException("Transient param 'searchService_ids' with queue of string could not be found");
|
|
28 |
if (q.isEmpty()) {
|
|
30 | 29 |
log.info("searchService_ids queue consumed, now ending cycle"); |
31 | 30 |
return Arc.DEFAULT_ARC; |
32 |
} |
|
33 |
else{ |
|
31 |
} else { |
|
34 | 32 |
//we have something to do: setting the xqueryForServiceIdParam for the SwitchIndexJobNode |
35 | 33 |
String id = q.poll(); |
36 |
log.debug("Polled id: "+id);
|
|
37 |
log.debug("And now the queue is "+q);
|
|
34 |
log.debug("Polled id: " + id);
|
|
35 |
log.debug("And now the queue is " + q);
|
|
38 | 36 |
token.getEnv().setAttribute("search_service_ID", id); |
39 |
log.debug("Asking to switch on profile with id: "+id);
|
|
37 |
log.debug("Asking to switch on profile with id: " + id);
|
|
40 | 38 |
//updating the queue for next iteration |
41 | 39 |
token.getEnv().setTransientAttribute("searchService_ids", q); |
42 | 40 |
return "switch"; |
43 | 41 |
} |
44 | 42 |
} |
45 | 43 |
|
46 |
|
|
47 | 44 |
} |
Also available in: Unified diff
integrated (hopefully) all required changes from dnet40