Commit ddc648c6 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Thread runs only when enabled and also when module is started.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4201 b35dd754-fafc-0310-a699-88a17e54d16e
parent c53d65a3
...@@ -102,9 +102,7 @@ public class UpdateManager extends BasicModule { ...@@ -102,9 +102,7 @@ public class UpdateManager extends BasicModule {
Thread.sleep(15000); Thread.sleep(15000);
// Load last saved information (if any) // Load last saved information (if any)
loadSavedInfo(); loadSavedInfo();
while (true) { while (isServiceEnabled()) {
// Check if the service is enabled
if (isServiceEnabled()) {
waitForNextChecking(); waitForNextChecking();
// Check if the service is still enabled // Check if the service is still enabled
if (isServiceEnabled()) { if (isServiceEnabled()) {
...@@ -122,11 +120,6 @@ public class UpdateManager extends BasicModule { ...@@ -122,11 +120,6 @@ public class UpdateManager extends BasicModule {
} }
} }
} }
else {
// Service is not enabled so sleep for 5 minutes
Thread.sleep(300000);
}
}
} }
catch (InterruptedException e) { catch (InterruptedException e) {
Log.error(e); Log.error(e);
...@@ -306,6 +299,9 @@ public class UpdateManager extends BasicModule { ...@@ -306,6 +299,9 @@ public class UpdateManager extends BasicModule {
*/ */
public void setServiceEnabled(boolean enabled) { public void setServiceEnabled(boolean enabled) {
JiveGlobals.setProperty("update.service-enabled", enabled ? "true" : "false"); JiveGlobals.setProperty("update.service-enabled", enabled ? "true" : "false");
if (enabled && thread == null) {
startService();
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment