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


Java TypedStoredFlowEntry.setFlowLiveType方法代码示例

本文整理汇总了Java中org.onosproject.net.flow.TypedStoredFlowEntry.setFlowLiveType方法的典型用法代码示例。如果您正苦于以下问题:Java TypedStoredFlowEntry.setFlowLiveType方法的具体用法?Java TypedStoredFlowEntry.setFlowLiveType怎么用?Java TypedStoredFlowEntry.setFlowLiveType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.flow.TypedStoredFlowEntry的用法示例。


在下文中一共展示了TypedStoredFlowEntry.setFlowLiveType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calAndSetFlowLiveTypeInternal

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入方法依赖的package包/类
private void calAndSetFlowLiveTypeInternal(TypedStoredFlowEntry rule) {
    long life = rule.life();
    FlowLiveType prevFlowLiveType = rule.flowLiveType();

    if (life >= longPollInterval) {
        rule.setFlowLiveType(FlowLiveType.LONG_FLOW);
        longFlows.add(rule);
    } else if (life >= midPollInterval) {
        rule.setFlowLiveType(FlowLiveType.MID_FLOW);
        midFlows.add(rule);
    } else if (life >= calAndPollInterval) {
        rule.setFlowLiveType(FlowLiveType.SHORT_FLOW);
        shortFlows.add(rule);
    } else if (life >= 0) {
        rule.setFlowLiveType(FlowLiveType.IMMEDIATE_FLOW);
    } else { // life < 0
        rule.setFlowLiveType(FlowLiveType.UNKNOWN_FLOW);
    }

    if (rule.flowLiveType() != prevFlowLiveType) {
        switch (prevFlowLiveType) {
        // delete it from previous flow table
        case SHORT_FLOW:
            shortFlows.remove(rule);
            break;
        case MID_FLOW:
            midFlows.remove(rule);
            break;
        case LONG_FLOW:
            longFlows.remove(rule);
            break;
        default:
            break;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:NewAdaptiveFlowStatsCollector.java

示例2: checkAndMoveLiveFlowInternal

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入方法依赖的package包/类
private boolean checkAndMoveLiveFlowInternal(TypedStoredFlowEntry fe, long cTime) {
    long curTime = (cTime > 0 ? cTime : System.currentTimeMillis());
    // For latency adjustment(default=500 millisecond) between FlowStatsRequest and Reply
    long fromLastSeen = ((curTime - fe.lastSeen() + latencyFlowStatsRequestAndReplyMillis) / 1000);
    // fe.life() unit is SECOND!
    long liveTime = fe.life() + fromLastSeen;


    switch (fe.flowLiveType()) {
    case IMMEDIATE_FLOW:
        if (liveTime >= longPollInterval) {
            fe.setFlowLiveType(FlowLiveType.LONG_FLOW);
            longFlows.add(fe);
        } else if (liveTime >= midPollInterval) {
            fe.setFlowLiveType(FlowLiveType.MID_FLOW);
            midFlows.add(fe);
        } else if (liveTime >= calAndPollInterval) {
            fe.setFlowLiveType(FlowLiveType.SHORT_FLOW);
            shortFlows.add(fe);
        }
        break;
    case SHORT_FLOW:
        if (liveTime >= longPollInterval) {
            fe.setFlowLiveType(FlowLiveType.LONG_FLOW);
            shortFlows.remove(fe);
            longFlows.add(fe);
        } else if (liveTime >= midPollInterval) {
            fe.setFlowLiveType(FlowLiveType.MID_FLOW);
            shortFlows.remove(fe);
            midFlows.add(fe);
        }
        break;
    case MID_FLOW:
        if (liveTime >= longPollInterval) {
            fe.setFlowLiveType(FlowLiveType.LONG_FLOW);
            midFlows.remove(fe);
            longFlows.add(fe);
        }
        break;
    case LONG_FLOW:
        if (fromLastSeen > entirePollInterval) {
            log.trace("checkAndMoveLiveFlowInternal: flow is already removed at switch.");
            return false;
        }
        break;
    case UNKNOWN_FLOW: // Unknown flow is an internal error flow type, just fall through
    default:
        log.error("Unknown live type error for {}", sw.getStringId());
        return false;
    }

    if (log.isTraceEnabled()) {
        log.trace(CHECK_AND_MOVE_LOG, fe.id(), fe.state(), fe.flowLiveType(),
                liveTime, fe.life(), fe.bytes(), fe.packets(), fromLastSeen,
                fe.priority(), fe.selector().criteria(), fe.treatment(),
                sw.getStringId());
    }

    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:61,代码来源:NewAdaptiveFlowStatsCollector.java


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