Esempio n. 1
0
    @Override
    public JsonNode call() throws Exception {
      ObjectNode node = mapper.createObjectNode();
      CountDownLatch latch = new CountDownLatch(1);
      flowService.apply(
          adds.build(
              new FlowRuleOperationsContext() {

                private final Stopwatch timer = Stopwatch.createStarted();

                @Override
                public void onSuccess(FlowRuleOperations ops) {

                  long elapsed = timer.elapsed(TimeUnit.MILLISECONDS);
                  node.put("elapsed", elapsed);

                  latch.countDown();
                }
              }));

      latch.await(10, TimeUnit.SECONDS);
      if (this.remove) {
        flowService.apply(removes.build());
      }
      return node;
    }
Esempio n. 2
0
  private void applyFlowRules(FlowRuleOperations.Builder builder, Objective objective) {
    flowRuleService.apply(
        builder.build(
            new FlowRuleOperationsContext() {
              @Override
              public void onSuccess(FlowRuleOperations ops) {
                pass(objective);
              }

              @Override
              public void onError(FlowRuleOperations ops) {
                fail(objective, ObjectiveError.FLOWINSTALLATIONFAILED);
              }
            }));
  }