@Activate
  public void activate(ComponentContext context) {
    configService.registerProperties(getClass());

    idGenerator = coreService.getIdGenerator(FlowRuleService.FLOW_OP_TOPIC);

    local = clusterService.getLocalNode().id();

    messageHandlingExecutor =
        Executors.newFixedThreadPool(
            msgHandlerPoolSize, groupedThreads("onos/store/flow", "message-handlers"));

    registerMessageHandlers(messageHandlingExecutor);

    if (backupEnabled) {
      replicaInfoManager.addListener(flowTable);
      backupTask =
          backupSenderExecutor.scheduleWithFixedDelay(
              flowTable::backup, 0, backupPeriod, TimeUnit.MILLISECONDS);
    }

    deviceTableStats =
        storageService
            .<DeviceId, List<TableStatisticsEntry>>eventuallyConsistentMapBuilder()
            .withName("onos-flow-table-stats")
            .withSerializer(SERIALIZER_BUILDER)
            .withAntiEntropyPeriod(5, TimeUnit.SECONDS)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .withTombstonesDisabled()
            .build();
    deviceTableStats.addListener(tableStatsListener);

    logConfig("Started");
  }
示例#2
0
  @Activate
  public void activate() {

    KryoNamespace.Builder serializer =
        KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(PortPair.class);

    portPairStore =
        storageService
            .<PortPairId, PortPair>eventuallyConsistentMapBuilder()
            .withName("portpairstore")
            .withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();

    log.info("Started");
  }