@@ -0,0 +1,2557 @@
+/*%0A * Copyright 2011 LMAX Ltd.%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 */%0Apackage com.lmax.disruptor;%0A%0Aimport java.util.concurrent.atomic.AtomicBoolean;%0Aimport java.util.concurrent.locks.Condition;%0Aimport java.util.concurrent.locks.Lock;%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0A/**%0A * Blocking strategy that uses a lock and condition variable for %7B@link EventProcessor%7Ds waiting on a barrier.%0A *%0A * This strategy can be used when throughput and low-latency are not as important as CPU resource.%0A */%0Apublic final class LiteBlockingWaitStrategy implements WaitStrategy%0A%7B%0A    private final AtomicBoolean signalNeeded = new AtomicBoolean(false);%0A    private final Lock lock = new ReentrantLock();%0A    private final Condition processorNotifyCondition = lock.newCondition();%0A%0A    @Override%0A    public long waitFor(long sequence, Sequence cursorSequence, Sequence dependentSequence, SequenceBarrier barrier)%0A        throws AlertException, InterruptedException%0A    %7B%0A        long availableSequence;%0A        if ((availableSequence = cursorSequence.get()) %3C sequence)%0A        %7B%0A            lock.lock();%0A            try%0A            %7B                %0A                while ((availableSequence = cursorSequence.get()) %3C sequence)%0A                %7B%0A                    signalNeeded.set(true);%0A                    %0A                    barrier.checkAlert();%0A                    processorNotifyCondition.await();%0A                %7D%0A            %7D%0A            finally%0A            %7B%0A                lock.unlock();%0A            %7D%0A        %7D%0A%0A        while ((availableSequence = dependentSequence.get()) %3C sequence)%0A        %7B%0A            barrier.checkAlert();%0A        %7D%0A%0A        return availableSequence;%0A    %7D%0A%0A    @Override%0A    public void signalAllWhenBlocking()%0A    %7B%0A        if (signalNeeded.getAndSet(false))%0A        %7B            %0A            lock.lock();%0A            try%0A            %7B%0A                processorNotifyCondition.signalAll();%0A            %7D%0A            finally%0A            %7B%0A                lock.unlock();%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Add LiteBlockingWaitStrategy as an experimental replacement for BlockingWaitStrategy