zoukankan      html  css  js  c++  java
  • Floodlight之 FloodlightContextStore 数据结构

         FloodlightContextStore 代表的是一种缓存模型(利用的是ConcurrentHashMap)。里面存储的是上下文相关的对象,可以依据对应的key得到详细的 Object。存在的意义是Floodlight中注冊监听某个事件的listener可以在被调用的时候直接从中取出上下文信息(context information)。以下是重要的代码片段.

    基本数据结构:
    public class FloodlightContext {
        protected ConcurrentHashMap<String, Object> storage =
                new ConcurrentHashMap<String, Object>();

        public ConcurrentHashMap<String, Object> getStorage() {
            return storage ;
        }
    }
    -----------
    public class FloodlightContextStore<V> {
       
        @SuppressWarnings( "unchecked" )
        public V get(FloodlightContext bc, String key) {
            return (V)bc.storage .get(key);
        }
       
        public void put(FloodlightContext bc, String key, V value) {
            bc. storage.put(key, value);
        }
       
        public void remove(FloodlightContext bc, String key) {
            bc. storage.remove(key);
        }
    }

    使用场景:
    if (eth != null ) {
       IFloodlightProviderService.bcStore.put(bc,IFloodlightProviderService.CONTEXT_PI_PAYLOAD,     eth);
    }

    当中。核心接口 IFloodlightProviderService(以下是类层次图) 是Floodlight controller 和 openflow SW交互的部分,当中的成员 bcStore 存储的是解析后的packet in代表的ethenet实例,所以其它监听packet in的listeners能够直接取出,进行处理。











  • 相关阅读:
    Tomcat部署web项目,虚拟目录,上下文(Context),WEB-INF,web.xml,servlet,404
    Android异常:唤醒锁未授权。(Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android.permission.WAKE_LOCK.)
    .hiverc
    Hive安装
    搭建Kafka开发环境
    java实现Kafka的消费者示例
    java实现Kafka生产者示例
    Kafka集群部署
    kafka介绍
    Pig UDF 用户自定义函数
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/5183050.html
Copyright © 2011-2022 走看看