public void run(){
  final String methodName="run";
  MqttToken token=null;
  while (running && (in != null)) {
    try {
      log.fine(CLASS_NAME,methodName,"852");
      receiving=in.available() > 0;
      MqttWireMessage message=in.readMqttWireMessage();
      receiving=false;
      if (message instanceof MqttAck) {
        token=tokenStore.getToken(message);
        if (token != null) {
synchronized (token) {
            clientState.notifyReceivedAck((MqttAck)message);
          }
        }
 else {
          throw new MqttException(MqttException.REASON_CODE_UNEXPECTED_ERROR);
        }
      }
 else {
        clientState.notifyReceivedMsg(message);
      }
    }
 catch (    MqttException ex) {
      log.fine(CLASS_NAME,methodName,"856",null,ex);
      running=false;
      clientComms.shutdownConnection(token,ex);
    }
catch (    IOException ioe) {
      log.fine(CLASS_NAME,methodName,"853");
      running=false;
      if (!clientComms.isDisconnecting()) {
        clientComms.shutdownConnection(token,new MqttException(MqttException.REASON_CODE_CONNECTION_LOST,ioe));
      }
    }
 finally {
      receiving=false;
    }
  }
  log.fine(CLASS_NAME,methodName,"854");
}

public void run ( ) { final String methodName = "run" ; MqttToken token = null ; while ( running && ( in != null ) ) { try { log . fine ( CLASS_NAME , methodName , "852" ) ; receiving = in . available ( ) > 0 ; MqttWireMessage message = in . readMqttWireMessage ( ) ; receiving = false ; if ( message instanceof MqttAck ) { token = tokenStore . getToken ( message ) ; if ( token != null ) { synchronized ( token ) { clientState . notifyReceivedAck ( ( MqttAck ) message ) ; } } else { throw new MqttException ( MqttException . REASON_CODE_UNEXPECTED_ERROR ) ; } } else { clientState . notifyReceivedMsg ( message ) ; } } catch ( MqttException ex ) { log . fine ( CLASS_NAME , methodName , "856" , null , ex ) ; running = false ; clientComms . shutdownConnection ( token , ex ) ; } catch ( IOException ioe ) { log . fine ( CLASS_NAME , methodName , "853" ) ; running = false ; if ( ! clientComms . isDisconnecting ( ) ) { clientComms . shutdownConnection ( token , new MqttException ( MqttException . REASON_CODE_CONNECTION_LOST , ioe ) ) ; } } finally { receiving = false ; } } log . fine ( CLASS_NAME , methodName , "854" ) ; }
run loop to receive messages from the server .
