146 |
|
} |
147 |
|
}); |
148 |
|
try { |
149 |
– |
_heartbeatTimer = new PacketTimer("Next Heartbeat", Integer.parseInt(Configuration.getInstance().getServerProperty("Host." + hostName, "Host.TCPUpdateTime"))); |
149 |
|
_dataTimer = new PacketTimer("Next Data", Integer.parseInt(Configuration.getInstance().getServerProperty("Host." + hostName, "Host.UDPUpdateTime"))); |
150 |
|
} catch (NumberFormatException e) { |
151 |
< |
throw new NumberFormatException("unable to obtain a valid value for Host.UDP/TCPUpdateTime"); |
151 |
> |
throw new NumberFormatException("unable to obtain a valid value for Host.UDPUpdateTime"); |
152 |
|
} |
153 |
< |
_north.setLayout(new GridLayout(2,1)); |
154 |
< |
JPanel top1 = new JPanel(new GridLayout(1,1)); |
155 |
< |
top1.add(new JLabel("Showing data from - " + hostName, JLabel.CENTER)); |
156 |
< |
_north.add(top1); |
158 |
< |
JPanel top2 = new JPanel(new GridLayout(1,3)); |
159 |
< |
top2.add(_dataTimer); |
160 |
< |
top2.add(info); |
161 |
< |
top2.add(_heartbeatTimer); |
162 |
< |
_north.add(top2); |
153 |
> |
_north.setLayout(new GridLayout(3,1)); |
154 |
> |
_north.add(new JLabel("Showing data from - " + hostName, JLabel.CENTER)); |
155 |
> |
_north.add(_dataTimer); |
156 |
> |
_north.add(info); |
157 |
|
|
158 |
|
|
159 |
|
JPanel date = new JPanel(); |
307 |
|
// set that everything is ok so far |
308 |
|
boolean displaySucessful = true; |
309 |
|
|
316 |
– |
// a simple way to handle heatbeats - this WILL change |
317 |
– |
if ((packet.getParam("packet.attributes.type")).equals("heartbeat")) { |
318 |
– |
_heartbeatTimer.reset(); |
319 |
– |
if(_heartbeatTimerThread == null){ |
320 |
– |
_heartbeatTimerThread = new Thread(_heartbeatTimer); |
321 |
– |
_heartbeatTimerThread.start(); |
322 |
– |
} |
323 |
– |
displaySucessful = processPacket(packet); |
324 |
– |
|
310 |
|
// must be a normal data packet, update the display |
311 |
< |
} else if((packet.getParam("packet.attributes.type")).equals("data")) { |
311 |
> |
if((packet.getParam("packet.attributes.type")).equals("data")) { |
312 |
|
displaySucessful = processPacket(packet); |
313 |
|
_dataTimer.reset(); |
314 |
|
if(_dataTimerThread == null){ |
501 |
|
private final JPanel _center = new JPanel(); |
502 |
|
|
503 |
|
/** |
519 |
– |
* The countdown timer for heartbeats |
520 |
– |
*/ |
521 |
– |
private final PacketTimer _heartbeatTimer; |
522 |
– |
|
523 |
– |
/** |
504 |
|
* The countdown timer for normal data packets |
505 |
|
*/ |
506 |
|
private final PacketTimer _dataTimer; |
527 |
– |
|
528 |
– |
/** |
529 |
– |
* A place for the heartbeat timer thread |
530 |
– |
*/ |
531 |
– |
private Thread _heartbeatTimerThread = null; |
507 |
|
|
508 |
|
/** |
509 |
|
* A place for the data timer thread |