Search in sources :

Example 6 with Function

use of java.util.function.Function in project vert.x by eclipse.

the class MetricsContextTest method testHttpServerRequest.

private void testHttpServerRequest(Function<Vertx, Context> contextFactory, BiConsumer<Thread, Context> checker) throws Exception {
    AtomicReference<Thread> expectedThread = new AtomicReference<>();
    AtomicReference<Context> expectedContext = new AtomicReference<>();
    AtomicBoolean requestBeginCalled = new AtomicBoolean();
    AtomicBoolean responseEndCalled = new AtomicBoolean();
    AtomicBoolean socketConnectedCalled = new AtomicBoolean();
    AtomicBoolean socketDisconnectedCalled = new AtomicBoolean();
    AtomicBoolean bytesReadCalled = new AtomicBoolean();
    AtomicBoolean bytesWrittenCalled = new AtomicBoolean();
    AtomicBoolean closeCalled = new AtomicBoolean();
    VertxMetricsFactory factory = (vertx, options) -> new DummyVertxMetrics() {

        @Override
        public HttpServerMetrics createMetrics(HttpServer server, SocketAddress localAddress, HttpServerOptions options) {
            return new DummyHttpServerMetrics() {

                @Override
                public Void requestBegin(Void socketMetric, HttpServerRequest request) {
                    requestBeginCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                    return null;
                }

                @Override
                public void responseEnd(Void requestMetric, HttpServerResponse response) {
                    responseEndCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                }

                @Override
                public Void connected(SocketAddress remoteAddress, String remoteName) {
                    socketConnectedCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                    return null;
                }

                @Override
                public void disconnected(Void socketMetric, SocketAddress remoteAddress) {
                    socketDisconnectedCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                }

                @Override
                public void bytesRead(Void socketMetric, SocketAddress remoteAddress, long numberOfBytes) {
                    bytesReadCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                }

                @Override
                public void bytesWritten(Void socketMetric, SocketAddress remoteAddress, long numberOfBytes) {
                    bytesWrittenCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                }

                @Override
                public boolean isEnabled() {
                    return true;
                }

                @Override
                public void close() {
                    closeCalled.set(true);
                }
            };
        }
    };
    CountDownLatch latch = new CountDownLatch(1);
    Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
    Context ctx = contextFactory.apply(vertx);
    ctx.runOnContext(v1 -> {
        HttpServer server = vertx.createHttpServer().requestHandler(req -> {
            HttpServerResponse response = req.response();
            response.setStatusCode(200).setChunked(true).write("bye").end();
            response.close();
        });
        server.listen(8080, "localhost", onSuccess(s -> {
            expectedThread.set(Thread.currentThread());
            expectedContext.set(Vertx.currentContext());
            latch.countDown();
        }));
    });
    awaitLatch(latch);
    HttpClient client = vertx.createHttpClient();
    client.put(8080, "localhost", "/", resp -> {
        resp.netSocket().closeHandler(v -> {
            vertx.close(v4 -> {
                assertTrue(requestBeginCalled.get());
                assertTrue(responseEndCalled.get());
                assertTrue(bytesReadCalled.get());
                assertTrue(bytesWrittenCalled.get());
                assertTrue(socketConnectedCalled.get());
                assertTrue(socketDisconnectedCalled.get());
                assertTrue(closeCalled.get());
                testComplete();
            });
        });
    }).exceptionHandler(err -> {
        fail(err.getMessage());
    }).setChunked(true).write(Buffer.buffer("hello")).end();
    await();
}
Also used : io.vertx.core(io.vertx.core) DatagramSocket(io.vertx.core.datagram.DatagramSocket) VertxMetricsFactory(io.vertx.core.spi.VertxMetricsFactory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Test(org.junit.Test) DummyVertxMetrics(io.vertx.core.metrics.impl.DummyVertxMetrics) io.vertx.core.net(io.vertx.core.net) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) io.vertx.core.http(io.vertx.core.http) CountDownLatch(java.util.concurrent.CountDownLatch) EventBus(io.vertx.core.eventbus.EventBus) Buffer(io.vertx.core.buffer.Buffer) MetricsOptions(io.vertx.core.metrics.MetricsOptions) Ignore(org.junit.Ignore) BiConsumer(java.util.function.BiConsumer) io.vertx.core.spi.metrics(io.vertx.core.spi.metrics) DatagramSocketOptions(io.vertx.core.datagram.DatagramSocketOptions) MessageConsumer(io.vertx.core.eventbus.MessageConsumer) MetricsOptions(io.vertx.core.metrics.MetricsOptions) AtomicReference(java.util.concurrent.atomic.AtomicReference) DummyVertxMetrics(io.vertx.core.metrics.impl.DummyVertxMetrics) CountDownLatch(java.util.concurrent.CountDownLatch) VertxMetricsFactory(io.vertx.core.spi.VertxMetricsFactory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Example 7 with Function

use of java.util.function.Function in project vert.x by eclipse.

the class MetricsContextTest method testHttpClientRequest.

private void testHttpClientRequest(Function<Vertx, Context> contextFactory, BiConsumer<Thread, Context> checker) throws Exception {
    AtomicReference<Thread> expectedThread = new AtomicReference<>();
    AtomicReference<Context> expectedContext = new AtomicReference<>();
    AtomicBoolean requestBeginCalled = new AtomicBoolean();
    AtomicBoolean responseEndCalled = new AtomicBoolean();
    AtomicBoolean socketConnectedCalled = new AtomicBoolean();
    AtomicBoolean socketDisconnectedCalled = new AtomicBoolean();
    AtomicBoolean bytesReadCalled = new AtomicBoolean();
    AtomicBoolean bytesWrittenCalled = new AtomicBoolean();
    AtomicBoolean closeCalled = new AtomicBoolean();
    VertxMetricsFactory factory = (vertx, options) -> new DummyVertxMetrics() {

        @Override
        public HttpClientMetrics createMetrics(HttpClient client, HttpClientOptions options) {
            return new DummyHttpClientMetrics() {

                @Override
                public Void requestBegin(Void endpointMetric, Void socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) {
                    requestBeginCalled.set(true);
                    return null;
                }

                @Override
                public void responseEnd(Void requestMetric, HttpClientResponse response) {
                    responseEndCalled.set(true);
                }

                @Override
                public Void connected(SocketAddress remoteAddress, String remoteName) {
                    socketConnectedCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                    return null;
                }

                @Override
                public void disconnected(Void socketMetric, SocketAddress remoteAddress) {
                    socketDisconnectedCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                }

                @Override
                public void bytesRead(Void socketMetric, SocketAddress remoteAddress, long numberOfBytes) {
                    bytesReadCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                }

                @Override
                public void bytesWritten(Void socketMetric, SocketAddress remoteAddress, long numberOfBytes) {
                    bytesWrittenCalled.set(true);
                    checker.accept(expectedThread.get(), expectedContext.get());
                }

                @Override
                public void close() {
                    closeCalled.set(true);
                }

                @Override
                public boolean isEnabled() {
                    return true;
                }
            };
        }
    };
    Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
    HttpServer server = vertx.createHttpServer();
    server.requestHandler(req -> {
        req.endHandler(buf -> {
            HttpServerResponse resp = req.response();
            resp.setChunked(true).write(Buffer.buffer("bye")).end();
            resp.close();
        });
    });
    CountDownLatch latch = new CountDownLatch(1);
    server.listen(8080, "localhost", onSuccess(s -> {
        latch.countDown();
    }));
    awaitLatch(latch);
    Context ctx = contextFactory.apply(vertx);
    ctx.runOnContext(v1 -> {
        expectedThread.set(Thread.currentThread());
        expectedContext.set(Vertx.currentContext());
        HttpClient client = vertx.createHttpClient();
        checker.accept(expectedThread.get(), expectedContext.get());
        HttpClientRequest req = client.put(8080, "localhost", "/");
        req.handler(resp -> {
            executeInVanillaThread(() -> {
                client.close();
                vertx.close(v2 -> {
                    assertTrue(requestBeginCalled.get());
                    assertTrue(responseEndCalled.get());
                    assertTrue(socketConnectedCalled.get());
                    assertTrue(socketDisconnectedCalled.get());
                    assertTrue(bytesReadCalled.get());
                    assertTrue(bytesWrittenCalled.get());
                    assertTrue(closeCalled.get());
                    testComplete();
                });
            });
        });
        req.setChunked(true).write("hello");
        req.end();
    });
    await();
}
Also used : io.vertx.core(io.vertx.core) DatagramSocket(io.vertx.core.datagram.DatagramSocket) VertxMetricsFactory(io.vertx.core.spi.VertxMetricsFactory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Test(org.junit.Test) DummyVertxMetrics(io.vertx.core.metrics.impl.DummyVertxMetrics) io.vertx.core.net(io.vertx.core.net) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) io.vertx.core.http(io.vertx.core.http) CountDownLatch(java.util.concurrent.CountDownLatch) EventBus(io.vertx.core.eventbus.EventBus) Buffer(io.vertx.core.buffer.Buffer) MetricsOptions(io.vertx.core.metrics.MetricsOptions) Ignore(org.junit.Ignore) BiConsumer(java.util.function.BiConsumer) io.vertx.core.spi.metrics(io.vertx.core.spi.metrics) DatagramSocketOptions(io.vertx.core.datagram.DatagramSocketOptions) MessageConsumer(io.vertx.core.eventbus.MessageConsumer) MetricsOptions(io.vertx.core.metrics.MetricsOptions) AtomicReference(java.util.concurrent.atomic.AtomicReference) DummyVertxMetrics(io.vertx.core.metrics.impl.DummyVertxMetrics) CountDownLatch(java.util.concurrent.CountDownLatch) VertxMetricsFactory(io.vertx.core.spi.VertxMetricsFactory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Example 8 with Function

use of java.util.function.Function in project elasticsearch by elastic.

the class CandidateQueryTests method testDuel.

public void testDuel() throws Exception {
    List<Function<String, Query>> queryFunctions = new ArrayList<>();
    queryFunctions.add((id) -> new PrefixQuery(new Term("field", id)));
    queryFunctions.add((id) -> new WildcardQuery(new Term("field", id + "*")));
    queryFunctions.add((id) -> new CustomQuery(new Term("field", id)));
    queryFunctions.add((id) -> new SpanTermQuery(new Term("field", id)));
    queryFunctions.add((id) -> new TermQuery(new Term("field", id)));
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new TermQuery(new Term("field", id)), BooleanClause.Occur.MUST);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        if (randomBoolean()) {
            builder.add(new CustomQuery(new Term("field", id)), BooleanClause.Occur.MUST);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new TermQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        if (randomBoolean()) {
            builder.add(new CustomQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD);
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.setMinimumNumberShouldMatch(randomIntBetween(0, 4));
        builder.add(new TermQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        builder.add(new CustomQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        return builder.build();
    });
    queryFunctions.add((id) -> new MatchAllDocsQuery());
    queryFunctions.add((id) -> new MatchNoDocsQuery("no reason at all"));
    int numDocs = randomIntBetween(queryFunctions.size(), queryFunctions.size() * 3);
    List<ParseContext.Document> documents = new ArrayList<>();
    for (int i = 0; i < numDocs; i++) {
        String id = Integer.toString(i);
        Query query = queryFunctions.get(i % queryFunctions.size()).apply(id);
        addQuery(query, documents);
    }
    indexWriter.addDocuments(documents);
    indexWriter.close();
    directoryReader = DirectoryReader.open(directory);
    IndexSearcher shardSearcher = newSearcher(directoryReader);
    // Disable query cache, because ControlQuery cannot be cached...
    shardSearcher.setQueryCache(null);
    for (int i = 0; i < numDocs; i++) {
        String id = Integer.toString(i);
        Iterable<? extends IndexableField> doc = Collections.singleton(new StringField("field", id, Field.Store.NO));
        MemoryIndex memoryIndex = MemoryIndex.fromDocument(doc, new WhitespaceAnalyzer());
        duelRun(queryStore, memoryIndex, shardSearcher);
    }
    Iterable<? extends IndexableField> doc = Collections.singleton(new StringField("field", "value", Field.Store.NO));
    MemoryIndex memoryIndex = MemoryIndex.fromDocument(doc, new WhitespaceAnalyzer());
    duelRun(queryStore, memoryIndex, shardSearcher);
    // Empty percolator doc:
    memoryIndex = new MemoryIndex();
    duelRun(queryStore, memoryIndex, shardSearcher);
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) WildcardQuery(org.apache.lucene.search.WildcardQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) TermQuery(org.apache.lucene.search.TermQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) Query(org.apache.lucene.search.Query) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) CommonTermsQuery(org.apache.lucene.queries.CommonTermsQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) PrefixQuery(org.apache.lucene.search.PrefixQuery) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) WildcardQuery(org.apache.lucene.search.WildcardQuery) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) SpanNotQuery(org.apache.lucene.search.spans.SpanNotQuery) ConstantScoreQuery(org.apache.lucene.search.ConstantScoreQuery) SpanNearQuery(org.apache.lucene.search.spans.SpanNearQuery) TermQuery(org.apache.lucene.search.TermQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) SpanOrQuery(org.apache.lucene.search.spans.SpanOrQuery) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) ArrayList(java.util.ArrayList) Term(org.apache.lucene.index.Term) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) Document(org.apache.lucene.document.Document) LongPoint(org.apache.lucene.document.LongPoint) CheckedFunction(org.elasticsearch.common.CheckedFunction) Function(java.util.function.Function) MemoryIndex(org.apache.lucene.index.memory.MemoryIndex) PrefixQuery(org.apache.lucene.search.PrefixQuery) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) StringField(org.apache.lucene.document.StringField)

