public void run(){
  try {
    if (index == 0) {
      sendMessageToUI("Starting Pump info request...",true);
    }
    if (wThread.retries >= MedtronicConstants.NUMBER_OF_RETRIES) {
      mHandler3.removeCallbacks(wThread);
synchronized (reader.sendingCommandLock) {
        reader.sendingCommand=false;
      }
synchronized (reader.waitingCommandLock) {
        reader.waitingCommand=false;
        reader.lastCommandSend=null;
      }
synchronized (reader.processingCommandLock) {
        reader.processingCommand=false;
      }
      sendMessageToUI("Timeout expired executing command list",false);
synchronized (reader.processingCommandLock) {
        reader.processingCommand=false;
      }
synchronized (reader.waitingCommandLock) {
        reader.waitingCommand=false;
        reader.lastCommandSend=null;
      }
      return;
    }
    if (index >= commandList.length) {
synchronized (reader.processingCommandLock) {
        reader.processingCommand=false;
      }
synchronized (reader.waitingCommandLock) {
        reader.waitingCommand=false;
        reader.lastCommandSend=null;
      }
      return;
    }
    if (withoutConfirmation <= 0) {
synchronized (reader.waitingCommandLock) {
        reader.waitingCommand=true;
        reader.lastCommandSend=null;
      }
    }
 else {
synchronized (reader.waitingCommandLock) {
        reader.waitingCommand=false;
        reader.lastCommandSend=null;
      }
    }
    byte command=commandList[index];
    wThread.retries=-1;
    wThread.command=command;
    wThread.instance=this;
    mHandler3.post(wThread);
    index++;
  }
 catch (  Exception e) {
    StringBuffer sb1=new StringBuffer("");
    sb1.append("EXCEPTION!!!!!! " + e.getMessage() + " "+ e.getCause());
    for (    StackTraceElement st : e.getStackTrace()) {
      sb1.append(st.toString());
    }
    sendMessageToUI(sb1.toString(),false);
  }
}

public void run ( ) { try { if ( index == 0 ) { sendMessageToUI ( "Starting Pump info request..." , true ) ; } if ( wThread . retries >= MedtronicConstants . NUMBER_OF_RETRIES ) { mHandler3 . removeCallbacks ( wThread ) ; synchronized ( reader . sendingCommandLock ) { reader . sendingCommand = false ; } synchronized ( reader . waitingCommandLock ) { reader . waitingCommand = false ; reader . lastCommandSend = null ; } synchronized ( reader . processingCommandLock ) { reader . processingCommand = false ; } sendMessageToUI ( "Timeout expired executing command list" , false ) ; synchronized ( reader . processingCommandLock ) { reader . processingCommand = false ; } synchronized ( reader . waitingCommandLock ) { reader . waitingCommand = false ; reader . lastCommandSend = null ; } return ; } if ( index >= commandList . length ) { synchronized ( reader . processingCommandLock ) { reader . processingCommand = false ; } synchronized ( reader . waitingCommandLock ) { reader . waitingCommand = false ; reader . lastCommandSend = null ; } return ; } if ( withoutConfirmation <= 0 ) { synchronized ( reader . waitingCommandLock ) { reader . waitingCommand = true ; reader . lastCommandSend = null ; } } else { synchronized ( reader . waitingCommandLock ) { reader . waitingCommand = false ; reader . lastCommandSend = null ; } } byte command = commandList [ index ] ; wThread . retries = - 1 ; wThread . command = command ; wThread . instance = this ; mHandler3 . post ( wThread ) ; index ++ ; } catch ( Exception e ) { StringBuffer sb1 = new StringBuffer ( "" ) ; sb1 . append ( "EXCEPTION!!!!!! " + e . getMessage ( ) + " " + e . getCause ( ) ) ; for ( StackTraceElement st : e . getStackTrace ( ) ) { sb1 . append ( st . toString ( ) ) ; } sendMessageToUI ( sb1 . toString ( ) , false ) ; } }
runnable method , it tries to send all the commands in " commanlist " , in order to do that , it creates a second handler calling writerthread to manage the command send .
