Search in sources :

Example 41 with ConcurrentLinkedQueue

use of java.util.concurrent.ConcurrentLinkedQueue in project jetty.project by eclipse.

the class AsyncRestServlet method doGet.

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Long start = System.nanoTime();
    // Do we have results yet?
    Queue<Map<String, String>> results = (Queue<Map<String, String>>) request.getAttribute(RESULTS_ATTR);
    // If no results, this must be the first dispatch, so send the REST request(s)
    if (results == null) {
        // define results data structures
        final Queue<Map<String, String>> resultsQueue = new ConcurrentLinkedQueue<>();
        request.setAttribute(RESULTS_ATTR, results = resultsQueue);
        // suspend the request
        // This is done before scheduling async handling to avoid race of
        // dispatch before startAsync!
        final AsyncContext async = request.startAsync();
        async.setTimeout(30000);
        // extract keywords to search for
        String[] keywords = sanitize(request.getParameter(ITEMS_PARAM)).split(",");
        final AtomicInteger outstanding = new AtomicInteger(keywords.length);
        // Send request each keyword
        for (final String item : keywords) {
            _client.newRequest(restURL(item)).method(HttpMethod.GET).send(new AsyncRestRequest() {

                @Override
                void onAuctionFound(Map<String, String> auction) {
                    resultsQueue.add(auction);
                }

                @Override
                void onComplete() {
                    if (outstanding.decrementAndGet() <= 0)
                        async.dispatch();
                }
            });
        }
        // save timing info and return
        request.setAttribute(START_ATTR, start);
        request.setAttribute(DURATION_ATTR, System.nanoTime() - start);
        return;
    }
    // We have results!
    // Generate the response
    String thumbs = generateThumbs(results);
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html><head>");
    out.println(STYLE);
    out.println("</head><body><small>");
    long initial = (Long) request.getAttribute(DURATION_ATTR);
    long start0 = (Long) request.getAttribute(START_ATTR);
    long now = System.nanoTime();
    long total = now - start0;
    long generate = now - start;
    long thread = initial + generate;
    out.print("<b>Asynchronous: " + sanitize(request.getParameter(ITEMS_PARAM)) + "</b><br/>");
    out.print("Total Time: " + ms(total) + "ms<br/>");
    out.print("Thread held (<span class='red'>red</span>): " + ms(thread) + "ms (" + ms(initial) + " initial + " + ms(generate) + " generate )<br/>");
    out.print("Async wait (<span class='green'>green</span>): " + ms(total - thread) + "ms<br/>");
    out.println("<img border='0px' src='asyncrest/red.png'   height='20px' width='" + width(initial) + "px'>" + "<img border='0px' src='asyncrest/green.png' height='20px' width='" + width(total - thread) + "px'>" + "<img border='0px' src='asyncrest/red.png'   height='20px' width='" + width(generate) + "px'>");
    out.println("<hr />");
    out.println(thumbs);
    out.println("</small>");
    out.println("</body></html>");
    out.close();
}
Also used : AsyncContext(javax.servlet.AsyncContext) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) Queue(java.util.Queue) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) Map(java.util.Map) PrintWriter(java.io.PrintWriter)

Example 42 with ConcurrentLinkedQueue

use of java.util.concurrent.ConcurrentLinkedQueue in project jetty.project by eclipse.

the class BlockingArrayQueueTest method testConcurrentAccess.

