Roy Golan has uploaded a new change for review.

Change subject: core: replace Date with long for time variable
......................................................................

core: replace Date with long for time variable

Change-Id: I50473b6fddaf06f2cedffb2a7c45a8507c1a7014
Signed-off-by: Roy Golan <rgo...@redhat.com>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
1 file changed, 5 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/45/7245/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
index 8c63fb8..a074e2e 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
@@ -23,7 +23,6 @@
 import 
org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import 
org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase;
-import org.ovirt.engine.core.compat.DateTime;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.compat.KeyValuePairCompat;
 import org.ovirt.engine.core.compat.TransactionScopeOption;
@@ -51,6 +50,9 @@
 
 public class VdsManager {
     private VDS _vds;
+    private long lastUpdate = System.currentTimeMillis();
+
+    private static Log log = LogFactory.getLog(VdsManager.class);
 
     protected VDS getVds() {
         return _vds;
@@ -90,8 +92,6 @@
             }
         }
     }
-
-    public DateTime mLastUpdate = DateTime.getNow();
 
     private final AtomicInteger mFailedToRunVmAttempts;
     private final AtomicInteger mUnrespondedAttempts;
@@ -233,7 +233,7 @@
                                     _vdsUpdater = new 
VdsUpdateRunTimeInfo(VdsManager.this, _vds);
                                     _vdsUpdater.Refresh();
                                     mUnrespondedAttempts.set(0);
-                                    mLastUpdate = DateTime.getNow();
+                                    lastUpdate = System.currentTimeMillis();
                                 }
                                 if (!getInitialized() && getVds().getstatus() 
!= VDSStatus.NonResponsive
                                         && getVds().getstatus() != 
VDSStatus.PendingApproval) {
@@ -598,8 +598,7 @@
     public boolean handleNetworkException(VDSNetworkException ex, VDS vds) {
         if (vds.getstatus() != VDSStatus.Down) {
             if (mUnrespondedAttempts.get() < Config.<Integer> 
GetValue(ConfigValues.VDSAttemptsToResetCount)
-                    || mLastUpdate.AddSeconds(Config.<Integer> 
GetValue(ConfigValues.TimeoutToResetVdsInSeconds))
-                            .compareTo(new java.util.Date()) > 0) {
+                    || lastUpdate + (Config.<Integer> 
GetValue(ConfigValues.TimeoutToResetVdsInSeconds) * 1000) > 
System.currentTimeMillis()) {
                 boolean result = false;
                 if (vds.getstatus() != VDSStatus.Connecting && vds.getstatus() 
!= VDSStatus.PreparingForMaintenance
                         && vds.getstatus() != VDSStatus.NonResponsive) {
@@ -668,7 +667,5 @@
     public boolean isSetNonOperationalExecuted() {
         return isSetNonOperationalExecuted;
     }
-
-    private static Log log = LogFactory.getLog(VdsManager.class);
 
 }


--
To view, visit http://gerrit.ovirt.org/7245
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50473b6fddaf06f2cedffb2a7c45a8507c1a7014
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <rgo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to