mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3458: network GC thread - acquire global lock to prevent multiple MS from running the GC thread on the network at the same time
This commit is contained in:
parent
a3660d8109
commit
3984287434
|
|
@ -3016,9 +3016,23 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
}
|
||||
|
||||
public class NetworkGarbageCollector implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
GlobalLock gcLock = GlobalLock.getInternLock("Network.GC.Lock");
|
||||
try {
|
||||
if(gcLock.lock(3)) {
|
||||
try {
|
||||
reallyRun();
|
||||
} finally {
|
||||
gcLock.unlock();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
gcLock.releaseRef();
|
||||
}
|
||||
}
|
||||
|
||||
public void reallyRun() {
|
||||
try {
|
||||
List<Long> shutdownList = new ArrayList<Long>();
|
||||
long currentTime = System.currentTimeMillis() / 1000 ;
|
||||
|
|
|
|||
Loading…
Reference in New Issue