@@ -591,6 +591,7 @@ public boolean updateState(Status oldStatus, Event event, Status newStatus, Host
591591 SearchBuilder <HostVO > sb = createSearchBuilder ();
592592 sb .and ("status" , sb .entity ().getStatus (), SearchCriteria .Op .EQ );
593593 sb .and ("id" , sb .entity ().getId (), SearchCriteria .Op .EQ );
594+ sb .and ("update" , sb .entity ().getUpdated (), SearchCriteria .Op .EQ );
594595 if (newStatus .checkManagementServer ()) {
595596 sb .and ("ping" , sb .entity ().getLastPinged (), SearchCriteria .Op .EQ );
596597 sb .and ().op ("nullmsid" , sb .entity ().getManagementServerId (), SearchCriteria .Op .NULL );
@@ -603,11 +604,14 @@ public boolean updateState(Status oldStatus, Event event, Status newStatus, Host
603604
604605 sc .setParameters ("status" , oldStatus );
605606 sc .setParameters ("id" , host .getId ());
607+ sc .setParameters ("update" , host .getUpdated ());
608+ long oldUpdateCount = host .getUpdated ();
606609 if (newStatus .checkManagementServer ()) {
607610 sc .setParameters ("ping" , oldPingTime );
608611 sc .setParameters ("msid" , host .getManagementServerId ());
609612 }
610613
614+ long newUpdateCount = host .incrUpdated ();
611615 UpdateBuilder ub = getUpdateBuilder (host );
612616 ub .set (host , _statusAttr , newStatus );
613617 if (newStatus .updateManagementServer ()) {
@@ -636,17 +640,19 @@ public boolean updateState(Status oldStatus, Event event, Status newStatus, Host
636640 str .append ("; Old=[status=" ).append (oldStatus .toString ()).append (":msid=" ).append (host .getManagementServerId ()).append (":lastpinged=" )
637641 .append (oldPingTime ).append ("]" );
638642 str .append ("; DB=[status=" ).append (vo .getStatus ().toString ()).append (":msid=" ).append (vo .getManagementServerId ()).append (":lastpinged=" )
639- .append (vo .getLastPinged ()).append ("]" );
643+ .append (vo .getLastPinged ()).append (":old update count=" ). append ( oldUpdateCount ). append ( " ]" );
640644 status_logger .debug (str .toString ());
645+ } else {
646+ StringBuilder msg = new StringBuilder ("Agent status update: [" );
647+ msg .append ("hostId = " + host .getId ());
648+ msg .append ("; old status = " + oldStatus );
649+ msg .append ("; event = " + event );
650+ msg .append ("; new status = " + newStatus );
651+ msg .append ("; old update count = " + oldUpdateCount );
652+ msg .append ("; new update count = " + newUpdateCount + "]" );
653+ status_logger .debug (msg .toString ());
641654 }
642655
643- StringBuilder msg = new StringBuilder ("Agent status update: [" );
644- msg .append ("hostId = " + host .getId ());
645- msg .append ("; old status = " + oldStatus );
646- msg .append ("; event = " + event );
647- msg .append ("; new status = " + newStatus + "]" );
648- status_logger .debug (msg .toString ());
649-
650656 return result > 0 ;
651657 }
652658
0 commit comments