Minor fix for Paho perf groovy scripts

This commit is contained in:
andrea
2015-06-02 16:37:01 +02:00
parent d1a8a79525
commit 1eb47dec6a
4 changed files with 18 additions and 4 deletions
@@ -25,7 +25,7 @@ MqttClient client = new MqttClient("tcp://${host}:1883", "PublisherClient", data
//connOptions.password = 'password' as char[]
//Only for Apollo ---
//client.connect(connOptions)
client.connect(connOptions)
client.connect()
MqttMessage message = new MqttMessage('Hello world!!'.bytes)
message.setQos(0)
print "publishing..${numToSend} messages, "
@@ -17,9 +17,9 @@ class SubscriberCallback implements MqttCallback {
int m_numReceived = 0
long m_startTime
boolean firstMessageReceived = false
private CountDownLatch m_latch = new CountDownLatch(1)
void waitFinish() {
m_latch.await()
}
@@ -39,7 +39,6 @@ class SubscriberCallback implements MqttCallback {
long spentTime = stopTime - m_startTime
println "/exit received"
println "subscriber disconnected, received ${m_numReceived} messages in ${spentTime} ms"
client.disconnect()
m_latch.countDown()
} else {
//println "-received ${message} on ${topic} with QoS ${message.qos}"
@@ -79,3 +78,4 @@ client.subscribe("/exit", 0)
println "subscribed to /exit"
callback.waitFinish()
client.diconnect()