/**
  * Function called by the dependency manager before the services exported by the component are
  * unregistered, this will be followed by a "destroy ()" calls
  */
 public void stop() {
   for (Iterator<Entry<Long, ISwitch>> it = switches.entrySet().iterator(); it.hasNext(); ) {
     Entry<Long, ISwitch> entry = it.next();
     ((SwitchHandler) entry.getValue()).stop();
     it.remove();
   }
   switchEventThread.interrupt();
   try {
     controllerIO.shutDown();
   } catch (IOException ex) {
     logger.error("Caught exception while stopping:", ex);
   }
 }