Examples of HeapDelta


Examples of com.betfair.cougar.netutil.nio.HeapDelta

                                if (state != null) {
                                    Lock lock = state.getHeapUpdateLock();
                                    lock.lock();
                                    try {
                                        // right, now apply all updates in sequential order, until we hit a gap
                                        HeapDelta delta = state.peekNextDelta();
                                        if (delta == null) {
                                            nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "All contiguous deltas already processed for heapId = %s", heapId);
                                        }
                                        while (delta != null) {
                                            // take a copy now, so we can use it in the initial update processing later...
                                            HeapDelta currentDelta = delta;
                                            nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "Applying delta %s for heapId = %s", currentDelta.getUpdateId(), heapId);
                                            if (currentDelta.containsHeapTermination()) {
                                                heapSubMutationLock.lock();
                                                try {
                                                    currentDelta.applyTo(state.getHeap().asListener());
                                                    state.popNextDelta();

                                                    nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "Found heap termination in delta %s for heapId = %s", currentDelta.getUpdateId(), heapId);
                                                    terminateSubscriptions(sessionId, heapId, Subscription.CloseReason.REQUESTED_BY_PUBLISHER);

                                                    delta = null;
                                                } finally {
                                                    heapSubMutationLock.unlock();
                                                }
                                            } else {
                                                currentDelta.applyTo(state.getHeap().asListener());
                                                state.popNextDelta();
                                                delta = state.peekNextDelta();
                                            }
                                            if (currentDelta.containsFirstUpdate()) {
                                                nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "Found initial update in delta for heapId = %s", heapId);
                                                // basically we got the first update
                                                CountDownLatch latch = heaps.getInitialPopulationLatch(heapId);
                                                if (latch != null) {
                                                    latch.countDown();
View Full Code Here

Examples of com.betfair.cougar.netutil.nio.HeapDelta

                                if (state != null) {
                                    Lock lock = state.getHeapUpdateLock();
                                    lock.lock();
                                    try {
                                        // right, now apply all updates in sequential order, until we hit a gap
                                        HeapDelta delta = state.peekNextDelta();
                                        if (delta == null) {
                                            nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "All contiguous deltas already processed for heapId = %s", heapId);
                                        }
                                        while (delta != null) {
                                            // take a copy now, so we can use it in the initial update processing later...
                                            HeapDelta currentDelta = delta;
                                            nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "Applying delta %s for heapId = %s", currentDelta.getUpdateId(), heapId);
                                            if (currentDelta.containsHeapTermination()) {
                                                heapSubMutationLock.lock();
                                                try {
                                                    currentDelta.applyTo(state.getHeap().asListener());
                                                    state.popNextDelta();

                                                    nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "Found heap termination in delta %s for heapId = %s", currentDelta.getUpdateId(), heapId);
                                                    terminateSubscriptions(sessionId, heapId, Subscription.CloseReason.REQUESTED_BY_PUBLISHER);

                                                    delta = null;
                                                } finally {
                                                    heapSubMutationLock.unlock();
                                                }
                                            } else {
                                                currentDelta.applyTo(state.getHeap().asListener());
                                                state.popNextDelta();
                                                delta = state.peekNextDelta();
                                            }
                                            if (currentDelta.containsFirstUpdate()) {
                                                nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, sessionId, "Found initial update in delta for heapId = %s", heapId);
                                                // basically we got the first update
                                                CountDownLatch latch = heaps.getInitialPopulationLatch(heapId);
                                                if (latch != null) {
                                                    latch.countDown();
View Full Code Here

Examples of com.betfair.cougar.netutil.nio.HeapDelta

    public Heap getHeap() {
        return heap;
    }

    public HeapDelta popNextDelta() {
        HeapDelta nextDelta = queue.remove().delta; // We only call this if we know the queue has something
        seenInitialUpdate |= isInitialUpdate(nextDelta);
        lastUpdateId.set(nextDelta.getUpdateId());
        return nextDelta;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.