Skip to content

Commit cce2dad

Browse files
author
Alena Prokharchyk
committed
CLOUDSTACK-3458: network GC thread - acquire global lock to prevent multiple MS from running the GC thread on the network at the same time
1 parent e9dfb79 commit cce2dad

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎server/src/com/cloud/network/NetworkManagerImpl.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3016,9 +3016,23 @@ boolean checkIfIpAssocRequired(Network network, boolean postApplyRules, List<Pub
30163016
}
30173017

30183018
public class NetworkGarbageCollector implements Runnable {
3019-
30203019
@Override
30213020
public void run() {
3021+
GlobalLock gcLock = GlobalLock.getInternLock("Network.GC.Lock");
3022+
try {
3023+
if(gcLock.lock(3)) {
3024+
try {
3025+
reallyRun();
3026+
} finally {
3027+
gcLock.unlock();
3028+
}
3029+
}
3030+
} finally {
3031+
gcLock.releaseRef();
3032+
}
3033+
}
3034+
3035+
public void reallyRun() {
30223036
try {
30233037
List<Long> shutdownList = new ArrayList<Long>();
30243038
long currentTime = System.currentTimeMillis() >> 10;

0 commit comments

Comments
 (0)