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
|
private final Collection<CandidateHarvesterSetElement> elements
|
||||||
= new LinkedList<CandidateHarvesterSetElement>();
|
= new LinkedList<CandidateHarvesterSetElement>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pool of thread used for gathering process.
|
||||||
|
*/
|
||||||
|
private static ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>CandidateHarvesterSet</tt> instance.
|
* Initializes a new <tt>CandidateHarvesterSet</tt> instance.
|
||||||
*/
|
*/
|
||||||
@ -82,10 +87,7 @@ public class CandidateHarvesterSet
|
|||||||
{
|
{
|
||||||
synchronized (elements)
|
synchronized (elements)
|
||||||
{
|
{
|
||||||
harvest(
|
harvest(elements.iterator(), component, threadPool);
|
||||||
elements.iterator(),
|
|
||||||
component,
|
|
||||||
Executors.newCachedThreadPool());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -96,9 +96,9 @@ public class UPNPHarvester
|
|||||||
wanIPThread.start();
|
wanIPThread.start();
|
||||||
wanPPPThread.start();
|
wanPPPThread.start();
|
||||||
|
|
||||||
while(finishThreads != 2)
|
synchronized(rootSync)
|
||||||
{
|
{
|
||||||
synchronized(rootSync)
|
while(finishThreads != 2)
|
||||||
{
|
{
|
||||||
rootSync.wait();
|
rootSync.wait();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -246,6 +246,7 @@ class Connector
|
|||||||
synchronized(sockLock)
|
synchronized(sockLock)
|
||||||
{
|
{
|
||||||
this.running = false;
|
this.running = false;
|
||||||
|
this.sock.close();
|
||||||
this.sock = null;
|
this.sock = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user