@Test
@Slow
public void testConcurrentAccess() throws Exception {
    final int THREADS = 50;
    final int LOOPS = 1000;
    final BlockingArrayQueue<Integer> queue = new BlockingArrayQueue<>(1 + THREADS * LOOPS);
    final ConcurrentLinkedQueue<Integer> produced = new ConcurrentLinkedQueue<>();
    final ConcurrentLinkedQueue<Integer> consumed = new ConcurrentLinkedQueue<>();
    final AtomicBoolean running = new AtomicBoolean(true);
    // start consumers
    final CyclicBarrier barrier0 = new CyclicBarrier(THREADS + 1);
    for (int i = 0; i < THREADS; i++) {
        new Thread() {

            @Override
            public void run() {
                final Random random = new Random();
                setPriority(getPriority() - 1);
                try {
                    while (running.get()) {
                        int r = 1 + random.nextInt(10);
                        if (r % 2 == 0) {
                            Integer msg = queue.poll();
                            if (msg == null) {
                                Thread.sleep(1 + random.nextInt(10));
                                continue;
                            }
                            consumed.add(msg);
                        } else {
                            Integer msg = queue.poll(r, TimeUnit.MILLISECONDS);
                            if (msg != null)
                                consumed.add(msg);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    try {
                        barrier0.await();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }.start();
    }
    // start producers
    final CyclicBarrier barrier1 = new CyclicBarrier(THREADS + 1);
    for (int i = 0; i < THREADS; i++) {
        final int id = i;
        new Thread() {

            @Override
            public void run() {
                final Random random = new Random();
                try {
                    for (int j = 0; j < LOOPS; j++) {
                        Integer msg = random.nextInt();
                        produced.add(msg);
                        if (!queue.offer(msg))
                            throw new Exception(id + " FULL! " + queue.size());
                        Thread.sleep(1 + random.nextInt(10));
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    try {
                        barrier1.await();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }.start();
    }
    barrier1.await();
    int size = queue.size();
    int last = size - 1;
    while (size > 0 && size != last) {
        last = size;
        Thread.sleep(500);
        size = queue.size();
    }
    running.set(false);
    barrier0.await();
    HashSet<Integer> prodSet = new HashSet<>(produced);
    HashSet<Integer> consSet = new HashSet<>(consumed);
    Assert.assertEquals(prodSet, consSet);
}
Also used : CyclicBarrier(java.util.concurrent.CyclicBarrier) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Random(java.util.Random) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) HashSet(java.util.HashSet) Test(org.junit.Test) Slow(org.eclipse.jetty.toolchain.test.annotation.Slow)

Example 43 with ConcurrentLinkedQueue

use of java.util.concurrent.ConcurrentLinkedQueue in project jetty.project by eclipse.

the class AsyncIOServletTest method testWriteFromOnDataAvailable.

@Test
public void testWriteFromOnDataAvailable() throws Exception {
    Queue<Throwable> errors = new ConcurrentLinkedQueue<>();
    CountDownLatch writeLatch = new CountDownLatch(1);
    start(new HttpServlet() {

        @Override
        protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            AsyncContext asyncContext = request.startAsync();
            request.getInputStream().setReadListener(new ReadListener() {

                @Override
                public void onDataAvailable() throws IOException {
                    ServletInputStream input = request.getInputStream();
                    ServletOutputStream output = response.getOutputStream();
                    while (input.isReady()) {
                        byte[] buffer = new byte[512];
                        int read = input.read(buffer);
                        if (read < 0) {
                            asyncContext.complete();
                            break;
                        }
                        if (output.isReady())
                            output.write(buffer, 0, read);
                        else
                            Assert.fail();
                    }
                }

                @Override
                public void onAllDataRead() throws IOException {
                    asyncContext.complete();
                }

                @Override
                public void onError(Throwable t) {
                    errors.offer(t);
                }
            });
            response.getOutputStream().setWriteListener(new WriteListener() {

                @Override
                public void onWritePossible() throws IOException {
                    writeLatch.countDown();
                }

                @Override
                public void onError(Throwable t) {
                    errors.offer(t);
                }
            });
        }
    });
    String content = "0123456789ABCDEF";
    DeferredContentProvider contentProvider = new DeferredContentProvider();
    contentProvider.offer(ByteBuffer.wrap(content.getBytes(StandardCharsets.UTF_8)));
    CountDownLatch clientLatch = new CountDownLatch(1);
    client.newRequest(newURI()).method(HttpMethod.POST).path(servletPath).content(contentProvider).send(new BufferingResponseListener() {

        @Override
        public void onComplete(Result result) {
            if (result.isSucceeded()) {
                Response response = result.getResponse();
                assertThat(response.getStatus(), Matchers.equalTo(HttpStatus.OK_200));
                assertThat(getContentAsString(), Matchers.equalTo(content));
                assertThat(errors, Matchers.hasSize(0));
                clientLatch.countDown();
            }
        }
    });
    assertTrue(writeLatch.await(5, TimeUnit.SECONDS));
    contentProvider.close();
    assertTrue(clientLatch.await(5, TimeUnit.SECONDS));
}
Also used : ServletOutputStream(javax.servlet.ServletOutputStream) HttpServlet(javax.servlet.http.HttpServlet) HttpServletResponse(javax.servlet.http.HttpServletResponse) AsyncContext(javax.servlet.AsyncContext) UncheckedIOException(java.io.UncheckedIOException) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) Matchers.containsString(org.hamcrest.Matchers.containsString) CountDownLatch(java.util.concurrent.CountDownLatch) ReadListener(javax.servlet.ReadListener) Result(org.eclipse.jetty.client.api.Result) HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletException(javax.servlet.ServletException) ContentResponse(org.eclipse.jetty.client.api.ContentResponse) Response(org.eclipse.jetty.client.api.Response) HttpServletResponse(javax.servlet.http.HttpServletResponse) ServletInputStream(javax.servlet.ServletInputStream) DeferredContentProvider(org.eclipse.jetty.client.util.DeferredContentProvider) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) WriteListener(javax.servlet.WriteListener) BufferingResponseListener(org.eclipse.jetty.client.util.BufferingResponseListener) Test(org.junit.Test)

Example 44 with ConcurrentLinkedQueue

use of java.util.concurrent.ConcurrentLinkedQueue in project jetty.project by eclipse.

the class StressTest method doThreads.

private void doThreads(int threadCount, final int loops, final boolean persistent) throws Throwable {
    final Throwable[] throwables = new Throwable[threadCount];
    final Thread[] threads = new Thread[threadCount];
    try {
        for (int i = 0; i < threadCount; i++) {
            final int id = i;
            final String name = "T" + i;
            Thread.sleep(_random.nextInt(100));
            threads[i] = new Thread() {

                @Override
                public void run() {
                    try {
                        doLoops(id, name, loops, persistent);
                    } catch (Throwable th) {
                        th.printStackTrace();
                        throwables[id] = th;
                    }
                }
            };
        }
        _loops = new AtomicInteger[threadCount];
        for (int i = 0; i < threadCount; i++) {
            _loops[i] = new AtomicInteger(0);
            threads[i].start();
        }
        String last = null;
        int same = 0;
        while (true) {
            Thread.sleep(1000L);
            int finished = 0;
            int errors = 0;
            int min = loops;
            int max = 0;
            int total = 0;
            for (int i = 0; i < threadCount; i++) {
                int l = _loops[i].get();
                if (l < 0) {
                    errors++;
                    total -= l;
                } else {
                    if (l < min)
                        min = l;
                    if (l > max)
                        max = l;
                    total += l;
                    if (l == loops)
                        finished++;
                }
            }
            String status = "min/ave/max/target=" + min + "/" + (total / threadCount) + "/" + max + "/" + loops + " errors/finished/loops=" + errors + "/" + finished + "/" + threadCount + " idle/threads=" + (_threads.getIdleThreads()) + "/" + _threads.getThreads();
            if (status.equals(last)) {
                if (same++ > 5) {
                    System.err.println("STALLED!!!");
                    System.err.println(_server.getThreadPool().toString());
                    Thread.sleep(5000);
                    System.exit(1);
                }
            } else
                same = 0;
            last = status;
            LOG.info(_server.getThreadPool().toString() + " " + status);
            if ((finished + errors) == threadCount)
                break;
        }
        for (Thread thread : threads) thread.join();
        for (Throwable throwable : throwables) if (throwable != null)
            throw throwable;
        for (ConcurrentLinkedQueue _latency : _latencies) assertEquals(_handled.get(), _latency.size());
    } finally {
        // System.err.println();
        final int quantums = 48;
        final int[][] count = new int[_latencies.length][quantums];
        final int[] length = new int[_latencies.length];
        final int[] other = new int[_latencies.length];
        long total = 0;
        for (int i = 0; i < _latencies.length; i++) {
            Queue<Long> latencies = _latencies[i];
            length[i] = latencies.size();
            loop: for (long latency : latencies) {
                if (i == 4)
                    total += latency;
                for (int q = 0; q < quantums; q++) {
                    if (latency >= (q * 100) && latency < ((q + 1) * 100)) {
                        count[i][q]++;
                        continue loop;
                    }
                }
                other[i]++;
            }
        }
        System.out.println("           stage:\tbind\twrite\trecv\tdispatch\twrote\ttotal");
        for (int q = 0; q < quantums; q++) {
            System.out.printf("%02d00<=l<%02d00", q, (q + 1));
            for (int i = 0; i < _latencies.length; i++) System.out.print("\t" + count[i][q]);
            System.out.println();
        }
        System.out.print("other       ");
        for (int i = 0; i < _latencies.length; i++) System.out.print("\t" + other[i]);
        System.out.println();
        System.out.print("HANDLED     ");
        for (int i = 0; i < _latencies.length; i++) System.out.print("\t" + _handled.get());
        System.out.println();
        System.out.print("TOTAL       ");
        for (int i = 0; i < _latencies.length; i++) System.out.print("\t" + length[i]);
        System.out.println();
        long ave = total / _latencies[4].size();
        System.out.println("ave=" + ave);
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 45 with ConcurrentLinkedQueue

use of java.util.concurrent.ConcurrentLinkedQueue in project buck by facebook.

the class CachingBuildEngine method processBuildRule.

private ListenableFuture<BuildResult> processBuildRule(final BuildRule rule, final BuildEngineBuildContext buildContext, final ExecutionContext executionContext, final OnDiskBuildInfo onDiskBuildInfo, final BuildInfoRecorder buildInfoRecorder, final BuildableContext buildableContext, final ConcurrentLinkedQueue<ListenableFuture<Void>> asyncCallbacks) {
    // If we've already seen a failure, exit early.
    if (!buildContext.isKeepGoing() && firstFailure != null) {
        return Futures.immediateFuture(BuildResult.canceled(rule, firstFailure));
    }
    final RuleKeyFactories ruleKeyFactory = ruleKeyFactories.apply(rule.getProjectFilesystem());
    try (BuildRuleEvent.Scope scope = BuildRuleEvent.resumeSuspendScope(buildContext.getEventBus(), rule, buildRuleDurationTracker, ruleKeyFactory.getDefaultRuleKeyFactory())) {
        // 1. Check if it's already built.
        Optional<RuleKey> cachedRuleKey = onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.RULE_KEY);
        final RuleKey defaultRuleKey = ruleKeyFactory.getDefaultRuleKeyFactory().build(rule);
        if (defaultRuleKey.equals(cachedRuleKey.orElse(null))) {
            return Futures.transform(markRuleAsUsed(rule, buildContext.getEventBus()), Functions.constant(BuildResult.success(rule, BuildRuleSuccessType.MATCHING_RULE_KEY, CacheResult.localKeyUnchangedHit())));
        }
        // 2. Rule key cache lookup.
        ListenableFuture<CacheResult> rulekeyCacheResult = cacheActivityService.submit(() -> {
            CacheResult cacheResult = tryToFetchArtifactFromBuildCacheAndOverlayOnTopOfProjectFilesystem(rule, defaultRuleKey, buildContext.getArtifactCache(), // TODO(shs96c): This should be a shared between all tests, not one per cell
            rule.getProjectFilesystem(), buildContext);
            if (cacheResult.getType().isSuccess()) {
                fillMissingBuildMetadataFromCache(cacheResult, buildInfoRecorder, BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY, BuildInfo.MetadataKey.DEP_FILE_RULE_KEY, BuildInfo.MetadataKey.DEP_FILE);
            }
            return cacheResult;
        }, CACHE_CHECK_RESOURCE_AMOUNTS);
        return Futures.transformAsync(rulekeyCacheResult, ruleAsyncFunction(rule, buildContext.getEventBus(), (cacheResult) -> handleRuleKeyCacheResult(rule, buildContext, executionContext, onDiskBuildInfo, buildInfoRecorder, buildableContext, asyncCallbacks, ruleKeyFactory, cacheResult)), serviceByAdjustingDefaultWeightsTo(SCHEDULING_MORE_WORK_RESOURCE_AMOUNTS));
    }
}
Also used : OptionalCompat(com.facebook.buck.util.OptionalCompat) NoSuchFileException(java.nio.file.NoSuchFileException) GZIPInputStream(java.util.zip.GZIPInputStream) ArtifactCache(com.facebook.buck.artifact_cache.ArtifactCache) BufferedInputStream(java.io.BufferedInputStream) StepRunner(com.facebook.buck.step.StepRunner) BuckEvent(com.facebook.buck.event.BuckEvent) RuleKeyCalculationEvent(com.facebook.buck.event.RuleKeyCalculationEvent) ObjectMappers(com.facebook.buck.util.ObjectMappers) MoreFutures(com.facebook.buck.util.concurrent.MoreFutures) SettableFuture(com.google.common.util.concurrent.SettableFuture) ArtifactCompressionEvent(com.facebook.buck.event.ArtifactCompressionEvent) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) RuleKeyAndInputs(com.facebook.buck.rules.keys.RuleKeyAndInputs) Map(java.util.Map) RuleKeyFactories(com.facebook.buck.rules.keys.RuleKeyFactories) TypeReference(com.fasterxml.jackson.core.type.TypeReference) ArtifactInfo(com.facebook.buck.artifact_cache.ArtifactInfo) Path(java.nio.file.Path) WeightedListeningExecutorService(com.facebook.buck.util.concurrent.WeightedListeningExecutorService) Function(com.google.common.base.Function) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) Set(java.util.Set) SizeLimiter(com.facebook.buck.rules.keys.SizeLimiter) DefaultFileHashCache(com.facebook.buck.util.cache.DefaultFileHashCache) BuildTarget(com.facebook.buck.model.BuildTarget) Sets(com.google.common.collect.Sets) List(java.util.List) Stream(java.util.stream.Stream) StepFailedException(com.facebook.buck.step.StepFailedException) LazyPath(com.facebook.buck.io.LazyPath) ByteStreams(com.google.common.io.ByteStreams) DependencyFileEntry(com.facebook.buck.rules.keys.DependencyFileEntry) Optional(java.util.Optional) GZIPOutputStream(java.util.zip.GZIPOutputStream) MoreFunctions(com.facebook.buck.util.MoreFunctions) RuleKeyFactoryManager(com.facebook.buck.rules.keys.RuleKeyFactoryManager) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) BuckEventBus(com.facebook.buck.event.BuckEventBus) ProjectFileHashCache(com.facebook.buck.util.cache.ProjectFileHashCache) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) Step(com.facebook.buck.step.Step) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) AtomicReference(java.util.concurrent.atomic.AtomicReference) ConsoleEvent(com.facebook.buck.event.ConsoleEvent) BufferedOutputStream(java.io.BufferedOutputStream) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) ExecutionContext(com.facebook.buck.step.ExecutionContext) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) ThrowableConsoleEvent(com.facebook.buck.event.ThrowableConsoleEvent) ResourceAmounts(com.facebook.buck.util.concurrent.ResourceAmounts) Atomics(com.google.common.util.concurrent.Atomics) Nonnull(javax.annotation.Nonnull) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) Nullable(javax.annotation.Nullable) SupportsInputBasedRuleKey(com.facebook.buck.rules.keys.SupportsInputBasedRuleKey) MoreCollectors(com.facebook.buck.util.MoreCollectors) OutputStream(java.io.OutputStream) Logger(com.facebook.buck.log.Logger) Functions(com.google.common.base.Functions) CacheResultType(com.facebook.buck.artifact_cache.CacheResultType) Files(java.nio.file.Files) HashCode(com.google.common.hash.HashCode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Throwables(com.google.common.base.Throwables) IOException(java.io.IOException) HumanReadableException(com.facebook.buck.util.HumanReadableException) Maps(com.google.common.collect.Maps) FutureCallback(com.google.common.util.concurrent.FutureCallback) ExecutionException(java.util.concurrent.ExecutionException) ContextualProcessExecutor(com.facebook.buck.util.ContextualProcessExecutor) Futures(com.google.common.util.concurrent.Futures) BorrowablePath(com.facebook.buck.io.BorrowablePath) Paths(java.nio.file.Paths) CacheResult(com.facebook.buck.artifact_cache.CacheResult) FileHashCache(com.facebook.buck.util.cache.FileHashCache) Unzip(com.facebook.buck.zip.Unzip) Preconditions(com.google.common.base.Preconditions) AsyncFunction(com.google.common.util.concurrent.AsyncFunction) VisibleForTesting(com.google.common.annotations.VisibleForTesting) MoreFiles(com.facebook.buck.io.MoreFiles) SupportsDependencyFileRuleKey(com.facebook.buck.rules.keys.SupportsDependencyFileRuleKey) Collections(java.util.Collections) InputStream(java.io.InputStream) RuleKeyFactories(com.facebook.buck.rules.keys.RuleKeyFactories) SupportsInputBasedRuleKey(com.facebook.buck.rules.keys.SupportsInputBasedRuleKey) SupportsDependencyFileRuleKey(com.facebook.buck.rules.keys.SupportsDependencyFileRuleKey) CacheResult(com.facebook.buck.artifact_cache.CacheResult)

Aggregations

ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)236 Test (org.junit.Test)102 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)56 Watermark (org.apache.flink.streaming.api.watermark.Watermark)52 KeyedOneInputStreamOperatorTestHarness (org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness)43 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)40 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)40 CountDownLatch (java.util.concurrent.CountDownLatch)37 ArrayList (java.util.ArrayList)31 TimeWindow (org.apache.flink.streaming.api.windowing.windows.TimeWindow)28 ListStateDescriptor (org.apache.flink.api.common.state.ListStateDescriptor)18 ReducingStateDescriptor (org.apache.flink.api.common.state.ReducingStateDescriptor)17 IOException (java.io.IOException)15 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)15 StreamRecord (org.apache.flink.streaming.runtime.streamrecord.StreamRecord)14 ExecutionException (java.util.concurrent.ExecutionException)13 ExecutorService (java.util.concurrent.ExecutorService)13 Map (java.util.Map)12 OperatorStateHandles (org.apache.flink.streaming.runtime.tasks.OperatorStateHandles)12 Iterator (java.util.Iterator)11