本文整理汇总了Java中net.floodlightcontroller.core.IOFConnection.write方法的典型用法代码示例。如果您正苦于以下问题:Java IOFConnection.write方法的具体用法?Java IOFConnection.write怎么用?Java IOFConnection.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.core.IOFConnection
的用法示例。
在下文中一共展示了IOFConnection.write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import net.floodlightcontroller.core.IOFConnection; //导入方法依赖的package包/类
@Override
public Collection<OFMessage> write(Iterable<OFMessage> msgList, LogicalOFMessageCategory category) {
IOFConnection conn = this.getConnection(category); /* do first to check for supported category */
Collection<OFMessage> validMsgs = new ArrayList<OFMessage>();
Collection<OFMessage> invalidMsgs = SwitchRoleMessageValidator.pruneInvalidMessages(
msgList, validMsgs, this.getOFFactory().getVersion(), this.isActive());
if (log.isDebugEnabled()) {
log.debug("MESSAGES: {}, VALID: {}, INVALID: {}", new Object[] { msgList, validMsgs, invalidMsgs});
}
/* Try to write all valid messages */
Collection<OFMessage> unsent = conn.write(validMsgs);
for (OFMessage m : validMsgs) {
if (!unsent.contains(m)) {
switchManager.handleOutgoingMessage(this, m);
}
}
/* Collect invalid and unsent messages */
Collection<OFMessage> ret = null;
if (!unsent.isEmpty()) {
log.warn("Could not send messages {} due to channel disconnection on switch {}", unsent, this.getId());
ret = IterableUtils.toCollection(unsent);
}
if (!invalidMsgs.isEmpty()) {
log.warn("Could not send messages {} while in SLAVE role on switch {}", invalidMsgs, this.getId());
if (ret == null) {
ret = IterableUtils.toCollection(invalidMsgs);
} else {
ret.addAll(IterableUtils.toCollection(invalidMsgs));
}
}
if (ret == null) {
return Collections.emptyList();
} else {
return ret;
}
}
示例2: write
import net.floodlightcontroller.core.IOFConnection; //导入方法依赖的package包/类
@Override
public Collection<OFMessage> write(Iterable<OFMessage> msgList, LogicalOFMessageCategory category) {
IOFConnection conn = this.getConnection(category); /* do first to check for supported category */
Collection<OFMessage> validMsgs = new ArrayList<OFMessage>();
Collection<OFMessage> invalidMsgs = SwitchRoleMessageValidator.pruneInvalidMessages(
msgList, validMsgs, this.getOFFactory().getVersion(), this.isActive());
if (log.isDebugEnabled()) {
log.debug("MESSAGES: {}, VALID: {}, INVALID: {}", new Object[] { msgList, validMsgs, invalidMsgs});
}
/* Try to write all valid messages */
Collection<OFMessage> unsent = conn.write(validMsgs);
for (OFMessage m : validMsgs) {
if (!unsent.contains(m)) {
switchManager.handleOutgoingMessage(this, m);
}
}
/* Collect invalid and unsent messages */
Collection<OFMessage> ret = null;
if (!unsent.isEmpty()) {
log.warn("Could not send messages {} due to channel disconnection on switch {}", unsent, this.getId());
ret = IterableUtils.toCollection(unsent);
}
if (!invalidMsgs.isEmpty()) {
log.warn("Could not send messages {} while in SLAVE role on switch {}", invalidMsgs, this.getId());
if (ret == null) {
ret = IterableUtils.toCollection(invalidMsgs);
} else {
ret.addAll(IterableUtils.toCollection(invalidMsgs));
}
}
if (ret == null) {
return Collections.emptyList();
} else {
return ret;
}
}