Search in sources :

Example 61 with BlockingQueue

use of java.util.concurrent.BlockingQueue in project linuxtools by eclipse.

the class ImageTagSelectionPage method searchTags.

private void searchTags() {
    try {
        final BlockingQueue<List<DockerImageTagSearchResult>> searchResultQueue = new ArrayBlockingQueue<>(1);
        ImageTagSelectionPage.this.getContainer().run(true, true, monitor -> {
            monitor.beginTask(WizardMessages.getString(// $NON-NLS-1$
            "ImageTagSelectionPage.searchTask"), 2);
            final String selectedImageName = ImageTagSelectionPage.this.model.getSelectedImage().getName();
            try {
                final List<IRepositoryTag> repositoryTags = registry.getTags(selectedImageName);
                // we have to convert to list of RepositoryTag which
                // can be sorted
                final List<RepositoryTag> tags = repositoryTags.stream().map(c -> (RepositoryTag) c).collect(Collectors.toList());
                Collections.sort(tags);
                monitor.worked(1);
                final IDockerConnection connection = model.getSelectedConnection();
                final List<DockerImageTagSearchResult> searchResults = repositoryTags.stream().map(t -> new DockerImageTagSearchResult(selectedImageName, t, connection.hasImage(selectedImageName, t.getName()))).collect(Collectors.toList());
                monitor.worked(1);
                searchResultQueue.offer(searchResults);
            } catch (DockerException e) {
            } finally {
                monitor.done();
            }
        });
        List<DockerImageTagSearchResult> res = searchResultQueue.poll(10, TimeUnit.SECONDS);
        final List<DockerImageTagSearchResult> searchResult = (res == null) ? new ArrayList<>() : res;
        Display.getCurrent().asyncExec(() -> {
            ImageTagSelectionPage.this.model.setImageTagSearchResult(searchResult);
            // refresh the wizard buttons
            getWizard().getContainer().updateButtons();
        });
        // display a warning in the title area if the search result is empty
        if (searchResult.isEmpty()) {
            this.setMessage(WizardMessages.getString(// $NON-NLS-1$
            "ImageTagSelectionPage.noTagWarning"), WARNING);
        } else if (searchResult.size() == 1) {
            this.setMessage(WizardMessages.getString(// $NON-NLS-1$
            "ImageTagSelectionPage.oneTagMatched"), INFORMATION);
        } else {
            this.setMessage(WizardMessages.getFormattedString(// $NON-NLS-1$
            "ImageTagSelectionPage.tagsMatched", Integer.toString(searchResult.size())), INFORMATION);
        }
    } catch (InvocationTargetException | InterruptedException e) {
        Activator.log(e);
    }
}
Also used : IRepositoryTag(org.eclipse.linuxtools.docker.core.IRepositoryTag) TableViewer(org.eclipse.jface.viewers.TableViewer) Activator(org.eclipse.linuxtools.docker.ui.Activator) TableColumn(org.eclipse.swt.widgets.TableColumn) DataBindingContext(org.eclipse.core.databinding.DataBindingContext) ObservableListContentProvider(org.eclipse.jface.databinding.viewers.ObservableListContentProvider) Table(org.eclipse.swt.widgets.Table) ArrayList(java.util.ArrayList) IObservableList(org.eclipse.core.databinding.observable.list.IObservableList) RepositoryTag(org.eclipse.linuxtools.internal.docker.core.RepositoryTag) Composite(org.eclipse.swt.widgets.Composite) DockerException(org.eclipse.linuxtools.docker.core.DockerException) IconColumnLabelProvider(org.eclipse.linuxtools.internal.docker.ui.wizards.ImageSearchPage.IconColumnLabelProvider) WizardPage(org.eclipse.jface.wizard.WizardPage) GridDataFactory(org.eclipse.jface.layout.GridDataFactory) ViewerProperties(org.eclipse.jface.databinding.viewers.ViewerProperties) BlockingQueue(java.util.concurrent.BlockingQueue) IRegistry(org.eclipse.linuxtools.docker.core.IRegistry) Display(org.eclipse.swt.widgets.Display) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) Collectors(java.util.stream.Collectors) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) GridLayoutFactory(org.eclipse.jface.layout.GridLayoutFactory) InvocationTargetException(java.lang.reflect.InvocationTargetException) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider) TimeUnit(java.util.concurrent.TimeUnit) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) List(java.util.List) SWTImagesFactory(org.eclipse.linuxtools.internal.docker.ui.SWTImagesFactory) BeanProperties(org.eclipse.core.databinding.beans.BeanProperties) SWT(org.eclipse.swt.SWT) RepositoryTagV2(org.eclipse.linuxtools.internal.docker.core.RepositoryTagV2) Collections(java.util.Collections) IRepositoryTag(org.eclipse.linuxtools.docker.core.IRepositoryTag) DockerException(org.eclipse.linuxtools.docker.core.DockerException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) RepositoryTag(org.eclipse.linuxtools.internal.docker.core.RepositoryTag) IRepositoryTag(org.eclipse.linuxtools.docker.core.IRepositoryTag) ArrayList(java.util.ArrayList) IObservableList(org.eclipse.core.databinding.observable.list.IObservableList) List(java.util.List)

