[vlma-devel] commit: Synchronization fix. (Adrien Grand )

git version control git at videolan.org
Wed Aug 6 23:05:12 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Wed Aug  6 22:18:02 2008 +0200| [c18ee97597c485a9d1aa287937b13b24943203fc] | committer: Adrien Grand 

Synchronization fix.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=c18ee97597c485a9d1aa287937b13b24943203fc
---

 .../java/org/videolan/vlma/VLMaServiceImpl.java    |    4 ++--
 .../org/videolan/vlma/monitor/ServerMonitor.java   |   10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
index afc17a4..9c3219d 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
@@ -773,7 +773,7 @@ public class VLMaServiceImpl implements VLMaService {
         return rrdR.getPath();
     }
 
-    synchronized public void updateSnmpData(Server server) {
+    public void updateSnmpData(Server server) {
         String rrdFile;
         try {
             rrdFile = createRrdFileIfNecessary(server);
@@ -829,7 +829,7 @@ public class VLMaServiceImpl implements VLMaService {
         }
     }
 
-    synchronized public void updateRrdGraph(Server server) {
+    public void updateRrdGraph(Server server) {
         RrdGraph rrdGraph;
         long startTime, endTime = Util.getTime();
         startTime = endTime - 3600 * 24;
diff --git a/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerMonitor.java b/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerMonitor.java
index eb84d6f..777192f 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerMonitor.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerMonitor.java
@@ -64,10 +64,12 @@ public class ServerMonitor implements Monitor {
      */
     Runnable snmpDataUpdater = new Runnable() {
         public void run() {
-            for (Server server : vlmaService.getServers()) {
-                logger.debug("Update RRD file of " + server.getName());
-                vlmaService.updateSnmpData(server);
-                vlmaService.updateRrdGraph(server);
+            synchronized(ServerMonitor.this) {
+                for (Server server : vlmaService.getServers()) {
+                    logger.debug("Update RRD file of " + server.getName());
+                    vlmaService.updateSnmpData(server);
+                    vlmaService.updateRrdGraph(server);
+                }
             }
         }
     };



More information about the vlma-devel mailing list