[vlma-devel] commit: monitors: wait before computing in the main loop. (Adrien Grand )

git version control git at videolan.org
Sun Aug 17 22:21:16 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Aug 17 20:06:25 2008 +0200| [3bae152aefeeb735b9dd8023319d925a48bada3a] | committer: Adrien Grand 

monitors: wait before computing in the main loop.

In order the thread to stop as soon as possible whenever a Thread#interrupt
is performed.

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

 .../org/videolan/vlma/monitor/OrderMonitor.java    |    2 +-
 .../org/videolan/vlma/monitor/ServerMonitor.java   |    6 +++---
 .../videolan/vlma/monitor/ServerStateMonitor.java  |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java b/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java
index d486b6f..04eaa03 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java
@@ -146,13 +146,13 @@ public class OrderMonitor implements Monitor {
         public void run() {
             shouldRun = true;
             while (shouldRun) {
-                startOrderMonitoringThread();
                 // Wait before looping
                 try {
                     Thread.sleep(1000 * configuration.getInt("vlma.monitor.order.interval"));
                 } catch (InterruptedException e) {
 
                 }
+                startOrderMonitoringThread();
             }
             logger.info("OrderMonitor thread stopped.");
         }
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 777192f..b5775c1 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
@@ -93,13 +93,13 @@ public class ServerMonitor implements Monitor {
         public void run() {
             shouldRun = true;
             while (shouldRun) {
-                startUpdateSNMPDataThread();
                 try {
-                    //Then wait before looping
+                    // Wait before looping
                     Thread.sleep(1000 * (TIME_INTERVAL - (Util.getTime() % TIME_INTERVAL)));
                 } catch (InterruptedException e) {
-                    //Do nothing
+                    // Do nothing
                 }
+                startUpdateSNMPDataThread();
             }
             logger.info("ServerMonitor thread stopped.");
         }
diff --git a/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerStateMonitor.java b/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerStateMonitor.java
index 9b8880a..916257d 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerStateMonitor.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/monitor/ServerStateMonitor.java
@@ -87,13 +87,13 @@ public class ServerStateMonitor implements Monitor {
         public void run() {
             shouldRun = true;
             while (shouldRun) {
-                startCheckVLCThread();
                 try {
-                    //Then wait before looping
+                    // Wait before looping
                     Thread.sleep(1000 * configuration.getInt("vlma.monitor.server.interval"));
                 } catch (InterruptedException e) {
                     //Do nothing
                 }
+                startCheckVLCThread();
             }
             logger.info("ServerStateMonitor thread stopped.");
         }



More information about the vlma-devel mailing list