本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitchListener.removedSwitch方法的典型用法代码示例。如果您正苦于以下问题:Java IOFSwitchListener.removedSwitch方法的具体用法?Java IOFSwitchListener.removedSwitch怎么用?Java IOFSwitchListener.removedSwitch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.core.IOFSwitchListener
的用法示例。
在下文中一共展示了IOFSwitchListener.removedSwitch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}",
sw, switchUpdateType);
}
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
switch(switchUpdateType) {
case ADDED:
listener.addedSwitch(sw);
break;
case REMOVED:
listener.removedSwitch(sw);
break;
case PORTCHANGED:
listener.switchPortChanged(sw.getId());
break;
}
}
}
}
示例2: dispatch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
@Override
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}",
sw, switchUpdateType);
}
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
switch(switchUpdateType) {
case ADDED:
listener.addedSwitch(sw);
break;
case REMOVED:
listener.removedSwitch(sw);
break;
case PORTCHANGED:
listener.switchPortChanged(sw.getId());
break;
}
}
}
}
示例3: addSwitch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
/**
* Add a switch to the active switch list and call the switch listeners.
* This happens either when a switch first connects (and the controller is
* not in the slave role) or when the role of the controller changes from
* slave to master.
* @param sw the switch that has been added
*/
// TODO: need to rethink locking and the synchronous switch update.
// We can / should also handle duplicate DPIDs in connectedSwitches
@LogMessageDoc(level="ERROR",
message="New switch added {switch} for already-added switch {switch}",
explanation="A switch with the same DPID as another switch " +
"connected to the controller. This can be caused by " +
"multiple switches configured with the same DPID, or " +
"by a switch reconnected very quickly after " +
"disconnecting.",
recommendation="If this happens repeatedly, it is likely there " +
"are switches with duplicate DPIDs on the network. " +
"Reconfigure the appropriate switches. If it happens " +
"very rarely, then it is likely this is a transient " +
"network problem that can be ignored."
)
protected void addSwitch(IOFSwitch sw) {
// TODO: is it safe to modify the HashMap without holding
// the old switch's lock?
OFSwitchImpl oldSw = (OFSwitchImpl) this.activeSwitches.put(sw.getId(), sw);
if (sw == oldSw) {
// Note == for object equality, not .equals for value
log.info("New add switch for pre-existing switch {}", sw);
return;
}
if (oldSw != null) {
oldSw.getListenerWriteLock().lock();
try {
log.error("New switch added {} for already-added switch {}",
sw, oldSw);
// Set the connected flag to false to suppress calling
// the listeners for this switch in processOFMessage
oldSw.setConnected(false);
oldSw.cancelAllStatisticsReplies();
updateInactiveSwitchInfo(oldSw);
// we need to clean out old switch state definitively
// before adding the new switch
// FIXME: It seems not completely kosher to call the
// switch listeners here. I thought one of the points of
// having the asynchronous switch update mechanism was so
// the addedSwitch and removedSwitch were always called
// from a single thread to simplify concurrency issues
// for the listener.
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
listener.removedSwitch(oldSw);
}
}
// will eventually trigger a removeSwitch(), which will cause
// a "Not removing Switch ... already removed debug message.
// TODO: Figure out a way to handle this that avoids the
// spurious debug message.
oldSw.getChannel().close();
}
finally {
oldSw.getListenerWriteLock().unlock();
}
}
updateActiveSwitchInfo(sw);
SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.ADDED);
try {
this.updates.put(update);
} catch (InterruptedException e) {
log.error("Failure adding update to queue", e);
}
}