@@ -48,7 +48,8 @@ public class Digest
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
// first compute the digests for all the resources in parallel
|
// first compute the digests for all the resources in parallel
|
||||||
Executor exec = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
ExecutorService exec = Executors.newFixedThreadPool(
|
||||||
|
Runtime.getRuntime().availableProcessors());
|
||||||
final Map<Resource, String> digests = new ConcurrentHashMap<>();
|
final Map<Resource, String> digests = new ConcurrentHashMap<>();
|
||||||
final BlockingQueue<Object> completed = new LinkedBlockingQueue<>();
|
final BlockingQueue<Object> completed = new LinkedBlockingQueue<>();
|
||||||
final int fversion = version;
|
final int fversion = version;
|
||||||
@@ -71,6 +72,9 @@ public class Digest
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// queue a shutdown of the thread pool when the tasks are done
|
||||||
|
exec.shutdown();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (pending.size() > 0) {
|
while (pending.size() > 0) {
|
||||||
Object done = completed.poll(600, TimeUnit.SECONDS);
|
Object done = completed.poll(600, TimeUnit.SECONDS);
|
||||||
|
|||||||
Reference in New Issue
Block a user