@@ -138,34 +138,35 @@ public void run() {
138
138
139
139
@ ServerPlugin (PluginConstants .PLUGIN_SERVER_OBJECT )
140
140
public void object (ObjectPack pack ) {
141
- if (pack .version != null && pack .version .length () > 0 ) {
142
- AlertPack p = null ;
143
- if (pack .wakeup == 0L ) {
141
+ if (pack .version != null && pack .version .length () > 0 ) {
142
+ AlertPack ap = null ;
143
+ ObjectPack op = AgentManager .getAgent (pack .objHash );
144
+
145
+ if (op == null && pack .wakeup == 0L ) {
144
146
// in case of new agent connected
145
- p = new AlertPack ();
146
- p .level = AlertLevel .INFO ;
147
- p .objHash = pack .objHash ;
148
- p .title = "An object has been activated." ;
149
- p .message = pack .objName + " is connected." ;
150
- p .time = System .currentTimeMillis ();
151
- p .objType = "scouter" ;
147
+ ap = new AlertPack ();
148
+ ap .level = AlertLevel .INFO ;
149
+ ap .objHash = pack .objHash ;
150
+ ap .title = "An object has been activated." ;
151
+ ap .message = pack .objName + " is connected." ;
152
+ ap .time = System .currentTimeMillis ();
153
+ ap .objType = "scouter" ;
152
154
153
- alert (p );
154
- } else if (pack .alive == false ) {
155
+ alert (ap );
156
+ } else if (op .alive == false ) {
155
157
// in case of agent reconnected
156
- p = new AlertPack ();
157
- p .level = AlertLevel .INFO ;
158
- p .objHash = pack .objHash ;
159
- p .title = "An object has been activated." ;
160
- p .message = pack .objName + " is reconnected." ;
161
- p .time = System .currentTimeMillis ();
162
- p .objType = "scouter" ;
158
+ ap = new AlertPack ();
159
+ ap .level = AlertLevel .INFO ;
160
+ ap .objHash = pack .objHash ;
161
+ ap .title = "An object has been activated." ;
162
+ ap .message = pack .objName + " is reconnected." ;
163
+ ap .time = System .currentTimeMillis ();
164
+ ap .objType = "scouter" ;
163
165
164
- alert (p );
165
- }
166
-
166
+ alert (ap );
167
+ }
167
168
// inactive state can be handled in alert() method.
168
- }
169
+ }
169
170
}
170
171
171
172
private void println (Object o ) {
0 commit comments