Package org.apache.flink.api.common.accumulators

Examples of org.apache.flink.api.common.accumulators.IntCounter


      // getAccumulator()
      this.distinctWords = new SetAccumulator<StringValue>();
      this.getRuntimeContext().addAccumulator("distinct-words", distinctWords);

      // Create counter and test increment
      IntCounter simpleCounter = getRuntimeContext().getIntCounter("simple-counter");
      simpleCounter.add(1);
      Assert.assertEquals(simpleCounter.getLocalValue().intValue(), 1);

      // Test if we get the same counter
      IntCounter simpleCounter2 = getRuntimeContext().getIntCounter("simple-counter");
      Assert.assertEquals(simpleCounter.getLocalValue(), simpleCounter2.getLocalValue());

      // Should fail if we request it with different type
      try {
        @SuppressWarnings("unused")
        DoubleCounter simpleCounter3 = getRuntimeContext().getDoubleCounter("simple-counter");
View Full Code Here

TOP

Related Classes of org.apache.flink.api.common.accumulators.IntCounter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.