Example 9 with Function

use of java.util.function.Function in project elasticsearch by elastic.

the class MapperServiceTests method testTotalFieldsExceedsLimit.

public void testTotalFieldsExceedsLimit() throws Throwable {
    Function<String, String> mapping = type -> {
        try {
            return XContentFactory.jsonBuilder().startObject().startObject(type).startObject("properties").startObject("field1").field("type", "keyword").endObject().endObject().endObject().endObject().string();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    };
    createIndex("test1").mapperService().merge("type", new CompressedXContent(mapping.apply("type")), MergeReason.MAPPING_UPDATE, false);
    //set total number of fields to 1 to trigger an exception
    IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
        createIndex("test2", Settings.builder().put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), 1).build()).mapperService().merge("type", new CompressedXContent(mapping.apply("type")), MergeReason.MAPPING_UPDATE, false);
    });
    assertTrue(e.getMessage(), e.getMessage().contains("Limit of total fields [1] in index [test2] has been exceeded"));
}
Also used : XContentFactory(org.elasticsearch.common.xcontent.XContentFactory) KeywordFieldType(org.elasticsearch.index.mapper.KeywordFieldMapper.KeywordFieldType) ESSingleNodeTestCase(org.elasticsearch.test.ESSingleNodeTestCase) Arrays(java.util.Arrays) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) NumberFieldType(org.elasticsearch.index.mapper.NumberFieldMapper.NumberFieldType) XContentType(org.elasticsearch.common.xcontent.XContentType) IndexService(org.elasticsearch.index.IndexService) IOException(java.io.IOException) HashMap(java.util.HashMap) Function(java.util.function.Function) Matchers.startsWith(org.hamcrest.Matchers.startsWith) BytesArray(org.elasticsearch.common.bytes.BytesArray) UncheckedIOException(java.io.UncheckedIOException) HashSet(java.util.HashSet) ExecutionException(java.util.concurrent.ExecutionException) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) ExceptionsHelper(org.elasticsearch.ExceptionsHelper) Settings(org.elasticsearch.common.settings.Settings) CompressedXContent(org.elasticsearch.common.compress.CompressedXContent) Map(java.util.Map) MergeReason(org.elasticsearch.index.mapper.MapperService.MergeReason) Collections(java.util.Collections) CompressedXContent(org.elasticsearch.common.compress.CompressedXContent) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString)