Example 62 with BlockingQueue

use of java.util.concurrent.BlockingQueue in project ignite by apache.

the class CacheInterceptorPartitionCounterRandomOperationsTest method waitAndCheckEvent.

/**
 * @param cache Ignite cache.
 * @param partCntrs Partition counters.
 * @param aff Affinity function.
 * @param key Key.
 * @param val Value.
 * @param oldVal Old value.
 * @param rmv Remove operation.
 * @throws Exception If failed.
 */
private void waitAndCheckEvent(IgniteCache<Object, Object> cache, Map<Integer, Long> partCntrs, Affinity<Object> aff, Object key, Object val, Object oldVal, boolean rmv) throws Exception {
    Collection<BlockingQueue<Cache.Entry<TestKey, TestValue>>> entries = getInterceptorQueues(cache, key, rmv);
    assert !entries.isEmpty();
    if (val == null && oldVal == null) {
        checkNoEvent(entries);
        return;
    }
    for (BlockingQueue<Cache.Entry<TestKey, TestValue>> evtsQueue : entries) {
        Cache.Entry<TestKey, TestValue> entry = evtsQueue.poll(5, SECONDS);
        assertNotNull("Failed to wait for event [key=" + key + ", val=" + val + ", oldVal=" + oldVal + ']', entry);
        assertEquals(key, entry.getKey());
        assertEquals(rmv ? oldVal : val, entry.getValue());
        long cntr = partCntrs.get(aff.partition(key));
        CacheInterceptorEntry interceptorEntry = entry.unwrap(CacheInterceptorEntry.class);
        assertNotNull(cntr);
        assertNotNull(interceptorEntry);
        assertEquals(cntr, interceptorEntry.getPartitionUpdateCounter());
        assertNull(evtsQueue.peek());
    }
}
Also used : BlockingQueue(java.util.concurrent.BlockingQueue) CacheInterceptorEntry(org.apache.ignite.cache.CacheInterceptorEntry) MutableEntry(javax.cache.processor.MutableEntry) CacheInterceptorEntry(org.apache.ignite.cache.CacheInterceptorEntry) Cache(javax.cache.Cache) IgniteCache(org.apache.ignite.IgniteCache)

Example 63 with BlockingQueue

use of java.util.concurrent.BlockingQueue in project ignite by apache.

the class CacheContinuousQueryFactoryFilterRandomOperationTest method doTestContinuousQuery.

/**
 * {@inheritDoc}
 */
