forked from D-Net/dnet-hadoop
following the comment on the pull requests:
- Added #NUM_OF_THREADS complete job in the queue at the end of the main loop to avoid deadlock
This commit is contained in:
parent
a712df1e1d
commit
915a76a796
|
@ -135,7 +135,6 @@ public class ORCIDWorker extends Thread {
|
||||||
orcidId = queue.take();
|
orcidId = queue.take();
|
||||||
|
|
||||||
if (orcidId.equalsIgnoreCase(JOB_COMPLETE)) {
|
if (orcidId.equalsIgnoreCase(JOB_COMPLETE)) {
|
||||||
queue.put(orcidId);
|
|
||||||
hasComplete = true;
|
hasComplete = true;
|
||||||
} else {
|
} else {
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
|
|
|
@ -155,15 +155,17 @@ public class OrcidGetUpdatesFile {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
queue.put(ORCIDWorker.JOB_COMPLETE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 22; i++) {
|
||||||
|
queue.put(ORCIDWorker.JOB_COMPLETE);
|
||||||
|
}
|
||||||
for (ORCIDWorker worker : workers) {
|
for (ORCIDWorker worker : workers) {
|
||||||
worker.join();
|
worker.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue