@@ -0,0 +1,1887 @@
+/*%0A *    Copyright 2016 Vladimir Bukhtoyarov%0A *%0A *      Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *      you may not use this file except in compliance with the License.%0A *      You may obtain a copy of the License at%0A *%0A *            http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *     Unless required by applicable law or agreed to in writing, software%0A *     distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *     See the License for the specific language governing permissions and%0A *     limitations under the License.%0A */%0A%0Apackage examples;%0A%0Aimport com.github.metricscore.hdr.ChunkEvictionPolicy;%0Aimport com.github.metricscore.hdr.counter.WindowCounter;%0A%0Aimport java.time.Duration;%0Aimport java.util.Timer;%0Aimport java.util.TimerTask;%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.atomic.AtomicBoolean;%0A%0Apublic class ResetByChunkCounterExample %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        final WindowCounter counter = WindowCounter.newResetByChunkCounter(new ChunkEvictionPolicy(Duration.ofSeconds(1), 7));%0A%0A        // report sum each second%0A        System.out.println(%22Waiting 9 seconds before start sum reporting%22);%0A        new Timer(%22report-sum%22, true).scheduleAtFixedRate(new TimerTask() %7B%0A            @Override%0A            public void run() %7B%0A                System.out.println(counter.getSum());%0A            %7D%0A        %7D, 9000, 1000);%0A%0A        // stop test after five minutes%0A        AtomicBoolean stopped = new AtomicBoolean();%0A        new Timer(%22test-finalizer%22, true).schedule(new TimerTask() %7B%0A            @Override%0A            public void run() %7B%0A                stopped.set(true);%0A            %7D%0A        %7D, TimeUnit.MINUTES.toMillis(5));%0A%0A        while (!stopped.get()) %7B%0A            counter.add(1);%0A        %7D%0A    %7D%0A%0A%7D%0A

add an example of usage ResetByChunkCounter