cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seb...@apache.org
Subject [39/50] git commit: updated refs/heads/sdnextensions to bcfb4e6
Date Fri, 12 Jul 2013 07:51:34 GMT
CLOUDSTACK-3458: network GC thread - acquire global lock to prevent multiple MS from running
the GC thread on the network at the same time


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/39842874
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/39842874
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/39842874

Branch: refs/heads/sdnextensions
Commit: 398428743484bbacc1d99bf60ae253d36c4c153b
Parents: a3660d8
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Wed Jul 10 16:27:31 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu Jul 11 09:37:57 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/NetworkManagerImpl.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/39842874/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index e322c9d..dbd3c1d 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -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 ;


Mime
View raw message