Fix latch & catch InterruptedException
@@ -139,12 +139,13 @@ public class SingleRowIdentificationTask extends AbstractTask {
List<MsSpectrum> ms2list = processRawScan(rawfile, ms2index);
SiriusIdentificationMethod siriusMethod = processSirius(ms1list, ms2list);
- List<IonAnnotation> items = siriusMethod.getResult();
+ List<IonAnnotation> items = siriusMethod.getResult(); // TODO: use a HEAP to sort items
+ //TODO SORT ITEMS BY FINGERID SCORE
if (rowContainsMsMs(ms2index)) {
- fingerTasks = new LinkedList<>();
- //TODO SORT ITEMS BY FINGERID SCORE
+ try {
items = new LinkedList<>();
+ fingerTasks = new LinkedList<>();
CountDownLatch latch = new CountDownLatch(siriusMethod.getResult().size());
Ms2Experiment experiment = siriusMethod.getExperiment();
@@ -161,9 +162,18 @@ public class SingleRowIdentificationTask extends AbstractTask {
MZmineCore.getTaskController().addTask(task);
}
- Thread.sleep(1000);
+ latch.await();
+ for (FingerIdWebMethodTask t : fingerTasks) {
+ items.addAll(t.getResults());
}
+ Thread.sleep(1000);
+ } catch (InterruptedException interrupt) {
+ logger.error("Processing of FingerWebMethods were interrupted");
+ interrupt.printStackTrace();
+ items = siriusMethod.getResult();
+ }
+ }
addListItems(window, items);
setStatus(TaskStatus.FINISHED);
