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;
  }
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

@param settings settings
@return client instance
@throws MqttException thrown when MQTT client construction fails