Applies first part of Carl Hasselskog patch: UPnP potential deadlock, Connector closing, CandidateHarvesterSet thread pool merged.
This commit is contained in:
parent
0ee1c41582
commit
8f51251658
@ -36,6 +36,11 @@ public class CandidateHarvesterSet
|
||||
private final Collection<CandidateHarvesterSetElement> elements
|
||||
= new LinkedList<CandidateHarvesterSetElement>();
|
||||
|
||||
/**
|
||||
* A pool of thread used for gathering process.
|
||||
*/
|
||||
private static ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||
|
||||
/**
|
||||
* Initializes a new <tt>CandidateHarvesterSet</tt> instance.
|
||||
*/
|
||||
@ -82,10 +87,7 @@ public class CandidateHarvesterSet
|
||||
{
|
||||
synchronized (elements)
|
||||
{
|
||||
harvest(
|
||||
elements.iterator(),
|
||||
component,
|
||||
Executors.newCachedThreadPool());
|
||||
harvest(elements.iterator(), component, threadPool);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -96,9 +96,9 @@ public class UPNPHarvester
|
||||
wanIPThread.start();
|
||||
wanPPPThread.start();
|
||||
|
||||
while(finishThreads != 2)
|
||||
synchronized(rootSync)
|
||||
{
|
||||
synchronized(rootSync)
|
||||
while(finishThreads != 2)
|
||||
{
|
||||
rootSync.wait();
|
||||
}
|
||||
|
||||
@ -246,6 +246,7 @@ class Connector
|
||||
synchronized(sockLock)
|
||||
{
|
||||
this.running = false;
|
||||
this.sock.close();
|
||||
this.sock = null;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user