本文整理汇总了Java中org.projectfloodlight.openflow.util.LRULinkedHashMap类的典型用法代码示例。如果您正苦于以下问题:Java LRULinkedHashMap类的具体用法?Java LRULinkedHashMap怎么用?Java LRULinkedHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LRULinkedHashMap类属于org.projectfloodlight.openflow.util包,在下文中一共展示了LRULinkedHashMap类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addToPortMap
import org.projectfloodlight.openflow.util.LRULinkedHashMap; //导入依赖的package包/类
/**
* Adds a host to the MAC/VLAN->SwitchPort mapping
* @param sw The switch to add the mapping to
* @param mac The MAC address of the host to add
* @param vlan The VLAN that the host is on
* @param portVal The switchport that the host is on
*/
protected void addToPortMap(IOFSwitch sw, MacAddress mac, VlanVid vlan, OFPort portVal) {
Map<MacVlanPair, OFPort> swMap = macVlanToSwitchPortMap.get(sw);
if (vlan == VlanVid.FULL_MASK) {
// OFMatch.loadFromPacket sets VLAN ID to 0xffff if the packet contains no VLAN tag;
// for our purposes that is equivalent to the default VLAN ID 0
vlan = VlanVid.ofVlan(0);
}
if (swMap == null) {
// May be accessed by REST API so we need to make it thread safe
swMap = Collections.synchronizedMap(new LRULinkedHashMap<MacVlanPair, OFPort>(MAX_MACS_PER_SWITCH));
macVlanToSwitchPortMap.put(sw, swMap);
}
swMap.put(new MacVlanPair(mac, vlan), portVal);
}
开发者ID:pixuan,项目名称:floodlight,代码行数:24,代码来源:LearningSwitch.java
示例2: addToPortMap
import org.projectfloodlight.openflow.util.LRULinkedHashMap; //导入依赖的package包/类
/**
* Adds a host to the MAC/VLAN->SwitchPort mapping
* @param sw The switch to add the mapping to
* @param mac The MAC address of the host to add
* @param vlan The VLAN that the host is on
* @param portVal The switchport that the host is on
*/
protected void addToPortMap(IOFSwitch sw, MacAddress mac, VlanVid vlan, OFPort portVal) {
Map<MacVlanPair, OFPort> swMap = macVlanToSwitchPortMap.get(sw);
if (vlan == VlanVid.FULL_MASK || vlan == null) {
vlan = VlanVid.ofVlan(0);
}
if (swMap == null) {
// May be accessed by REST API so we need to make it thread safe
swMap = Collections.synchronizedMap(new LRULinkedHashMap<MacVlanPair, OFPort>(MAX_MACS_PER_SWITCH));
macVlanToSwitchPortMap.put(sw, swMap);
}
swMap.put(new MacVlanPair(mac, vlan), portVal);
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:22,代码来源:LearningSwitch.java
注:本文中的org.projectfloodlight.openflow.util.LRULinkedHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论