Shut down harvester thread pool when it's done. (#223)
* Shut down harvester thread pool when it's done. * Use ExecutorService to create harvester threads; name thread pool threads to match other ice4j threads.
This commit is contained in:
parent
34c2ce50ec
commit
5a299cd694
@ -17,6 +17,7 @@ package org.ice4j.ice.harvest;
|
|||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
import org.jetbrains.annotations.*;
|
import org.jetbrains.annotations.*;
|
||||||
|
import org.jitsi.utils.concurrent.*;
|
||||||
|
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -283,8 +284,11 @@ public class MappingCandidateHarvesters
|
|||||||
|
|
||||||
// Now run discover() on all created harvesters in parallel and pick
|
// Now run discover() on all created harvesters in parallel and pick
|
||||||
// the ones which succeeded.
|
// the ones which succeeded.
|
||||||
ExecutorService es = Executors.newFixedThreadPool(tasks.size());
|
ExecutorService es = ExecutorFactory.createFixedThreadPool(tasks.size(),
|
||||||
|
"ice4j.Harvester-executor-");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
List<Future<StunMappingCandidateHarvester>> futures;
|
List<Future<StunMappingCandidateHarvester>> futures;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -318,7 +322,11 @@ public class MappingCandidateHarvesters
|
|||||||
throw new RuntimeException(ie);
|
throw new RuntimeException(ie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
es.shutdown();
|
||||||
|
}
|
||||||
return stunHarvesters;
|
return stunHarvesters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user