当前位置: 首页>>代码示例>>Java>>正文


Java IOFConnection.write方法代码示例

本文整理汇总了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;
	}
}
 
开发者ID:hksoni,项目名称:SDN-Multicast,代码行数:38,代码来源:OFSwitch.java

示例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;
	}
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:38,代码来源:OFSwitch.java


注:本文中的net.floodlightcontroller.core.IOFConnection.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。