public void run() { if(!executed) { executed = true; requests.remove(requestId); if(heartBeatMonitor!=null) { heartBeatMonitor.stop(); heartBeatMonitor = null; } transport.stop(new Task() { @Override public void run() { listener.onDisconnected(); if (onComplete != null) { onComplete.onSuccess(null); } } }); } } };
/** * Kills the connection without a graceful disconnect. * @param onComplete */ public void kill(final Callback<Void> onComplete) { if( disconnected ) { if(onComplete!=null){ onComplete.onSuccess(null); } return; } disconnected = true; if(heartBeatMonitor!=null) { heartBeatMonitor.stop(); heartBeatMonitor = null; } transport.stop(new Task() { @Override public void run() { listener.onDisconnected(); if (onComplete != null) { onComplete.onSuccess(null); } } }); }
void handleSessionFailure(Throwable error) { // Socket failure, should we try to reconnect? if( !disconnected && (mqtt.reconnectAttemptsMax<0 || reconnects < mqtt.reconnectAttemptsMax ) ) { mqtt.tracer.debug("Reconnecting transport"); // Cleanup the previous transport. if(heartBeatMonitor!=null) { heartBeatMonitor.stop(); heartBeatMonitor = null; } final Transport t = transport; transport = null; if(t!=null) { t.stop(new Task() { @Override public void run() { listener.onDisconnected(); reconnect(); } }); } else { reconnect(); } } else { // nope. handleFatalFailure(error); } }
public void run() { if(!executed) { executed = true; requests.remove(requestId); if(heartBeatMonitor!=null) { heartBeatMonitor.stop(); heartBeatMonitor = null; } transport.stop(new Task() { @Override public void run() { listener.onDisconnected(); if (onComplete != null) { onComplete.onSuccess(null); } } }); } } };
/** * Kills the connection without a graceful disconnect. * @param onComplete */ public void kill(final Callback<Void> onComplete) { if( disconnected ) { if(onComplete!=null){ onComplete.onSuccess(null); } return; } disconnected = true; if(heartBeatMonitor!=null) { heartBeatMonitor.stop(); heartBeatMonitor = null; } transport.stop(new Task() { @Override public void run() { listener.onDisconnected(); if (onComplete != null) { onComplete.onSuccess(null); } } }); }
void handleSessionFailure(Throwable error) { // Socket failure, should we try to reconnect? if( !disconnected && (mqtt.reconnectAttemptsMax<0 || reconnects < mqtt.reconnectAttemptsMax ) ) { mqtt.tracer.debug("Reconnecting transport"); // Cleanup the previous transport. if(heartBeatMonitor!=null) { heartBeatMonitor.stop(); heartBeatMonitor = null; } final Transport t = transport; transport = null; if(t!=null) { t.stop(new Task() { @Override public void run() { listener.onDisconnected(); reconnect(); } }); } else { reconnect(); } } else { // nope. handleFatalFailure(error); } }
public void on_transport_disconnected() { if (!closed) { closed = true; dead = true; command_handler = dead_handler; security_context.logout(toScala(new UnitFn1<Throwable>() { @Override public void call(Throwable e) { if (e != null) { connection_log.info(e, "MQTT connection '%s' log out error: %s", security_context.remote_address(), e.toString()); } } })); heart_beat_monitor.stop(); if (!connection().stopped()) { connection().stop(NOOP); } log.trace("mqtt protocol resources released"); } }