Example 10 with Function

use of java.util.function.Function in project elasticsearch by elastic.

the class IndexShardOperationsLockTests method testThreadContextPreservedIfBlock.

/**
     * Tests that the ThreadContext is restored when a operation is executed after it has been delayed due to a block
     */
public void testThreadContextPreservedIfBlock() throws ExecutionException, InterruptedException, TimeoutException {
    final ThreadContext context = threadPool.getThreadContext();
    final Function<ActionListener<Releasable>, Boolean> contextChecker = (listener) -> {
        if ("bar".equals(context.getHeader("foo")) == false) {
            listener.onFailure(new IllegalStateException("context did not have value [bar] for header [foo]. Actual value [" + context.getHeader("foo") + "]"));
        } else if ("baz".equals(context.getTransient("bar")) == false) {
            listener.onFailure(new IllegalStateException("context did not have value [baz] for transient [bar]. Actual value [" + context.getTransient("bar") + "]"));
        } else {
            return true;
        }
        return false;
    };
    PlainActionFuture<Releasable> future = new PlainActionFuture<Releasable>() {

        @Override
        public void onResponse(Releasable releasable) {
            if (contextChecker.apply(this)) {
                super.onResponse(releasable);
            }
        }
    };
    PlainActionFuture<Releasable> future2 = new PlainActionFuture<Releasable>() {

        @Override
        public void onResponse(Releasable releasable) {
            if (contextChecker.apply(this)) {
                super.onResponse(releasable);
            }
        }
    };
    try (Releasable releasable = blockAndWait()) {
        // when the releasable is closed
        try (ThreadContext.StoredContext ignore = context.newStoredContext(false)) {
            context.putHeader("foo", "bar");
            context.putTransient("bar", "baz");
            // test both with and without a executor name
            block.acquire(future, ThreadPool.Names.GENERIC, true);
            block.acquire(future2, null, true);
        }
        assertFalse(future.isDone());
    }
    future.get(1, TimeUnit.HOURS).close();
    future2.get(1, TimeUnit.HOURS).close();
}
Also used : TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) AfterClass(org.junit.AfterClass) BeforeClass(org.junit.BeforeClass) PlainActionFuture(org.elasticsearch.action.support.PlainActionFuture) ThreadContext(org.elasticsearch.common.util.concurrent.ThreadContext) TimeoutException(java.util.concurrent.TimeoutException) Function(java.util.function.Function) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) After(org.junit.After) Matchers.equalTo(org.hamcrest.Matchers.equalTo) ThreadPool(org.elasticsearch.threadpool.ThreadPool) ESTestCase(org.elasticsearch.test.ESTestCase) ActionListener(org.elasticsearch.action.ActionListener) Releasable(org.elasticsearch.common.lease.Releasable) Before(org.junit.Before) ActionListener(org.elasticsearch.action.ActionListener) PlainActionFuture(org.elasticsearch.action.support.PlainActionFuture) ThreadContext(org.elasticsearch.common.util.concurrent.ThreadContext) Releasable(org.elasticsearch.common.lease.Releasable)

Aggregations

Function (java.util.function.Function)1261 List (java.util.List)606 Map (java.util.Map)447 ArrayList (java.util.ArrayList)416 Test (org.junit.Test)358 Collectors (java.util.stream.Collectors)324 HashMap (java.util.HashMap)287 Collections (java.util.Collections)284 Arrays (java.util.Arrays)271 Set (java.util.Set)255 IOException (java.io.IOException)252 Collection (java.util.Collection)192 HashSet (java.util.HashSet)191 TimeUnit (java.util.concurrent.TimeUnit)174 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)158 Optional (java.util.Optional)157 Assert (org.junit.Assert)137 Consumer (java.util.function.Consumer)134 Supplier (java.util.function.Supplier)126 CompletableFuture (java.util.concurrent.CompletableFuture)121