Revision 59423
Added by Claudio Atzori over 3 years ago
modules/cnr-modular-mdstore-service/trunk/src/main/java/eu/dnetlib/data/mdstore/modular/MDStoreFeeder.java | ||
---|---|---|
66 | 66 |
//means the process was cancelled, so we must not commit |
67 | 67 |
log.warn(String.format("The feeding process on mdstore %s has been cancelled. Records will not be committed. Transaction %s set as invalid.", mdId, transactionId)); |
68 | 68 |
dao.invalidTransaction(transactionId, mdId); |
69 |
failCallback.call(new MDStoreServiceException(String.format("Feeding cancelled for mdstore %s on transaction %s", mdId, transactionId))); |
|
69 |
failCallback.call(new MDStoreServiceException(String.format("Feeding cancelled for mdstore %s on transaction %s", mdId, transactionId)), buildParams(mdstore.getSize(), writeOps));
|
|
70 | 70 |
} else { |
71 | 71 |
dao.commit(mdstore.getId(), mdId); |
72 | 72 |
int size = dao.refreshSize(mdId); |
... | ... | |
79 | 79 |
dao.invalidTransaction(transactionId, mdId); |
80 | 80 |
} |
81 | 81 |
log.error("Error feeding mdstore: " + mdId); |
82 |
failCallback.call(e); |
|
82 |
failCallback.call(e, Maps.newHashMap());
|
|
83 | 83 |
} |
84 | 84 |
} |
85 | 85 |
|
modules/cnr-modular-mdstore-service/trunk/src/main/java/eu/dnetlib/data/mdstore/modular/action/FailedCallback.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mdstore.modular.action; |
2 | 2 |
|
3 |
import java.util.Map; |
|
4 |
|
|
3 | 5 |
public interface FailedCallback { |
4 | 6 |
|
5 |
void call(Throwable e); |
|
7 |
void call(Throwable e, Map<String, String> params);
|
|
6 | 8 |
} |
modules/cnr-modular-mdstore-service/trunk/src/main/java/eu/dnetlib/data/mdstore/modular/action/FeedAction.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mdstore.modular.action; |
2 | 2 |
|
3 | 3 |
import java.util.List; |
4 |
import java.util.Map; |
|
4 | 5 |
|
5 | 6 |
import com.googlecode.sarasvati.GraphProcess; |
6 | 7 |
import eu.dnetlib.data.mdstore.MDStoreServiceException; |
... | ... | |
55 | 56 |
log.info(String.format("feeding mdstore %s from workflow process %s", mdId, processId)); |
56 | 57 |
|
57 | 58 |
feeder.feed(mdId, epr, storingType, true, mdformats, proc, params -> { |
58 |
job.getParameters().put("mdstoreSize", "" + params.get("mdstoreSize")); |
|
59 |
job.getParameters().put("writeOps", "" + params.get("writeOps")); |
|
60 |
completeWithSuccess(handler, job); |
|
61 |
}, e -> { |
|
62 |
log.error("Error feeding mdstore: " + mdId, e); |
|
63 |
completeWithFail(handler, job, e); |
|
64 |
}); |
|
59 |
job.getParameters().put("mdstoreSize", "" + params.get("mdstoreSize")); |
|
60 |
job.getParameters().put("writeOps", "" + params.get("writeOps")); |
|
61 |
completeWithSuccess(handler, job); |
|
62 |
}, (e, params) -> { |
|
63 |
log.error("Error feeding mdstore: " + mdId, e); |
|
64 |
job.getParameters().put("mdstoreSize", "" + params.get("mdstoreSize")); |
|
65 |
job.getParameters().put("writeOps", "" + params.get("writeOps")); |
|
66 |
completeWithFail(handler, job, e); |
|
67 |
}); |
|
65 | 68 |
} |
66 | 69 |
|
67 | 70 |
public MDStoreFeeder getFeeder() { |
Also available in: Unified diff
improved mdstore feeding failure