ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CompletableFutureTest.java
(Generate patch)

Comparing jsr166/src/test/tck/CompletableFutureTest.java (file contents):
Revision 1.155 by jsr166, Sun Jun 26 20:03:10 2016 UTC vs.
Revision 1.156 by jsr166, Sun Jun 26 23:45:46 2016 UTC

# Line 4170 | Line 4170 | public class CompletableFutureTest exten
4170          assertEquals(5 * 3 * n, count.get());
4171      }
4172  
4173 +    /** a66 -Dvmoptions=-Xmx8m -Djsr166.tckTestClass=CompletableFutureTest tck */
4174 +    public void testCoCompletionGarbage() throws Throwable {
4175 +        // final int n = 3_000_000;
4176 +        final int n = 100;
4177 +        final CompletableFuture<Integer> incomplete = new CompletableFuture<>();
4178 +        CompletableFuture<Integer> f;
4179 +        for (int i = 0; i < n; i++) {
4180 +            f = new CompletableFuture<>();
4181 +            f.runAfterEither(incomplete, () -> {});
4182 +            f.complete(null);
4183 +
4184 +            f = new CompletableFuture<>();
4185 +            f.acceptEither(incomplete, (x) -> {});
4186 +            f.complete(null);
4187 +
4188 +            f = new CompletableFuture<>();
4189 +            f.applyToEither(incomplete, (x) -> x);
4190 +            f.complete(null);
4191 +
4192 +            f = new CompletableFuture<>();
4193 +            CompletableFuture.anyOf(new CompletableFuture<?>[] { f, incomplete });
4194 +            f.complete(null);
4195 +        }
4196 +
4197 +        for (int i = 0; i < n; i++) {
4198 +            f = new CompletableFuture<>();
4199 +            incomplete.runAfterEither(f, () -> {});
4200 +            f.complete(null);
4201 +
4202 +            f = new CompletableFuture<>();
4203 +            incomplete.acceptEither(f, (x) -> {});
4204 +            f.complete(null);
4205 +
4206 +            f = new CompletableFuture<>();
4207 +            incomplete.applyToEither(f, (x) -> x);
4208 +            f.complete(null);
4209 +
4210 +            f = new CompletableFuture<>();
4211 +            CompletableFuture.anyOf(new CompletableFuture<?>[] { incomplete, f });
4212 +            f.complete(null);
4213 +        }
4214 +    }
4215 +
4216   //     static <U> U join(CompletionStage<U> stage) {
4217   //         CompletableFuture<U> f = new CompletableFuture<>();
4218   //         stage.whenComplete((v, ex) -> {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines