示例#1
0
  public void closeDown(boolean unregisterClassifier) {
    FVLog.log(LogLevel.DEBUG, this, "tearing down");
    this.isShutdown = true;
    this.loop.unregister(this.sock, this);
    if (this.sock != null) {
      try {
        this.sock.close(); // FIXME will this also cancel() the key in
        // the event loop?
      } catch (IOException e) {
        // ignore if error... we're shutting down already
      }
    }
    // tell the classifier to forget about us
    if (unregisterClassifier) fvClassifier.tearDownSlice(this.sliceName);

    this.msgStream = null; // force this to GC, in case we have a memleak on
    // "this"

    HashMap<String, Object> info = this.getStatusInfo();
    TopologyController tc = TopologyController.getRunningInstance();
    if (tc != null)
      tc.sliceConnectionJustChanged(info, TopologyCallback.EventType.SLICE_DISCONNECTED);
    SliceImpl.removeListener(sliceName, this);
    FlowvisorImpl.removeListener(this);
  }