@Override
protected void doTestContinuousQuery(CacheConfiguration<Object, Object> ccfg, ContinuousDeploy deploy) throws Exception {
    ignite(0).createCache(ccfg);
    try {
        long seed = System.currentTimeMillis();
        Random rnd = new Random(seed);
        log.info("Random seed: " + seed);
        List<BlockingQueue<CacheEntryEvent<?, ?>>> evtsQueues = new ArrayList<>();
        Collection<QueryCursor<?>> curs = new ArrayList<>();
        Collection<T2<Integer, MutableCacheEntryListenerConfiguration>> lsnrCfgs = new ArrayList<>();
        if (deploy == CLIENT)
            evtsQueues.add(registerListener(ccfg.getName(), NODES - 1, curs, lsnrCfgs, rnd.nextBoolean()));
        else if (deploy == SERVER)
            evtsQueues.add(registerListener(ccfg.getName(), rnd.nextInt(NODES - 1), curs, lsnrCfgs, rnd.nextBoolean()));
        else {
            boolean isSync = rnd.nextBoolean();
            for (int i = 0; i < NODES - 1; i++) evtsQueues.add(registerListener(ccfg.getName(), i, curs, lsnrCfgs, isSync));
        }
        ConcurrentMap<Object, Object> expData = new ConcurrentHashMap<>();
        Map<Integer, Long> partCntr = new ConcurrentHashMap<>();
        try {
            for (int i = 0; i < ITERATION_CNT; i++) {
                if (i % 10 == 0)
                    log.info("Iteration: " + i);
                for (int idx = 0; idx < NODES; idx++) randomUpdate(rnd, evtsQueues, expData, partCntr, grid(idx).cache(ccfg.getName()));
            }
        } finally {
            for (QueryCursor<?> cur : curs) cur.close();
            for (T2<Integer, MutableCacheEntryListenerConfiguration> e : lsnrCfgs) grid(e.get1()).cache(ccfg.getName()).deregisterCacheEntryListener(e.get2());
        }
    } finally {
        ignite(0).destroyCache(ccfg.getName());
    }
}
Also used : BlockingQueue(java.util.concurrent.BlockingQueue) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) MutableCacheEntryListenerConfiguration(javax.cache.configuration.MutableCacheEntryListenerConfiguration) ArrayList(java.util.ArrayList) Random(java.util.Random) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) QueryCursor(org.apache.ignite.cache.query.QueryCursor) T2(org.apache.ignite.internal.util.typedef.T2)

Example 64 with BlockingQueue

use of java.util.concurrent.BlockingQueue in project ignite by apache.

the class CacheContinuousQueryRandomOperationsTest method doTestContinuousQuery.

/**
 * @param ccfg Cache configuration.
 * @param deploy The place where continuous query will be started.
 * @throws Exception If failed.
 */
