[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [paho-dev] Paho Java: NullPointerException when reconnecting
|
Just a quick followup on this:
So you should be good to go ahead and use a SNAPSHOT build.
Kind regards,
James Sutton Software Engineer - IoT Foundation - MQTT Open Source Projects Ops Team - Wimbledon Project |
|
| ![IBM]() Hursley Park Hursley, SO212JN United Kingdom |
IBM United Kingdom Limited Registered in England and Wales with number 741598 Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU
----- Original message -----
From: Yohei Onishi <Onishi_Yohei@xxxxxxxxxxxxx>
Sent by: paho-dev-bounces@xxxxxxxxxxx
To: paho-dev@xxxxxxxxxxx
Cc:
Subject: [paho-dev] Paho Java: NullPointerException when reconnecting
Date: Tue, Nov 29, 2016 2:50 AM
Hi All,
I have a basic question about how to use the reconnect method on
MqttClient and MqttClient. Is the reconnect method on MqttClient and
MqttClient only for Paho's atumatic connect?
It is not mentioned in the documents, so this was a little bit confusing.
When I call this method in the connectionLost callback (MqttCallback),
it seems that NullPointerException happens in the
MqttAsyncClient::stopReconnectCycle.
--- connectionLost callback in my cose
@Override
public void connectionLost(Throwable cause) {
try {
sampleClient.reconnect(); // null pointer exception
} catch (MqttException e) {
e.printStackTrace();
}
}
---
NullPointerException is thrown when MqttAsyncClient tries to cancel the
reconnectTimer because this is initialized only if atumatic connect is
true. The exception is caught in CommsCallback's connectionLost, so the
execption does not propagate.
---
private void stopReconnectCycle(){
String methodName = "stopReconnectCycle";
//@Trace 504=Stop reconnect timer for client: {0}
log.fine(CLASS_NAME, methodName, "504", new Object[]{this.clientId});
reconnectTimer.cancel();
reconnectDelay = 1000; // Reset Delay Timer
}
---
Thanks,
Yohei
--
Yohei Onishi
OGIS-RI Co.,Ltd.
Tel: 050-3367-1634
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU