*
*/
public void stop() {
-
for (Iterator<Entry<Long, ISwitch>> it = switches.entrySet().iterator(); it
.hasNext();) {
Entry<Long, ISwitch> entry = it.next();
it.remove();
}
switchEventThread.interrupt();
- controllerIO.shutDown();
+ try {
+ controllerIO.shutDown();
+ } catch (IOException ex) {
+ logger.error("Caught exception: " + ex + " during stop");
+ }
}
/**
switchHandler.start();
logger.info(instanceName + " connected: " + sc.toString());
} catch (IOException e) {
- logger
- .error("Caught I/O Exception when trying to accept a new connection");
return;
}
}
serverSelectionKey);
}
}
- } catch (IOException e) {
- logger.error("Caught I/O Exception: " + e.toString());
- return;
+ } catch (Exception e) {
+ continue;
}
}
}
logger.info("Controller is now listening on port " + openFlowPort);
}
- public void shutDown() {
+ public void shutDown() throws IOException {
this.running = false;
this.selector.wakeup();
- try {
- this.serverSocket.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
+ this.serverSocket.close();
}
}
package org.opendaylight.controller.protocol_plugin.openflow.core.internal;
-import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
handleMessages();
}
}
- } catch (IOException e) {
- logger.error("Caught I/O Exception: " + e.toString());
- e.printStackTrace();
+ } catch (Exception e) {
+ reportError(e);
}
}
}
this.clientSelectionKey.cancel();
this.socket.close();
executor.shutdown();
- } catch (IOException e) {
- logger.error("Caught IOException in stop()");
+ } catch (Exception e) {
+ // do nothing since we are shutting down.
+ return;
}
}
this.selector, SelectionKey.OP_WRITE, this);
}
logger.trace("Message sent: " + msg.toString());
- } catch (IOException e) {
+ } catch (Exception e) {
reportError(e);
}
}
this.clientSelectionKey = this.socket.register(
this.selector, SelectionKey.OP_READ, this);
}
- } catch (IOException e) {
+ } catch (Exception e) {
reportError(e);
}
}
int bytesRead;
try {
bytesRead = socket.read(inBuffer);
- } catch (IOException e) {
+ } catch (Exception e) {
reportError(e);
return null;
}