protected void doTestContinuousQuery(CacheConfiguration<Object, Object> ccfg, ContinuousDeploy deploy) throws Exception {
    ignite(0).createCache(ccfg);
    try {
        long seed = System.currentTimeMillis();
        Random rnd = new Random(seed);
        log.info("Random seed: " + seed);
        List<BlockingQueue<CacheEntryEvent<?, ?>>> evtsQueues = new ArrayList<>();
        Collection<QueryCursor<?>> curs = new ArrayList<>();
        if (deploy == CLIENT) {
            AbstractContinuousQuery<Object, Object> qry = createQuery();
            final BlockingQueue<CacheEntryEvent<?, ?>> evtsQueue = new ArrayBlockingQueue<>(50_000);
            if (qry instanceof ContinuousQuery) {
                ((ContinuousQuery<Object, Object>) qry).setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {

                    @Override
                    public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) {
                        for (CacheEntryEvent<?, ?> evt : evts) evtsQueue.add(evt);
                    }
                });
            } else if (qry instanceof ContinuousQueryWithTransformer)
                initQueryWithTransformer((ContinuousQueryWithTransformer<Object, Object, CacheEntryEvent>) qry, evtsQueue);
            else
                fail("Unknown query type");
            evtsQueues.add(evtsQueue);
            QueryCursor<?> cur = grid(getClientIndex()).cache(ccfg.getName()).query(qry);
            curs.add(cur);
        } else if (deploy == SERVER) {
            AbstractContinuousQuery<Object, Object> qry = createQuery();
            final BlockingQueue<CacheEntryEvent<?, ?>> evtsQueue = new ArrayBlockingQueue<>(50_000);
            if (qry instanceof ContinuousQuery) {
                ((ContinuousQuery<Object, Object>) qry).setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {

                    @Override
                    public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) {
                        for (CacheEntryEvent<?, ?> evt : evts) evtsQueue.add(evt);
                    }
                });
            } else if (qry instanceof ContinuousQueryWithTransformer)
                initQueryWithTransformer((ContinuousQueryWithTransformer<Object, Object, CacheEntryEvent>) qry, evtsQueue);
            else
                fail("Unknown query type");
            evtsQueues.add(evtsQueue);
            QueryCursor<?> cur = grid(rnd.nextInt(getServerNodeCount())).cache(ccfg.getName()).query(qry);
            curs.add(cur);
        } else {
            for (int i = 0; i <= getServerNodeCount(); i++) {
                AbstractContinuousQuery<Object, Object> qry = createQuery();
                final BlockingQueue<CacheEntryEvent<?, ?>> evtsQueue = new ArrayBlockingQueue<>(50_000);
                if (qry instanceof ContinuousQuery) {
                    ((ContinuousQuery<Object, Object>) qry).setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {

                        @Override
                        public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) {
                            for (CacheEntryEvent<?, ?> evt : evts) evtsQueue.add(evt);
                        }
                    });
                } else if (qry instanceof ContinuousQueryWithTransformer)
                    initQueryWithTransformer((ContinuousQueryWithTransformer<Object, Object, CacheEntryEvent>) qry, evtsQueue);
                else
                    fail("Unknown query type");
                evtsQueues.add(evtsQueue);
                QueryCursor<?> cur = ignite(i).cache(ccfg.getName()).query(qry);
                curs.add(cur);
            }
        }
        ConcurrentMap<Object, Object> expData = new ConcurrentHashMap<>();
        Map<Integer, Long> partCntr = new ConcurrentHashMap<>();
        try {
            for (int i = 0; i < ITERATION_CNT; i++) {
                if (i % 20 == 0)
                    log.info("Iteration: " + i);
                for (int idx = 0; idx < getServerNodeCount(); idx++) randomUpdate(rnd, evtsQueues, expData, partCntr, grid(idx).cache(ccfg.getName()));
            }
        } finally {
            for (QueryCursor<?> cur : curs) cur.close();
        }
    } finally {
        ignite(0).destroyCache(ccfg.getName());
    }
}
Also used : ContinuousQueryWithTransformer(org.apache.ignite.cache.query.ContinuousQueryWithTransformer) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) CacheEntryEvent(javax.cache.event.CacheEntryEvent) AbstractContinuousQuery(org.apache.ignite.cache.query.AbstractContinuousQuery) ContinuousQuery(org.apache.ignite.cache.query.ContinuousQuery) Random(java.util.Random) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) CacheEntryUpdatedListener(javax.cache.event.CacheEntryUpdatedListener) AbstractContinuousQuery(org.apache.ignite.cache.query.AbstractContinuousQuery) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) QueryCursor(org.apache.ignite.cache.query.QueryCursor) BlockingQueue(java.util.concurrent.BlockingQueue) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue)

Example 65 with BlockingQueue

use of java.util.concurrent.BlockingQueue in project pravega by pravega.

the class StreamTransactionMetadataTasksTest method failOverTests.

