@@ -0,0 +1,2165 @@
+/*%0A * Copyright 2016 Timothy Brooks%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 */%0A%0Apackage net.uncontended.precipice.metrics.tools;%0A%0Aimport org.junit.Test;%0A%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.Executor;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.locks.LockSupport;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class StrictRecorderTest %7B%0A%0A    private final Executor executors = Executors.newCachedThreadPool();%0A    private final Recorder%3CBooleanHolder%3E recorder = new StrictRecorder%3C%3E();%0A%0A    @Test%0A    public void testThatNoWritesHappenAfterFlip() throws InterruptedException %7B%0A        recorder.flip(new BooleanHolder());%0A        for (int j = 0; j %3C 5; ++j) %7B%0A            final CountDownLatch latch = new CountDownLatch(5);%0A            for (int i = 0; i %3C 10; ++i) %7B%0A                executors.execute(new Runnable() %7B%0A                    @Override%0A                    public void run() %7B%0A                        long permit = recorder.startRecord();%0A                        BooleanHolder active = recorder.active();%0A                        LockSupport.parkNanos(10000);%0A                        active.marker = false;%0A                        recorder.endRecord(permit);%0A                        latch.countDown();%0A                    %7D%0A                %7D);%0A            %7D%0A            latch.await();%0A            BooleanHolder old = recorder.flip(new BooleanHolder());%0A            old.marker = true;%0A            LockSupport.parkNanos(1000000);%0A%0A            assertTrue(old.marker);%0A        %7D%0A%0A    %7D%0A%0A    private static class BooleanHolder %7B%0A        private volatile boolean marker;%0A    %7D%0A%7D%0A

Add test for StrictRecorder