/** * 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); } }
/** * Function called by dependency manager after "init ()" is called and after the services provided * by the class are registered in the service registry */ public void start() { logger.debug("Starting!"); /* * start a thread to handle event coming from the switch */ switchEventThread = new Thread(new EventHandler(), "SwitchEvent Thread"); switchEventThread.start(); // spawn a thread to start to listen on the open flow port controllerIO = new ControllerIO(this); try { controllerIO.start(); } catch (IOException ex) { logger.error("Caught exception while starting:", ex); } }