@Test
public void failOverTests() throws CheckpointStoreException, InterruptedException {
    // Create mock writer objects.
    EventStreamWriterMock<CommitEvent> commitWriter = new EventStreamWriterMock<>();
    EventStreamWriterMock<AbortEvent> abortWriter = new EventStreamWriterMock<>();
    EventStreamReader<CommitEvent> commitReader = commitWriter.getReader();
    EventStreamReader<AbortEvent> abortReader = abortWriter.getReader();
    consumer = new ControllerService(streamStore, hostStore, streamMetadataTasks, txnTasks, segmentHelperMock, executor, null);
    // Create test scope and stream.
    final ScalingPolicy policy1 = ScalingPolicy.fixed(2);
    final StreamConfiguration configuration1 = StreamConfiguration.builder().scope(SCOPE).streamName(STREAM).scalingPolicy(policy1).build();
    Assert.assertEquals(Controller.CreateScopeStatus.Status.SUCCESS, consumer.createScope(SCOPE).join().getStatus());
    Assert.assertEquals(Controller.CreateStreamStatus.Status.SUCCESS, streamMetadataTasks.createStream(SCOPE, STREAM, configuration1, System.currentTimeMillis()).join());
    // Set up txn task for creating transactions from a failedHost.
    StreamTransactionMetadataTasks failedTxnTasks = new StreamTransactionMetadataTasks(streamStore, hostStore, segmentHelperMock, executor, "failedHost", connectionFactory, false, "");
    failedTxnTasks.initializeStreamWriters("commitStream", new EventStreamWriterMock<>(), "abortStream", new EventStreamWriterMock<>());
    // Create 3 transactions from failedHost.
    VersionedTransactionData tx1 = failedTxnTasks.createTxn(SCOPE, STREAM, 10000, 10000, null).join().getKey();
    VersionedTransactionData tx2 = failedTxnTasks.createTxn(SCOPE, STREAM, 10000, 10000, null).join().getKey();
    VersionedTransactionData tx3 = failedTxnTasks.createTxn(SCOPE, STREAM, 10000, 10000, null).join().getKey();
    // Ping another txn from failedHost.
    UUID txnId = UUID.randomUUID();
    streamStore.createTransaction(SCOPE, STREAM, txnId, 10000, 30000, 30000, null, executor).join();
    PingTxnStatus pingStatus = failedTxnTasks.pingTxn(SCOPE, STREAM, txnId, 10000, null).join();
    VersionedTransactionData tx4 = streamStore.getTransactionData(SCOPE, STREAM, txnId, null, executor).join();
    // Validate versions of all txn
    Assert.assertEquals(0, tx1.getVersion());
    Assert.assertEquals(0, tx2.getVersion());
    Assert.assertEquals(0, tx3.getVersion());
    Assert.assertEquals(1, tx4.getVersion());
    Assert.assertEquals(PingTxnStatus.Status.OK, pingStatus.getStatus());
    // Validate the txn index.
    Assert.assertEquals(1, streamStore.listHostsOwningTxn().join().size());
    // Change state of one txn to COMMITTING.
    TxnStatus txnStatus2 = streamStore.sealTransaction(SCOPE, STREAM, tx2.getId(), true, Optional.empty(), null, executor).thenApply(AbstractMap.SimpleEntry::getKey).join();
    Assert.assertEquals(TxnStatus.COMMITTING, txnStatus2);
    // Change state of another txn to ABORTING.
    TxnStatus txnStatus3 = streamStore.sealTransaction(SCOPE, STREAM, tx3.getId(), false, Optional.empty(), null, executor).thenApply(AbstractMap.SimpleEntry::getKey).join();
    Assert.assertEquals(TxnStatus.ABORTING, txnStatus3);
    // Create transaction tasks for sweeping txns from failedHost.
    txnTasks = new StreamTransactionMetadataTasks(streamStore, hostStore, segmentHelperMock, executor, "host", connectionFactory, false, "");
    TxnSweeper txnSweeper = new TxnSweeper(streamStore, txnTasks, 100, executor);
    // Before initializing, txnSweeper.sweepFailedHosts would throw an error
    AssertExtensions.assertThrows("IllegalStateException before initialization", txnSweeper.sweepFailedProcesses(() -> Collections.singleton("host")), ex -> ex instanceof IllegalStateException);
    // Initialize stream writers.
    txnTasks.initializeStreamWriters("commitStream", commitWriter, "abortStream", abortWriter);
    // Validate that txnTasks is ready.
    assertTrue(txnTasks.isReady());
    // Sweep txns that were being managed by failedHost.
    txnSweeper.sweepFailedProcesses(() -> Collections.singleton("host")).join();
    // Validate that sweeping completes correctly.
    Assert.assertEquals(0, streamStore.listHostsOwningTxn().join().size());
    Assert.assertEquals(TxnStatus.ABORTING, streamStore.transactionStatus(SCOPE, STREAM, tx1.getId(), null, executor).join());
    Assert.assertEquals(TxnStatus.COMMITTING, streamStore.transactionStatus(SCOPE, STREAM, tx2.getId(), null, executor).join());
    Assert.assertEquals(TxnStatus.ABORTING, streamStore.transactionStatus(SCOPE, STREAM, tx3.getId(), null, executor).join());
    Assert.assertEquals(TxnStatus.ABORTING, streamStore.transactionStatus(SCOPE, STREAM, tx4.getId(), null, executor).join());
    // Create commit and abort event processors.
    ConnectionFactory connectionFactory = Mockito.mock(ConnectionFactory.class);
    BlockingQueue<CommitEvent> processedCommitEvents = new LinkedBlockingQueue<>();
    BlockingQueue<AbortEvent> processedAbortEvents = new LinkedBlockingQueue<>();
    createEventProcessor("commitRG", "commitStream", commitReader, commitWriter, () -> new CommitEventProcessor(streamStore, streamMetadataTasks, hostStore, executor, segmentHelperMock, connectionFactory, processedCommitEvents));
    createEventProcessor("abortRG", "abortStream", abortReader, abortWriter, () -> new ConcurrentEventProcessor<>(new AbortRequestHandler(streamStore, streamMetadataTasks, hostStore, executor, segmentHelperMock, connectionFactory, processedAbortEvents), executor));
    // Wait until the commit event is processed and ensure that the txn state is COMMITTED.
    CommitEvent commitEvent = processedCommitEvents.take();
    assertEquals(tx2.getId(), commitEvent.getTxid());
    assertEquals(TxnStatus.COMMITTED, streamStore.transactionStatus(SCOPE, STREAM, tx2.getId(), null, executor).join());
    // Wait until 3 abort events are processed and ensure that the txn state is ABORTED.
    Predicate<AbortEvent> predicate = event -> event.getTxid().equals(tx1.getId()) || event.getTxid().equals(tx3.getId()) || event.getTxid().equals(tx4.getId());
    AbortEvent abortEvent1 = processedAbortEvents.take();
    assertTrue(predicate.test(abortEvent1));
    AbortEvent abortEvent2 = processedAbortEvents.take();
    assertTrue(predicate.test(abortEvent2));
    AbortEvent abortEvent3 = processedAbortEvents.take();
    assertTrue(predicate.test(abortEvent3));
    assertEquals(TxnStatus.ABORTED, streamStore.transactionStatus(SCOPE, STREAM, tx1.getId(), null, executor).join());
    assertEquals(TxnStatus.ABORTED, streamStore.transactionStatus(SCOPE, STREAM, tx3.getId(), null, executor).join());
    assertEquals(TxnStatus.ABORTED, streamStore.transactionStatus(SCOPE, STREAM, tx4.getId(), null, executor).join());
}
Also used : CommitEvent(io.pravega.shared.controller.event.CommitEvent) EventStreamWriter(io.pravega.client.stream.EventStreamWriter) SneakyThrows(lombok.SneakyThrows) AssertExtensions(io.pravega.test.common.AssertExtensions) ReaderGroup(io.pravega.client.stream.ReaderGroup) JavaSerializer(io.pravega.client.stream.impl.JavaSerializer) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) CheckpointStoreException(io.pravega.controller.store.checkpoint.CheckpointStoreException) CheckpointConfig(io.pravega.controller.eventProcessor.CheckpointConfig) ReaderGroupManager(io.pravega.client.admin.ReaderGroupManager) AbortRequestHandler(io.pravega.controller.server.eventProcessor.requesthandlers.AbortRequestHandler) TaskMetadataStore(io.pravega.controller.store.task.TaskMetadataStore) After(org.junit.After) Controller(io.pravega.controller.stream.api.grpc.v1.Controller) ExceptionHandler(io.pravega.controller.eventProcessor.ExceptionHandler) ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) EventProcessorConfig(io.pravega.controller.eventProcessor.EventProcessorConfig) Predicate(java.util.function.Predicate) Set(java.util.Set) BlockingQueue(java.util.concurrent.BlockingQueue) UUID(java.util.UUID) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) Executors(java.util.concurrent.Executors) ControllerEvent(io.pravega.shared.controller.event.ControllerEvent) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) CuratorFramework(org.apache.curator.framework.CuratorFramework) ConcurrentEventProcessor(io.pravega.controller.eventProcessor.impl.ConcurrentEventProcessor) EventProcessorSystemImpl(io.pravega.controller.eventProcessor.impl.EventProcessorSystemImpl) TxnStatus(io.pravega.controller.store.stream.TxnStatus) ClientFactory(io.pravega.client.ClientFactory) VersionedTransactionData(io.pravega.controller.store.stream.VersionedTransactionData) Optional(java.util.Optional) CommitEventProcessor(io.pravega.controller.server.eventProcessor.CommitEventProcessor) StreamMetadataStore(io.pravega.controller.store.stream.StreamMetadataStore) EventStreamWriterMock(io.pravega.controller.mocks.EventStreamWriterMock) PingTxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus) Futures(io.pravega.common.concurrent.Futures) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) CuratorFrameworkFactory(org.apache.curator.framework.CuratorFrameworkFactory) StreamStoreFactory(io.pravega.controller.store.stream.StreamStoreFactory) SegmentHelper(io.pravega.controller.server.SegmentHelper) EventProcessor(io.pravega.controller.eventProcessor.impl.EventProcessor) CheckpointStoreFactory(io.pravega.controller.store.checkpoint.CheckpointStoreFactory) EventProcessorGroupConfigImpl(io.pravega.controller.eventProcessor.impl.EventProcessorGroupConfigImpl) CompletableFuture(java.util.concurrent.CompletableFuture) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) Answer(org.mockito.stubbing.Answer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) AbortEvent(io.pravega.shared.controller.event.AbortEvent) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) TestingServerStarter(io.pravega.test.common.TestingServerStarter) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) TestingServer(org.apache.curator.test.TestingServer) ConnectionFactory(io.pravega.client.netty.impl.ConnectionFactory) HostMonitorConfigImpl(io.pravega.controller.store.host.impl.HostMonitorConfigImpl) Before(org.junit.Before) ControllerService(io.pravega.controller.server.ControllerService) SegmentHelperMock(io.pravega.controller.mocks.SegmentHelperMock) Iterator(java.util.Iterator) Assert.assertTrue(org.junit.Assert.assertTrue) EventStreamReader(io.pravega.client.stream.EventStreamReader) Test(org.junit.Test) HostStoreFactory(io.pravega.controller.store.host.HostStoreFactory) EventProcessorGroupConfig(io.pravega.controller.eventProcessor.EventProcessorGroupConfig) Mockito(org.mockito.Mockito) AbstractMap(java.util.AbstractMap) TaskStoreFactory(io.pravega.controller.store.task.TaskStoreFactory) HostControllerStore(io.pravega.controller.store.host.HostControllerStore) Assert(org.junit.Assert) Collections(java.util.Collections) ScalingPolicy(io.pravega.client.stream.ScalingPolicy) Assert.assertEquals(org.junit.Assert.assertEquals) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) PingTxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus) VersionedTransactionData(io.pravega.controller.store.stream.VersionedTransactionData) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) ControllerService(io.pravega.controller.server.ControllerService) AbstractMap(java.util.AbstractMap) ConnectionFactory(io.pravega.client.netty.impl.ConnectionFactory) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) CommitEvent(io.pravega.shared.controller.event.CommitEvent) AbortEvent(io.pravega.shared.controller.event.AbortEvent) UUID(java.util.UUID) ScalingPolicy(io.pravega.client.stream.ScalingPolicy) CommitEventProcessor(io.pravega.controller.server.eventProcessor.CommitEventProcessor) EventStreamWriterMock(io.pravega.controller.mocks.EventStreamWriterMock) AbortRequestHandler(io.pravega.controller.server.eventProcessor.requesthandlers.AbortRequestHandler) TxnStatus(io.pravega.controller.store.stream.TxnStatus) PingTxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus) Test(org.junit.Test)

Aggregations

BlockingQueue (java.util.concurrent.BlockingQueue)129 Test (org.junit.Test)59 CountDownLatch (java.util.concurrent.CountDownLatch)21 LocalConcurrentBlockingObjectQueue (net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue)21 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)18 ArrayList (java.util.ArrayList)12 Ignore (org.junit.Ignore)12 IOException (java.io.IOException)10 BlockingQueueTest (net.openhft.chronicle.sandbox.queue.common.BlockingQueueTest)10 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)9 TimeUnit (java.util.concurrent.TimeUnit)9 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)8 ByteBuffer (java.nio.ByteBuffer)4 List (java.util.List)4 Assert (org.junit.Assert)4 SynchronousQueue (java.util.concurrent.SynchronousQueue)3 TimeoutException (java.util.concurrent.TimeoutException)3 AsyncContext (javax.servlet.AsyncContext)3 ReadListener (javax.servlet.ReadListener)3 ServletException (javax.servlet.ServletException)3