private static synchronized IMqttClient getClient ( MqttSettings settings ) throws MqttException { if ( CLIENT == null ) { CLIENT = new MqttClient ( settings . getServerUrl ( ) , PUBLISHER_ID ) ; MqttConnectOptions options = new MqttConnectOptions ( ) ; options . setAutomaticReconnect ( true ) ; options . setCleanSession ( true ) ; options . setConnectionTimeout ( 10 ) ; CLIENT . connect ( options ) ; } return CLIENT ; }
Returns client instance