@Override public AsyncEventQueue getAsyncEventQueue(String id) { return delegate.getAsyncEventQueue(id); }
@Test public void executeFunctionGivenAJdbcAsyncWriterQueueRemovesTheQueue() { String queueName = CreateMappingCommand.createAsyncEventQueueName(regionName); InternalAsyncEventQueue myQueue = mock(InternalAsyncEventQueue.class); when(cache.getAsyncEventQueue(queueName)).thenReturn(myQueue); when(service.getMappingForRegion(eq(regionName))).thenReturn(mapping); function.executeFunction(context); verify(myQueue, times(1)).stop(); verify(myQueue, times(1)).destroy(); }
@Test public void testExecution() throws Exception { when(mockContext.getDataSet()).thenReturn(mockRegion); when(mockContext.getArguments()).thenReturn(waitArgs); when(mockContext.getResultSender()).thenReturn(mockResultSender); when(mockCache.getAsyncEventQueue(any())).thenReturn(mockAEQ); when(mockAEQ.waitUntilFlushed(10000, TimeUnit.MILLISECONDS)).thenReturn(true); WaitUntilFlushedFunction function = new WaitUntilFlushedFunction(); function.execute(mockContext); ArgumentCaptor<Boolean> resultCaptor = ArgumentCaptor.forClass(Boolean.class); verify(mockResultSender).lastResult(resultCaptor.capture()); Boolean result = resultCaptor.getValue(); assertTrue(result); }
private void destroyAsyncEventQueue(boolean initiator) { String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath); // Get the AsyncEventQueue AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) cache.getAsyncEventQueue(aeqId); // Stop the AsyncEventQueue (this stops the AsyncEventQueue's underlying GatewaySender) // 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); } // Destroy the aeq (this also removes it from the GemFireCacheImpl) // The AsyncEventQueue can be null in an accessor member if (aeq != null) { aeq.destroy(initiator); } if (logger.isDebugEnabled()) { logger.debug("Destroyed aeqId=" + aeqId); } } }
public void cleanupFailedInitialization(Region region) { List<LuceneIndexCreationProfile> definedIndexes = getDefinedIndexes(region.getFullPath()); for (LuceneIndexCreationProfile definedIndex : definedIndexes) { // Get the AsyncEventQueue String aeqId = LuceneServiceImpl.getUniqueIndexName(definedIndex.getIndexName(), definedIndex.getRegionPath()); AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) cache.getAsyncEventQueue(aeqId); // Stop and remove the AsyncEventQueue if it exists if (aeq != null) { aeq.stop(); this.cache.removeAsyncEventQueue(aeq); } } }
asyncQueueFactory.configureAsyncEventQueue(asyncEventQueueCreation); AsyncEventQueue asyncEventQueue = cache.getAsyncEventQueue(asyncEventQueueCreation.getId()); if (asyncEventQueue == null) { asyncQueueFactory.create(asyncEventQueueCreation.getId(),