Search in sources :

Example 11 with AsyncEventQueueImpl

use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.

the class LuceneTestUtilities method resumeSender.

public static void resumeSender(final Cache cache) {
    final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue(cache);
    if (queue == null) {
        return;
    }
    queue.getSender().resume();
}
Also used : AsyncEventQueueImpl(org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl)

Example 12 with AsyncEventQueueImpl

use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.

the class AsyncEventQueueEvictionAndExpirationJUnitTest method getEventsReceived.

public int getEventsReceived(String aeqId) {
    AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) cache.getAsyncEventQueue(aeqId);
    AbstractGatewaySender sender = (AbstractGatewaySender) aeq.getSender();
    return sender.getStatistics().getEventsReceived();
}
Also used : AsyncEventQueueImpl(org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 13 with AsyncEventQueueImpl

use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.

the class LuceneIndexImpl method destroyAsyncEventQueue.

private void destroyAsyncEventQueue(boolean initiator) {
    String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
    // Get the AsyncEventQueue
    AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) cache.getAsyncEventQueue(aeqId);
    // The AsyncEventQueue can be null in an accessor member
    if (aeq != null) {
        aeq.stop();
    }
    // Remove the id from the dataRegion's AsyncEventQueue ids
    // Note: The region may already have been destroyed by a remote member
    Region region = getDataRegion();
    if (!region.isDestroyed()) {
        region.getAttributesMutator().removeAsyncEventQueueId(aeqId);
    }
    // The AsyncEventQueue can be null in an accessor member
    if (aeq != null) {
        aeq.destroy(initiator);
    }
    if (logger.isDebugEnabled()) {
        logger.debug("Destroyed aeqId=" + aeqId);
    }
}
Also used : AsyncEventQueueImpl(org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl) LocalRegion(org.apache.geode.internal.cache.LocalRegion) Region(org.apache.geode.cache.Region)

Example 14 with AsyncEventQueueImpl

use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.

the class WANTestBase method waitForAsyncQueueToGetEmpty.

public static void waitForAsyncQueueToGetEmpty(String asyncQueueId) {
    AsyncEventQueue theAsyncEventQueue = null;
    Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
    for (AsyncEventQueue asyncChannel : asyncEventChannels) {
        if (asyncQueueId.equals(asyncChannel.getId())) {
            theAsyncEventQueue = asyncChannel;
        }
    }
    final GatewaySender sender = ((AsyncEventQueueImpl) theAsyncEventQueue).getSender();
    if (sender.isParallel()) {
        final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
        Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
            int size = 0;
            for (RegionQueue q : queues) {
                size += q.size();
            }
            assertEquals("Expected queue size to be : " + 0 + " but actual entries: " + size, 0, size);
        });
    } else {
        Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
            Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
            int size = 0;
            for (RegionQueue q : queues) {
                size += q.size();
            }
            assertEquals("Expected queue size to be : " + 0 + " but actual entries: " + size, 0, size);
        });
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AsyncEventQueue(org.apache.geode.cache.asyncqueue.AsyncEventQueue) AsyncEventQueueImpl(org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl) RegionQueue(org.apache.geode.internal.cache.RegionQueue)

Example 15 with AsyncEventQueueImpl

use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.

the class MyGatewayEventSubstitutionFilter method waitForAsyncQueueToGetEmpty.

public static void waitForAsyncQueueToGetEmpty(String asyncQueueId) {
    AsyncEventQueue theAsyncEventQueue = null;
    Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
    for (AsyncEventQueue asyncChannel : asyncEventChannels) {
        if (asyncQueueId.equals(asyncChannel.getId())) {
            theAsyncEventQueue = asyncChannel;
        }
    }
    final GatewaySender sender = ((AsyncEventQueueImpl) theAsyncEventQueue).getSender();
    if (sender.isParallel()) {
        final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
        WaitCriterion wc = new WaitCriterion() {

            public boolean done() {
                int size = 0;
                for (RegionQueue q : queues) {
                    size += q.size();
                }
                if (size == 0) {
                    return true;
                }
                return false;
            }

            public String description() {
                int size = 0;
                for (RegionQueue q : queues) {
                    size += q.size();
                }
                return "Expected queue size to be : " + 0 + " but actual entries: " + size;
            }
        };
        Wait.waitForCriterion(wc, 60000, 500, true);
    } else {
        WaitCriterion wc = new WaitCriterion() {

            public boolean done() {
                Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
                int size = 0;
                for (RegionQueue q : queues) {
                    size += q.size();
                }
                if (size == 0) {
                    return true;
                }
                return false;
            }

            public String description() {
                Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
                int size = 0;
                for (RegionQueue q : queues) {
                    size += q.size();
                }
                return "Expected queue size to be : " + 0 + " but actual entries: " + size;
            }
        };
        Wait.waitForCriterion(wc, 60000, 500, true);
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) AsyncEventQueue(org.apache.geode.cache.asyncqueue.AsyncEventQueue) AsyncEventQueueImpl(org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl) RegionQueue(org.apache.geode.internal.cache.RegionQueue)

Aggregations

AsyncEventQueueImpl (org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl)21 AsyncEventQueue (org.apache.geode.cache.asyncqueue.AsyncEventQueue)13 GatewaySender (org.apache.geode.cache.wan.GatewaySender)6 AsyncEventQueueStats (org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueStats)5 RegionQueue (org.apache.geode.internal.cache.RegionQueue)4 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)3 Region (org.apache.geode.cache.Region)2 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)2 IOException (java.io.IOException)1 TimeUnit (java.util.concurrent.TimeUnit)1 Cache (org.apache.geode.cache.Cache)1 CacheClosedException (org.apache.geode.cache.CacheClosedException)1 RegionFunctionContext (org.apache.geode.cache.execute.RegionFunctionContext)1 LuceneService (org.apache.geode.cache.lucene.LuceneService)1 LuceneIndexImpl (org.apache.geode.cache.lucene.internal.LuceneIndexImpl)1 PartitionOfflineException (org.apache.geode.cache.persistence.PartitionOfflineException)1 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)1 LocalRegion (org.apache.geode.internal.cache.LocalRegion)1 IgnoredException (org.apache.geode.test.dunit.IgnoredException)1