├── .gitignore ├── README.md ├── art └── streamsupport-sf.png ├── docs ├── apidocs │ ├── allclasses-frame.html │ ├── allclasses-noframe.html │ ├── constant-values.html │ ├── deprecated-list.html │ ├── help-doc.html │ ├── index-all.html │ ├── index.html │ ├── java9 │ │ └── util │ │ │ ├── Lists.html │ │ │ ├── Maps.html │ │ │ ├── Objects.html │ │ │ ├── Sets.html │ │ │ ├── class-use │ │ │ ├── Lists.html │ │ │ ├── Maps.html │ │ │ ├── Objects.html │ │ │ └── Sets.html │ │ │ ├── concurrent │ │ │ ├── CompletableFuture.AsynchronousCompletionTask.html │ │ │ ├── CompletableFuture.html │ │ │ ├── CompletionStage.html │ │ │ ├── CountedCompleter.html │ │ │ ├── Flow.Processor.html │ │ │ ├── Flow.Publisher.html │ │ │ ├── Flow.Subscriber.html │ │ │ ├── Flow.Subscription.html │ │ │ ├── Flow.html │ │ │ ├── ForkJoinPool.ForkJoinWorkerThreadFactory.html │ │ │ ├── ForkJoinPool.ManagedBlocker.html │ │ │ ├── ForkJoinPool.html │ │ │ ├── ForkJoinTask.html │ │ │ ├── ForkJoinWorkerThread.html │ │ │ ├── SubmissionPublisher.html │ │ │ ├── class-use │ │ │ │ ├── CompletableFuture.AsynchronousCompletionTask.html │ │ │ │ ├── CompletableFuture.html │ │ │ │ ├── CompletionStage.html │ │ │ │ ├── CountedCompleter.html │ │ │ │ ├── Flow.Processor.html │ │ │ │ ├── Flow.Publisher.html │ │ │ │ ├── Flow.Subscriber.html │ │ │ │ ├── Flow.Subscription.html │ │ │ │ ├── Flow.html │ │ │ │ ├── ForkJoinPool.ForkJoinWorkerThreadFactory.html │ │ │ │ ├── ForkJoinPool.ManagedBlocker.html │ │ │ │ ├── ForkJoinPool.html │ │ │ │ ├── ForkJoinTask.html │ │ │ │ ├── ForkJoinWorkerThread.html │ │ │ │ └── SubmissionPublisher.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ ├── overview-frame.html │ ├── overview-summary.html │ ├── overview-tree.html │ ├── package-list │ ├── script.js │ ├── serialized-form.html │ └── stylesheet.css ├── images │ ├── bg_hr.png │ ├── blacktocat.png │ ├── icon_download.png │ └── sprite_download.png ├── index.html ├── scripts │ └── prettify │ │ ├── prettify.css │ │ ├── prettify.js │ │ └── run_prettify.js └── stylesheets │ ├── pygment_trac.css │ └── stylesheet.css ├── pom.xml └── src └── main └── java └── java9 └── util ├── ImmutableCollections.java ├── KeyValueHolder.java ├── Lists.java ├── Maps.java ├── Objects.java ├── Sets.java ├── concurrent ├── CompletableFuture.java ├── CompletionStage.java ├── CountedCompleter.java ├── Flow.java ├── ForkJoinPool.java ├── ForkJoinTask.java ├── ForkJoinWorkerThread.java ├── SubmissionPublisher.java ├── TLRandom.java ├── UnsafeAccess.java └── package-info.java └── package-info.java /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.classpath 3 | /.project 4 | /.settings/org.eclipse.jdt.core.prefs 5 | /.settings/org.eclipse.m2e.core.prefs 6 | /.settings/org.eclipse.core.resources.prefs 7 | /upload/ 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Maven Central](https://img.shields.io/maven-central/v/net.sourceforge.streamsupport/java9-concurrent-backport.svg)](http://mvnrepository.com/artifact/net.sourceforge.streamsupport/java9-concurrent-backport) 2 | [![javadoc.io](https://javadoc.io/badge2/net.sourceforge.streamsupport/java9-concurrent-backport/javadoc.svg)](https://javadoc.io/doc/net.sourceforge.streamsupport/java9-concurrent-backport) 3 | 4 | # java9-concurrent-backport 5 | 6 | ![](art/streamsupport-sf.png) 7 | 8 | java9-concurrent-backport is a backport of the upgraded (`JEP 266`) Java 9 CompletableFuture API 9 | (extended by the new Java 12 CSR `JDK-8211010` exception handling methods) for Java 8. 10 | In addition, it contains a Java 8 version of the new Java 9 reactive-streams Flow and SubmissionPublisher 11 | API (also JEP 266) and of the new Java 9 Collections factory methods from `JEP 269` (updated to the 12 | Java 14 implementation). 13 | 14 | The API is exactly the same as in Java 14 with the exception that it doesn't live in the package 15 | `java.util(.concurrent)` but rather in the package `java9.util(.concurrent)`. 16 | 17 | The JEP 269 convenience factory methods for collections are located in companion classes for the 18 | corresponding `java.util` interfaces: 19 | 20 | * `java9.util.Lists` 21 | * `java9.util.Maps` 22 | * `java9.util.Sets` 23 | 24 | 25 | ### Maven: 26 | 27 | ```xml 28 | 29 | net.sourceforge.streamsupport 30 | java9-concurrent-backport 31 | 2.0.5 32 | 33 | ``` 34 | 35 | 36 | The minimum runtime requirement is OpenJDK (Oracle) Java 8. 37 | 38 | 39 | ## LICENSE 40 | 41 | GNU General Public License, version 2, with the Classpath Exception (and [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/) for JSR-166 derived code) 42 | -------------------------------------------------------------------------------- /art/streamsupport-sf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefan-zobel/java9-concurrent-backport/29526567bb18f0ffb91fe78a19cc8adc58a98b02/art/streamsupport-sf.png -------------------------------------------------------------------------------- /docs/apidocs/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 |

All Classes

14 |
15 | 36 |
37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/apidocs/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 |

All Classes

14 |
15 | 36 |
37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/apidocs/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Constant Field Values (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Constant Field Values

75 |

Contents

76 |
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Deprecated List (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Deprecated API

75 |

Contents

76 |
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/help-doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | API Help (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

How This API Document Is Organized

75 |
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
76 |
77 |
78 | 181 | This help file applies to API documentation generated using the standard doclet.
182 | 183 |
184 | 185 | 186 |
Skip navigation links
187 | 188 | 189 | 190 | 200 |
201 | 228 | 229 |

Copyright © 2022. All rights reserved.

230 | 231 | 232 | -------------------------------------------------------------------------------- /docs/apidocs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API 8 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | <noscript> 69 | <div>JavaScript is disabled on your browser.</div> 70 | </noscript> 71 | <h2>Frame Alert</h2> 72 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/class-use/Lists.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class java9.util.Lists (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Class
java9.util.Lists

75 |
76 |
No usage of java9.util.Lists
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/class-use/Maps.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class java9.util.Maps (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Class
java9.util.Maps

75 |
76 |
No usage of java9.util.Maps
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/class-use/Objects.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class java9.util.Objects (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Class
java9.util.Objects

75 |
76 |
No usage of java9.util.Objects
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/class-use/Sets.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class java9.util.Sets (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Class
java9.util.Sets

75 |
76 |
No usage of java9.util.Sets
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/CompletableFuture.AsynchronousCompletionTask.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CompletableFuture.AsynchronousCompletionTask (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 87 | 88 | 89 |
90 |
java9.util.concurrent
91 |

Interface CompletableFuture.AsynchronousCompletionTask

92 |
93 |
94 |
95 | 113 |
114 |
115 | 116 | 117 |
118 | 119 | 120 |
Skip navigation links
121 | 122 | 123 | 124 | 134 |
135 | 177 | 178 |

Copyright © 2022. All rights reserved.

179 | 180 | 181 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/Flow.Processor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Flow.Processor (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 87 | 88 | 89 |
90 |
java9.util.concurrent
91 |

Interface Flow.Processor<T,R>

92 |
93 |
94 |
95 | 117 |
118 |
119 | 145 |
146 |
147 | 148 | 149 |
150 | 151 | 152 |
Skip navigation links
153 | 154 | 155 | 156 | 166 |
167 | 209 | 210 |

Copyright © 2022. All rights reserved.

211 | 212 | 213 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/CompletableFuture.AsynchronousCompletionTask.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Interface java9.util.concurrent.CompletableFuture.AsynchronousCompletionTask (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Interface
java9.util.concurrent.CompletableFuture.AsynchronousCompletionTask

75 |
76 |
No usage of java9.util.concurrent.CompletableFuture.AsynchronousCompletionTask
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/Flow.Processor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Interface java9.util.concurrent.Flow.Processor (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Interface
java9.util.concurrent.Flow.Processor

75 |
76 |
No usage of java9.util.concurrent.Flow.Processor
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/Flow.Publisher.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Interface java9.util.concurrent.Flow.Publisher (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Interface
java9.util.concurrent.Flow.Publisher

75 |
76 |
77 | 136 |
137 | 138 |
139 | 140 | 141 |
Skip navigation links
142 | 143 | 144 | 145 | 155 |
156 | 183 | 184 |

Copyright © 2022. All rights reserved.

185 | 186 | 187 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/Flow.Subscription.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Interface java9.util.concurrent.Flow.Subscription (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Interface
java9.util.concurrent.Flow.Subscription

75 |
76 |
77 | 121 |
122 | 123 |
124 | 125 | 126 |
Skip navigation links
127 | 128 | 129 | 130 | 140 |
141 | 168 | 169 |

Copyright © 2022. All rights reserved.

170 | 171 | 172 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/Flow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class java9.util.concurrent.Flow (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Class
java9.util.concurrent.Flow

75 |
76 |
No usage of java9.util.concurrent.Flow
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/ForkJoinPool.ManagedBlocker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Interface java9.util.concurrent.ForkJoinPool.ManagedBlocker (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Interface
java9.util.concurrent.ForkJoinPool.ManagedBlocker

75 |
76 |
77 | 120 |
121 | 122 |
123 | 124 | 125 |
Skip navigation links
126 | 127 | 128 | 129 | 139 |
140 | 167 | 168 |

Copyright © 2022. All rights reserved.

169 | 170 | 171 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/ForkJoinWorkerThread.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class java9.util.concurrent.ForkJoinWorkerThread (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Class
java9.util.concurrent.ForkJoinWorkerThread

75 |
76 |
77 | 120 |
121 | 122 |
123 | 124 | 125 |
Skip navigation links
126 | 127 | 128 | 129 | 139 |
140 | 167 | 168 |

Copyright © 2022. All rights reserved.

169 | 170 | 171 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/class-use/SubmissionPublisher.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class java9.util.concurrent.SubmissionPublisher (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Class
java9.util.concurrent.SubmissionPublisher

75 |
76 |
No usage of java9.util.concurrent.SubmissionPublisher
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | java9.util.concurrent (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 |

java9.util.concurrent

14 |
15 |

Interfaces

16 | 26 |

Classes

27 | 36 |
37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | java9.util.concurrent Class Hierarchy (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Hierarchy For Package java9.util.concurrent

75 | Package Hierarchies: 76 | 79 |
80 |
81 |

Class Hierarchy

82 | 106 |

Interface Hierarchy

107 | 124 |
125 | 126 |
127 | 128 | 129 |
Skip navigation links
130 | 131 | 132 | 133 | 143 |
144 | 171 | 172 |

Copyright © 2022. All rights reserved.

173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/concurrent/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package java9.util.concurrent (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Package
java9.util.concurrent

75 |
76 |
77 | 171 |
172 | 173 |
174 | 175 | 176 |
Skip navigation links
177 | 178 | 179 | 180 | 190 |
191 | 218 | 219 |

Copyright © 2022. All rights reserved.

220 | 221 | 222 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | java9.util (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 |

java9.util

14 |
15 |

Classes

16 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | java9.util Class Hierarchy (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Hierarchy For Package java9.util

75 | Package Hierarchies: 76 | 79 |
80 |
81 |

Class Hierarchy

82 | 92 |
93 | 94 |
95 | 96 | 97 |
Skip navigation links
98 | 99 | 100 | 101 | 111 |
112 | 139 | 140 |

Copyright © 2022. All rights reserved.

141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/apidocs/java9/util/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package java9.util (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

Uses of Package
java9.util

75 |
76 |
No usage of java9.util
77 | 78 |
79 | 80 | 81 |
Skip navigation links
82 | 83 | 84 | 85 | 95 |
96 | 123 | 124 |

Copyright © 2022. All rights reserved.

125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/apidocs/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview List (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 |
All Classes
14 |
15 |

Packages

16 | 20 |
21 |

 

22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/apidocs/overview-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview (net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API) 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
Skip navigation links
31 | 32 | 33 | 34 | 44 |
45 | 72 | 73 |
74 |

net.sourceforge.streamsupport:java9-concurrent-backport 2.0.5 API

75 |
76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 91 | 92 | 93 | 94 | 97 | 98 | 99 |
Packages 
PackageDescription
java9.util 87 |
Provides a Java 8 backport of the 88 | JEP 269: Convenience Factory 89 | Methods for Collections that were introduced in Java 9.
90 |
java9.util.concurrent 95 |
Some of the Java 8 and Java 9 utility classes commonly used in concurrent programming.
96 |
100 |
101 | 102 |
103 | 104 | 105 |
Skip navigation links
106 | 107 | 108 | 109 | 119 |
120 | 147 | 148 |

Copyright © 2022. All rights reserved.

149 | 150 | 151 | -------------------------------------------------------------------------------- /docs/apidocs/package-list: -------------------------------------------------------------------------------- 1 | java9.util 2 | java9.util.concurrent 3 | -------------------------------------------------------------------------------- /docs/apidocs/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/images/bg_hr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefan-zobel/java9-concurrent-backport/29526567bb18f0ffb91fe78a19cc8adc58a98b02/docs/images/bg_hr.png -------------------------------------------------------------------------------- /docs/images/blacktocat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefan-zobel/java9-concurrent-backport/29526567bb18f0ffb91fe78a19cc8adc58a98b02/docs/images/blacktocat.png -------------------------------------------------------------------------------- /docs/images/icon_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefan-zobel/java9-concurrent-backport/29526567bb18f0ffb91fe78a19cc8adc58a98b02/docs/images/icon_download.png -------------------------------------------------------------------------------- /docs/images/sprite_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefan-zobel/java9-concurrent-backport/29526567bb18f0ffb91fe78a19cc8adc58a98b02/docs/images/sprite_download.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | java9-concurrent-backport : Backport of the JEP 266 Java 9 CompletableFuture API for Java 8 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | View on GitHub 21 | 22 |

java9-concurrent-backport

23 |

Backport of the Java 9 CompletableFuture API
(JEP 266) for Java 8.

In addition, it contains a Java 8 version of the new Java 9
reactive-streams Flow and SubmissionPublisher API (JEP 266)
and of the new Java 9 Collections factory methods (JEP 269)

24 | 25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 33 |

Javadoc online

34 | 35 |

See the online Javadoc for more details about the API

36 | 37 | 38 |

Downloads

39 | 40 | 45 | 46 | 47 | 48 |

Dependencies

49 |

No dependencies

50 | 51 | 52 |

License

53 |

java9-concurrent-backport is free to use and licensed under the GPL2, CE
(GNU General Public License, version 2, with the Classpath Exception)

54 | 55 | 56 |

Credits

57 | 58 |

java9-concurrent-backport builds on the code of the android-retrofuture, android-retroflow and android-retrostreams projects

59 | 60 |
61 | 62 |
63 | 64 | 65 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /docs/scripts/prettify/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} -------------------------------------------------------------------------------- /docs/stylesheets/pygment_trac.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #f0f3f3; } 3 | .highlight .c { color: #0099FF; font-style: italic } /* Comment */ 4 | .highlight .err { color: #AA0000; background-color: #FFAAAA } /* Error */ 5 | .highlight .k { color: #006699; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #555555 } /* Operator */ 7 | .highlight .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #009999 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #0099FF; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */ 11 | .highlight .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #003300; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */ 16 | .highlight .go { color: #AAAAAA } /* Generic.Output */ 17 | .highlight .gp { color: #000099; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #003300; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #99CC66 } /* Generic.Traceback */ 21 | .highlight .kc { color: #006699; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #006699 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #007788; font-weight: bold } /* Keyword.Type */ 27 | .highlight .m { color: #FF6600 } /* Literal.Number */ 28 | .highlight .s { color: #CC3300 } /* Literal.String */ 29 | .highlight .na { color: #330099 } /* Name.Attribute */ 30 | .highlight .nb { color: #336666 } /* Name.Builtin */ 31 | .highlight .nc { color: #00AA88; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #336600 } /* Name.Constant */ 33 | .highlight .nd { color: #9999FF } /* Name.Decorator */ 34 | .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #CC0000; font-weight: bold } /* Name.Exception */ 36 | .highlight .nf { color: #CC00FF } /* Name.Function */ 37 | .highlight .nl { color: #9999FF } /* Name.Label */ 38 | .highlight .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #330099; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #003333 } /* Name.Variable */ 41 | .highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mf { color: #FF6600 } /* Literal.Number.Float */ 44 | .highlight .mh { color: #FF6600 } /* Literal.Number.Hex */ 45 | .highlight .mi { color: #FF6600 } /* Literal.Number.Integer */ 46 | .highlight .mo { color: #FF6600 } /* Literal.Number.Oct */ 47 | .highlight .sb { color: #CC3300 } /* Literal.String.Backtick */ 48 | .highlight .sc { color: #CC3300 } /* Literal.String.Char */ 49 | .highlight .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */ 50 | .highlight .s2 { color: #CC3300 } /* Literal.String.Double */ 51 | .highlight .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */ 52 | .highlight .sh { color: #CC3300 } /* Literal.String.Heredoc */ 53 | .highlight .si { color: #AA0000 } /* Literal.String.Interpol */ 54 | .highlight .sx { color: #CC3300 } /* Literal.String.Other */ 55 | .highlight .sr { color: #33AAAA } /* Literal.String.Regex */ 56 | .highlight .s1 { color: #CC3300 } /* Literal.String.Single */ 57 | .highlight .ss { color: #FFCC33 } /* Literal.String.Symbol */ 58 | .highlight .bp { color: #336666 } /* Name.Builtin.Pseudo */ 59 | .highlight .vc { color: #003333 } /* Name.Variable.Class */ 60 | .highlight .vg { color: #003333 } /* Name.Variable.Global */ 61 | .highlight .vi { color: #003333 } /* Name.Variable.Instance */ 62 | .highlight .il { color: #FF6600 } /* Literal.Number.Integer.Long */ 63 | 64 | .type-csharp .highlight .k { color: #0000FF } 65 | .type-csharp .highlight .kt { color: #0000FF } 66 | .type-csharp .highlight .nf { color: #000000; font-weight: normal } 67 | .type-csharp .highlight .nc { color: #2B91AF } 68 | .type-csharp .highlight .nn { color: #000000 } 69 | .type-csharp .highlight .s { color: #A31515 } 70 | .type-csharp .highlight .sc { color: #A31515 } 71 | -------------------------------------------------------------------------------- /docs/stylesheets/stylesheet.css: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Slate Theme for Github Pages 3 | by Jason Costello, @jsncostello 4 | *******************************************************************************/ 5 | 6 | @import url(pygment_trac.css); 7 | 8 | /******************************************************************************* 9 | MeyerWeb Reset 10 | *******************************************************************************/ 11 | 12 | html, body, div, span, applet, object, iframe, 13 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 14 | a, abbr, acronym, address, big, cite, code, 15 | del, dfn, em, img, ins, kbd, q, s, samp, 16 | small, strike, strong, sub, sup, tt, var, 17 | b, u, i, center, 18 | dl, dt, dd, ol, ul, li, 19 | fieldset, form, label, legend, 20 | table, caption, tbody, tfoot, thead, tr, td, 21 | article, aside, canvas, details, embed, 22 | figure, figcaption, footer, header, hgroup, 23 | menu, nav, output, ruby, section, summary, 24 | time, mark, audio, video { 25 | margin: 0; 26 | padding: 0; 27 | border: 0; 28 | font: inherit; 29 | vertical-align: baseline; 30 | } 31 | 32 | /* HTML5 display-role reset for older browsers */ 33 | article, aside, details, figcaption, figure, 34 | footer, header, hgroup, menu, nav, section { 35 | display: block; 36 | } 37 | 38 | ol, ul { 39 | list-style: none; 40 | } 41 | 42 | blockquote, q { 43 | } 44 | 45 | table { 46 | border-collapse: collapse; 47 | border-spacing: 0; 48 | } 49 | 50 | a:focus { 51 | outline: none; 52 | } 53 | 54 | /******************************************************************************* 55 | Theme Styles 56 | *******************************************************************************/ 57 | 58 | body { 59 | box-sizing: border-box; 60 | color:#373737; 61 | background: #212121; 62 | font-size: 16px; 63 | font-family: /*'Myriad Pro', Calibri,*/ Helvetica, Arial, sans-serif; 64 | line-height: 1.5; 65 | -webkit-font-smoothing: antialiased; 66 | } 67 | 68 | h1, h2, h3, h4, h5, h6 { 69 | margin: 10px 0; 70 | font-weight: 700; 71 | color:#222222; 72 | font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif; 73 | letter-spacing: -1px; 74 | } 75 | 76 | h1 { 77 | font-size: 36px; 78 | font-weight: 700; 79 | } 80 | 81 | h2 { 82 | padding-bottom: 10px; 83 | font-size: 32px; 84 | background: url('../images/bg_hr.png') repeat-x bottom; 85 | } 86 | 87 | h3 { 88 | font-size: 24px; 89 | } 90 | 91 | h4 { 92 | font-size: 21px; 93 | } 94 | 95 | h5 { 96 | font-size: 18px; 97 | } 98 | 99 | h6 { 100 | font-size: 16px; 101 | } 102 | 103 | p { 104 | margin: 10px 0 15px 0; 105 | text-align: justify; 106 | } 107 | 108 | footer p { 109 | color: #f2f2f2; 110 | } 111 | 112 | a { 113 | text-decoration: none; 114 | color: #007edf; 115 | text-shadow: none; 116 | 117 | transition: color 0.5s ease; 118 | transition: text-shadow 0.5s ease; 119 | -webkit-transition: color 0.5s ease; 120 | -webkit-transition: text-shadow 0.5s ease; 121 | -moz-transition: color 0.5s ease; 122 | -moz-transition: text-shadow 0.5s ease; 123 | -o-transition: color 0.5s ease; 124 | -o-transition: text-shadow 0.5s ease; 125 | -ms-transition: color 0.5s ease; 126 | -ms-transition: text-shadow 0.5s ease; 127 | } 128 | 129 | #main_content a:hover { 130 | color: #0069ba; 131 | text-shadow: #0090ff 0px 0px 2px; 132 | } 133 | 134 | footer a:hover { 135 | color: #43adff; 136 | text-shadow: #0090ff 0px 0px 2px; 137 | } 138 | 139 | em { 140 | font-style: italic; 141 | } 142 | 143 | strong { 144 | font-weight: bold; 145 | } 146 | 147 | img { 148 | position: relative; 149 | margin: 0 auto; 150 | max-width: 739px; 151 | padding: 5px; 152 | margin: 10px 0 10px 0; 153 | border: 1px solid #ebebeb; 154 | 155 | box-shadow: 0 0 5px #ebebeb; 156 | -webkit-box-shadow: 0 0 5px #ebebeb; 157 | -moz-box-shadow: 0 0 5px #ebebeb; 158 | -o-box-shadow: 0 0 5px #ebebeb; 159 | -ms-box-shadow: 0 0 5px #ebebeb; 160 | } 161 | 162 | pre, code { 163 | width: 100%; 164 | color: #222; 165 | background-color: #fff; 166 | 167 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; 168 | font-size: 14px; 169 | 170 | border-radius: 2px; 171 | -moz-border-radius: 2px; 172 | -webkit-border-radius: 2px; 173 | 174 | 175 | 176 | } 177 | 178 | pre { 179 | width: 100%; 180 | padding-top: 10px; 181 | padding-bottom: 10px; 182 | box-shadow: 0 0 10px rgba(0,0,0,.1); 183 | overflow: auto; 184 | } 185 | 186 | code { 187 | padding: 3px; 188 | margin: 0 3px; 189 | box-shadow: 0 0 10px rgba(0,0,0,.1); 190 | } 191 | 192 | pre code { 193 | display: block; 194 | box-shadow: none; 195 | } 196 | 197 | blockquote { 198 | color: #666; 199 | margin-bottom: 20px; 200 | padding: 0 0 0 20px; 201 | border-left: 3px solid #bbb; 202 | } 203 | 204 | ul, ol, dl { 205 | margin-bottom: 15px 206 | } 207 | 208 | ul li { 209 | list-style: inside; 210 | padding-left: 20px; 211 | } 212 | 213 | ol li { 214 | list-style: decimal inside; 215 | padding-left: 20px; 216 | } 217 | 218 | dl dt { 219 | font-weight: bold; 220 | } 221 | 222 | dl dd { 223 | padding-left: 20px; 224 | font-style: italic; 225 | } 226 | 227 | dl p { 228 | padding-left: 20px; 229 | font-style: italic; 230 | } 231 | 232 | hr { 233 | height: 1px; 234 | margin-bottom: 5px; 235 | border: none; 236 | background: url('../images/bg_hr.png') repeat-x center; 237 | } 238 | 239 | table { 240 | border: 1px solid #373737; 241 | margin-bottom: 20px; 242 | text-align: left; 243 | } 244 | 245 | th { 246 | font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif; 247 | padding: 5px; 248 | background-color: #474747; 249 | color: #fff; 250 | border-color: #373737; 251 | font-weight: bold; 252 | } 253 | 254 | td { 255 | padding: 5px; 256 | border: 1px solid #373737; 257 | } 258 | 259 | form { 260 | background: #f2f2f2; 261 | padding: 20px; 262 | } 263 | 264 | img { 265 | width: 100%; 266 | max-width: 100%; 267 | } 268 | 269 | /******************************************************************************* 270 | Full-Width Styles 271 | *******************************************************************************/ 272 | 273 | .outer { 274 | width: 100%; 275 | } 276 | 277 | .inner { 278 | position: relative; 279 | max-width: 800px; 280 | padding: 20px 10px; 281 | margin: 0 auto; 282 | } 283 | 284 | #forkme_banner { 285 | display: block; 286 | position: absolute; 287 | top:0; 288 | right: 10px; 289 | z-index: 10; 290 | padding: 10px 50px 10px 10px; 291 | color: #fff; 292 | background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%; 293 | font-weight: 700; 294 | box-shadow: 0 0 10px rgba(0,0,0,.5); 295 | border-bottom-left-radius: 2px; 296 | border-bottom-right-radius: 2px; 297 | } 298 | 299 | #header_wrap { 300 | background: #212121; 301 | background: -moz-linear-gradient(top, #373737, #212121); 302 | background: -webkit-linear-gradient(top, #373737, #212121); 303 | background: -ms-linear-gradient(top, #373737, #212121); 304 | background: -o-linear-gradient(top, #373737, #212121); 305 | background: linear-gradient(top, #373737, #212121); 306 | } 307 | 308 | #header_wrap .inner { 309 | padding: 50px 10px 30px 10px; 310 | } 311 | 312 | #project_title { 313 | margin: 0; 314 | color: #fff; 315 | font-size: 42px; 316 | font-weight: 700; 317 | text-shadow: #111 0px 0px 10px; 318 | } 319 | 320 | #project_tagline { 321 | color: #fff; 322 | font-size: 24px; 323 | font-weight: 300; 324 | background: none; 325 | text-shadow: #111 0px 0px 10px; 326 | } 327 | 328 | #downloads { 329 | position: absolute; 330 | width: 115px; 331 | z-index: 10; 332 | bottom: -40px; 333 | right: 0; 334 | height: 70px; 335 | background: url('../images/icon_download.png') no-repeat 0% 90%; 336 | } 337 | 338 | .zip_download_link { 339 | display: block; 340 | float: right; 341 | width: 90px; 342 | height:70px; 343 | text-indent: -5000px; 344 | overflow: hidden; 345 | background: url(../images/sprite_download.png) no-repeat bottom left; 346 | } 347 | 348 | .tar_download_link { 349 | display: block; 350 | float: right; 351 | width: 90px; 352 | height:70px; 353 | text-indent: -5000px; 354 | overflow: hidden; 355 | background: url(../images/sprite_download.png) no-repeat bottom right; 356 | margin-left: 10px; 357 | } 358 | 359 | .zip_download_link:hover { 360 | background: url(../images/sprite_download.png) no-repeat top left; 361 | } 362 | 363 | .tar_download_link:hover { 364 | background: url(../images/sprite_download.png) no-repeat top right; 365 | } 366 | 367 | #main_content_wrap { 368 | background: #f2f2f2; 369 | border-top: 1px solid #111; 370 | border-bottom: 1px solid #111; 371 | } 372 | 373 | #main_content { 374 | padding-top: 40px; 375 | } 376 | 377 | #footer_wrap { 378 | background: #212121; 379 | } 380 | 381 | 382 | 383 | /******************************************************************************* 384 | Small Device Styles 385 | *******************************************************************************/ 386 | 387 | @media screen and (max-width: 480px) { 388 | body { 389 | font-size:14px; 390 | } 391 | 392 | #downloads { 393 | display: none; 394 | } 395 | 396 | .inner { 397 | min-width: 320px; 398 | max-width: 480px; 399 | } 400 | 401 | #project_title { 402 | font-size: 32px; 403 | } 404 | 405 | h1 { 406 | font-size: 28px; 407 | } 408 | 409 | h2 { 410 | font-size: 24px; 411 | } 412 | 413 | h3 { 414 | font-size: 21px; 415 | } 416 | 417 | h4 { 418 | font-size: 18px; 419 | } 420 | 421 | h5 { 422 | font-size: 14px; 423 | } 424 | 425 | h6 { 426 | font-size: 12px; 427 | } 428 | 429 | code, pre { 430 | min-width: 320px; 431 | max-width: 480px; 432 | font-size: 11px; 433 | } 434 | 435 | } 436 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | net.sourceforge.streamsupport 5 | java9-concurrent-backport 6 | 2.0.5 7 | bundle 8 | net.sourceforge.streamsupport:java9-concurrent-backport 9 | Backport of Java 9 CompletableFuture, Flow and SubmissionPublisher API for Java 8 10 | https://github.com/stefan-zobel/java9-concurrent-backport/ 11 | 12 | 13 | GNU General Public License, version 2, with the Classpath Exception 14 | http://openjdk.java.net/legal/gplv2+ce.html 15 | 16 | 17 | CC0 1.0 Universal 18 | https://creativecommons.org/publicdomain/zero/1.0/ 19 | Creative Commons CC0 1.0 Universal license applies 20 | to the source code derived from the JSR-166 project as 21 | indicated in the respective source code files 22 | 23 | 24 | 25 | 26 | 27 | Stefan Zobel 28 | Spliterator@gmail.com 29 | net.sourceforge.streamsupport 30 | https://github.com/stefan-zobel/ 31 | 32 | 33 | 34 | https://github.com/stefan-zobel/java9-concurrent-backport 35 | scm:git:https://github.com/stefan-zobel/java9-concurrent-backport.git 36 | scm:git:https://github.com/stefan-zobel/java9-concurrent-backport.git 37 | 38 | 39 | 40 | Cp1252 41 | 42 | 43 | 44 | 45 | 46 | maven-compiler-plugin 47 | 3.8.1 48 | 49 | 1.8 50 | 1.8 51 | 52 | 53 | 54 | org.apache.maven.plugins 55 | maven-jar-plugin 56 | 3.1.1 57 | 58 | 59 | org.apache.maven.plugins 60 | maven-source-plugin 61 | 3.0.1 62 | 63 | 64 | attach-sources 65 | 66 | jar 67 | 68 | 69 | 70 | 71 | 72 | org.apache.maven.plugins 73 | maven-javadoc-plugin 74 | 3.2.0 75 | 76 | 77 | attach-javadocs 78 | 79 | jar 80 | 81 | 82 | 83 | 84 | 85 | org.apache.felix 86 | maven-bundle-plugin 87 | 4.2.1 88 | true 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/main/java/java9/util/KeyValueHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package java9.util; 26 | 27 | import java.util.Map; 28 | import java.util.Objects; 29 | 30 | /** 31 | * An immutable container for a key and a value, suitable for use 32 | * in creating and populating {@code Map} instances. 33 | * 34 | *

This is a value-based 35 | * class; use of identity-sensitive operations (including reference equality 36 | * ({@code ==}), identity hash code, or synchronization) on instances of 37 | * {@code KeyValueHolder} may have unpredictable results and should be avoided. 38 | * 39 | *

API Note:
40 | * This class is not public. Instances can be created using the 41 | * {@link Maps#entry Map.entry(k, v)} factory method, which is public. 42 | * 43 | *

This class differs from AbstractMap.SimpleImmutableEntry in the following ways: 44 | * it is not serializable, it is final, and its key and value must be non-null. 45 | * 46 | * @param the key type 47 | * @param the value type 48 | * 49 | * @see Maps#ofEntries Maps.ofEntries() 50 | * @since 9 51 | */ 52 | final class KeyValueHolder implements Map.Entry { 53 | final K key; 54 | final V value; 55 | 56 | KeyValueHolder(K k, V v) { 57 | key = Objects.requireNonNull(k); 58 | value = Objects.requireNonNull(v); 59 | } 60 | 61 | /** 62 | * Gets the key from this holder. 63 | * 64 | * @return the key 65 | */ 66 | @Override 67 | public K getKey() { 68 | return key; 69 | } 70 | 71 | /** 72 | * Gets the value from this holder. 73 | * 74 | * @return the value 75 | */ 76 | @Override 77 | public V getValue() { 78 | return value; 79 | } 80 | 81 | /** 82 | * Throws {@link UnsupportedOperationException}. 83 | * 84 | * @param value ignored 85 | * @return never returns normally 86 | */ 87 | @Override 88 | public V setValue(V value) { 89 | throw new UnsupportedOperationException("not supported"); 90 | } 91 | 92 | /** 93 | * Compares the specified object with this entry for equality. 94 | * Returns {@code true} if the given object is also a map entry and 95 | * the two entries' keys and values are equal. Note that key and 96 | * value are non-null, so equals() can be called safely on them. 97 | */ 98 | @Override 99 | public boolean equals(Object o) { 100 | if (!(o instanceof Map.Entry)) 101 | return false; 102 | Map.Entry e = (Map.Entry) o; 103 | return key.equals(e.getKey()) && value.equals(e.getValue()); 104 | } 105 | 106 | /** 107 | * Returns the hash code value for this map entry. The hash code 108 | * is {@code key.hashCode() ^ value.hashCode()}. Note that key and 109 | * value are non-null, so hashCode() can be called safely on them. 110 | */ 111 | @Override 112 | public int hashCode() { 113 | return key.hashCode() ^ value.hashCode(); 114 | } 115 | 116 | /** 117 | * Returns a String representation of this map entry. This 118 | * implementation returns the string representation of this 119 | * entry's key followed by the equals character ("{@code =}") 120 | * followed by the string representation of this entry's value. 121 | * 122 | * @return a String representation of this map entry 123 | */ 124 | @Override 125 | public String toString() { 126 | return key + "=" + value; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/java9/util/concurrent/ForkJoinWorkerThread.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Doug Lea with assistance from members of JCP JSR-166 3 | * Expert Group and released to the public domain, as explained at 4 | * http://creativecommons.org/publicdomain/zero/1.0/ 5 | */ 6 | /* 7 | * Any changes or additions made by the maintainers of the 8 | * streamsupport (https://github.com/stefan-zobel/streamsupport) 9 | * or retrostreams (https://github.com/retrostreams) libraries are 10 | * also released to the public domain, as explained at 11 | * https://creativecommons.org/publicdomain/zero/1.0/ 12 | */ 13 | package java9.util.concurrent; 14 | 15 | import java.security.AccessControlContext; 16 | import java.security.AccessController; 17 | import java.security.PrivilegedAction; 18 | import java.security.ProtectionDomain; 19 | 20 | /** 21 | * A thread managed by a {@link ForkJoinPool}, which executes 22 | * {@link ForkJoinTask}s. 23 | * This class is subclassable solely for the sake of adding 24 | * functionality -- there are no overridable methods dealing with 25 | * scheduling or execution. However, you can override initialization 26 | * and termination methods surrounding the main task processing loop. 27 | * If you do create such a subclass, you will also need to supply a 28 | * custom {@link ForkJoinPool.ForkJoinWorkerThreadFactory} to 29 | * 30 | * use it in a {@code ForkJoinPool}. 31 | * 32 | * @since 1.7 33 | * @author Doug Lea 34 | */ 35 | public class ForkJoinWorkerThread extends Thread { 36 | // CVS rev. 1.78 37 | /* 38 | * ForkJoinWorkerThreads are managed by ForkJoinPools and perform 39 | * ForkJoinTasks. For explanation, see the internal documentation 40 | * of class ForkJoinPool. 41 | * 42 | * This class just maintains links to its pool and WorkQueue. The 43 | * pool field is set immediately upon construction, but the 44 | * workQueue field is not set until a call to registerWorker 45 | * completes. This leads to a visibility race, that is tolerated 46 | * by requiring that the workQueue field is only accessed by the 47 | * owning thread. 48 | * 49 | * Support for (non-public) subclass InnocuousForkJoinWorkerThread 50 | * requires that we break quite a lot of encapsulation (via helper 51 | * methods in ThreadLocalRandom) both here and in the subclass to 52 | * access and set Thread fields. 53 | */ 54 | 55 | // A placeholder name until a useful name can be set in registerWorker 56 | private static final String NAME_PLACEHOLDER = "aForkJoinWorkerThread"; 57 | 58 | final ForkJoinPool pool; // the pool this thread works in 59 | final ForkJoinPool.WorkQueue workQueue; // work-stealing mechanics 60 | 61 | /** 62 | * Creates a ForkJoinWorkerThread operating in the given pool. 63 | * 64 | * @param pool the pool this thread works in 65 | * @throws NullPointerException if pool is null 66 | */ 67 | protected ForkJoinWorkerThread(ForkJoinPool pool) { 68 | // Use a placeholder until a useful name can be set in registerWorker 69 | super(NAME_PLACEHOLDER); 70 | this.pool = pool; 71 | this.workQueue = pool.registerWorker(this); 72 | } 73 | 74 | /** 75 | * Version for use by the default pool. Supports setting the 76 | * context class loader. This is a separate constructor to avoid 77 | * affecting the protected constructor. 78 | */ 79 | ForkJoinWorkerThread(ForkJoinPool pool, ClassLoader ccl) { 80 | super(NAME_PLACEHOLDER); 81 | TLRandom.setContextClassLoader(this, ccl); // java9-concurrent-backport changed 82 | this.pool = pool; 83 | this.workQueue = pool.registerWorker(this); 84 | } 85 | 86 | /** 87 | * Version for InnocuousForkJoinWorkerThread. 88 | */ 89 | ForkJoinWorkerThread(ForkJoinPool pool, 90 | ClassLoader ccl, 91 | ThreadGroup threadGroup, 92 | AccessControlContext acc) { 93 | super(threadGroup, NAME_PLACEHOLDER); 94 | super.setContextClassLoader(ccl); 95 | TLRandom.setInheritedAccessControlContext(this, acc); 96 | TLRandom.eraseThreadLocals(this); // clear before registering 97 | this.pool = pool; 98 | this.workQueue = pool.registerWorker(this); 99 | } 100 | 101 | /** 102 | * Returns the pool hosting this thread. 103 | * 104 | * @return the pool 105 | */ 106 | public ForkJoinPool getPool() { 107 | return pool; 108 | } 109 | 110 | /** 111 | * Returns the unique index number of this thread in its pool. 112 | * The returned value ranges from zero to the maximum number of 113 | * threads (minus one) that may exist in the pool, and does not 114 | * change during the lifetime of the thread. This method may be 115 | * useful for applications that track status or collect results 116 | * per-worker-thread rather than per-task. 117 | * 118 | * @return the index number 119 | */ 120 | public int getPoolIndex() { 121 | return workQueue.getPoolIndex(); 122 | } 123 | 124 | /** 125 | * Initializes internal state after construction but before 126 | * processing any tasks. If you override this method, you must 127 | * invoke {@code super.onStart()} at the beginning of the method. 128 | * Initialization requires care: Most fields must have legal 129 | * default values, to ensure that attempted accesses from other 130 | * threads work correctly even before this thread starts 131 | * processing tasks. 132 | */ 133 | protected void onStart() { 134 | } 135 | 136 | /** 137 | * Performs cleanup associated with termination of this worker 138 | * thread. If you override this method, you must invoke 139 | * {@code super.onTermination} at the end of the overridden method. 140 | * 141 | * @param exception the exception causing this thread to abort due 142 | * to an unrecoverable error, or {@code null} if completed normally 143 | */ 144 | protected void onTermination(Throwable exception) { 145 | } 146 | 147 | /** 148 | * This method is required to be public, but should never be 149 | * called explicitly. It performs the main run loop to execute 150 | * {@link ForkJoinTask}s. 151 | */ 152 | public void run() { 153 | if (workQueue.array == null) { // only run once 154 | Throwable exception = null; 155 | try { 156 | onStart(); 157 | pool.runWorker(workQueue); 158 | } catch (Throwable ex) { 159 | exception = ex; 160 | } finally { 161 | try { 162 | onTermination(exception); 163 | } catch (Throwable ex) { 164 | if (exception == null) { 165 | exception = ex; 166 | } 167 | } finally { 168 | pool.deregisterWorker(this, exception); 169 | } 170 | } 171 | } 172 | } 173 | 174 | /** 175 | * Non-public hook method for InnocuousForkJoinWorkerThread. 176 | */ 177 | void afterTopLevelExec() { 178 | } 179 | 180 | /** 181 | * A worker thread that has no permissions, is not a member of any 182 | * user-defined ThreadGroup, uses the system class loader as 183 | * thread context class loader, and erases all ThreadLocals after 184 | * running each top-level task. 185 | */ 186 | static final class InnocuousForkJoinWorkerThread extends ForkJoinWorkerThread { 187 | /** The ThreadGroup for all InnocuousForkJoinWorkerThreads */ 188 | private static final ThreadGroup innocuousThreadGroup = 189 | AccessController.doPrivileged(new PrivilegedAction() { 190 | public ThreadGroup run() { 191 | ThreadGroup group = Thread.currentThread().getThreadGroup(); 192 | for (ThreadGroup p; (p = group.getParent()) != null; ) 193 | group = p; 194 | return new ThreadGroup(group, "InnocuousForkJoinWorkerThreadGroup"); 195 | }}); 196 | 197 | /** An AccessControlContext supporting no privileges */ 198 | private static final AccessControlContext INNOCUOUS_ACC = 199 | new AccessControlContext( 200 | new ProtectionDomain[] { new ProtectionDomain(null, null) }); 201 | 202 | InnocuousForkJoinWorkerThread(ForkJoinPool pool) { 203 | super(pool, 204 | ClassLoader.getSystemClassLoader(), 205 | innocuousThreadGroup, 206 | INNOCUOUS_ACC); 207 | } 208 | 209 | @Override // to erase ThreadLocals 210 | void afterTopLevelExec() { 211 | TLRandom.eraseThreadLocals(this); 212 | } 213 | 214 | @Override // to silently fail 215 | public void setUncaughtExceptionHandler(UncaughtExceptionHandler x) { } 216 | 217 | @Override // paranoically 218 | public void setContextClassLoader(ClassLoader cl) { 219 | if (cl != null && ClassLoader.getSystemClassLoader() != cl) 220 | throw new SecurityException("setContextClassLoader"); 221 | } 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /src/main/java/java9/util/concurrent/TLRandom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Doug Lea with assistance from members of JCP JSR-166 3 | * Expert Group and released to the public domain, as explained at 4 | * http://creativecommons.org/publicdomain/zero/1.0/ 5 | */ 6 | /* 7 | * Any changes or additions made by the maintainers of the 8 | * streamsupport (https://github.com/stefan-zobel/streamsupport) 9 | * or retrostreams (https://github.com/retrostreams) libraries are 10 | * also released to the public domain, as explained at 11 | * https://creativecommons.org/publicdomain/zero/1.0/ 12 | */ 13 | package java9.util.concurrent; 14 | 15 | import java.security.AccessControlContext; 16 | import java.security.PrivilegedAction; 17 | import java.util.Objects; 18 | import java.util.concurrent.atomic.AtomicInteger; 19 | import java.util.concurrent.atomic.AtomicLong; 20 | 21 | /** 22 | * A random number generator isolated to the current thread. 23 | * 24 | * @since 1.7 25 | * @author Doug Lea 26 | */ 27 | final class TLRandom { 28 | // CVS rev. 1.63 29 | 30 | private static long mix64(long z) { 31 | z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL; 32 | z = (z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L; 33 | return z ^ (z >>> 33); 34 | } 35 | 36 | private static int mix32(long z) { 37 | z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL; 38 | return (int) (((z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L) >>> 32); 39 | } 40 | 41 | private TLRandom() { 42 | } 43 | 44 | /** 45 | * Initialize Thread fields for the current thread. Called only 46 | * when Thread.threadLocalRandomProbe is zero, indicating that a 47 | * thread local seed value needs to be generated. Note that even 48 | * though the initialization is purely thread-local, we need to 49 | * rely on (static) atomic generators to initialize the values. 50 | */ 51 | static final void localInit() { 52 | int p = probeGenerator.addAndGet(PROBE_INCREMENT); 53 | int probe = (p == 0) ? 1 : p; // skip 0 54 | long seed = mix64(seeder.getAndAdd(SEEDER_INCREMENT)); 55 | utilizeSeed(seed); 56 | setThreadLocalRandomProbe(probe); 57 | } 58 | 59 | // Within-package utilities 60 | 61 | /* 62 | * Descriptions of the usages of the methods below can be found in 63 | * the classes that use them. Briefly, a thread's "probe" value is 64 | * a non-zero hash code that (probably) does not collide with 65 | * other existing threads with respect to any power of two 66 | * collision space. When it does collide, it is pseudo-randomly 67 | * adjusted (using a Marsaglia XorShift). The nextSecondarySeed 68 | * method is used in the same contexts as ThreadLocalRandom, but 69 | * only for transient usages such as random adaptive spin/block 70 | * sequences for which a cheap RNG suffices and for which it could 71 | * in principle disrupt user-visible statistical properties of the 72 | * main ThreadLocalRandom if we were to use it. 73 | */ 74 | 75 | /** 76 | * Returns the probe value for the current thread without forcing 77 | * initialization. Note that invoking ThreadLocalRandom.current() 78 | * can be used to force initialization on zero return. 79 | */ 80 | static final int getProbe() { 81 | return getThreadLocalRandomProbe(); 82 | } 83 | 84 | /** 85 | * Pseudo-randomly advances and records the given probe value for the 86 | * given thread. 87 | */ 88 | static final int advanceProbe(int probe) { 89 | probe ^= probe << 13; // xorshift 90 | probe ^= probe >>> 17; 91 | probe ^= probe << 5; 92 | setThreadLocalRandomProbe(probe); 93 | return probe; 94 | } 95 | 96 | /** 97 | * Returns the pseudo-randomly initialized or updated secondary seed. 98 | */ 99 | static final int nextSecondarySeed() { 100 | int r; 101 | if ((r = getThreadLocalRandomSecondarySeed()) != 0) { 102 | r ^= r << 13; // xorshift 103 | r ^= r >>> 17; 104 | r ^= r << 5; 105 | } 106 | else if ((r = mix32(seeder.getAndAdd(SEEDER_INCREMENT))) == 0) { 107 | r = 1; // avoid zero 108 | } 109 | setThreadLocalRandomSecondarySeed(r); 110 | return r; 111 | } 112 | 113 | private static void utilizeSeed(long seed) { 114 | Objects.requireNonNull(Long.valueOf(seed)); 115 | } 116 | 117 | private static int getThreadLocalRandomProbe() { 118 | return U.getInt(Thread.currentThread(), PROBE); 119 | } 120 | 121 | private static void setThreadLocalRandomProbe(int probe) { 122 | U.putInt(Thread.currentThread(), PROBE, probe); 123 | } 124 | 125 | private static int getThreadLocalRandomSecondarySeed() { 126 | return U.getInt(Thread.currentThread(), SECONDARY); 127 | } 128 | 129 | private static void setThreadLocalRandomSecondarySeed(int secondary) { 130 | U.putInt(Thread.currentThread(), SECONDARY, secondary); 131 | } 132 | 133 | // Support for other package-private ThreadLocal access 134 | 135 | /** 136 | * Erases ThreadLocals by nulling out Thread maps. 137 | */ 138 | static final void eraseThreadLocals(Thread thread) { 139 | U.putObject(thread, THREADLOCALS, null); 140 | U.putObject(thread, INHERITABLETHREADLOCALS, null); 141 | } 142 | 143 | static final void setInheritedAccessControlContext(Thread thread, 144 | AccessControlContext acc) { 145 | U.putOrderedObject(thread, INHERITEDACCESSCONTROLCONTEXT, acc); 146 | } 147 | 148 | static final void setContextClassLoader(Thread thread, ClassLoader ccl) { 149 | U.putObject(thread, CCL, ccl); 150 | } 151 | 152 | // Static initialization 153 | 154 | /** 155 | * The increment for generating probe values. 156 | */ 157 | private static final int PROBE_INCREMENT = 0x9e3779b9; 158 | 159 | /** 160 | * The increment of seeder per new instance. 161 | */ 162 | private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; 163 | 164 | // Unsafe mechanics 165 | private static final sun.misc.Unsafe U = UnsafeAccess.unsafe; 166 | private static final long THREADLOCALS; 167 | private static final long INHERITABLETHREADLOCALS; 168 | private static final long INHERITEDACCESSCONTROLCONTEXT; 169 | private static final long CCL; 170 | private static final long PROBE; 171 | private static final long SECONDARY; 172 | static { 173 | try { 174 | THREADLOCALS = U.objectFieldOffset(Thread.class.getDeclaredField("threadLocals")); 175 | INHERITABLETHREADLOCALS = U.objectFieldOffset(Thread.class.getDeclaredField("inheritableThreadLocals")); 176 | INHERITEDACCESSCONTROLCONTEXT = U 177 | .objectFieldOffset(Thread.class.getDeclaredField("inheritedAccessControlContext")); 178 | CCL = U.objectFieldOffset(Thread.class.getDeclaredField("contextClassLoader")); 179 | PROBE = U.objectFieldOffset(Thread.class.getDeclaredField("threadLocalRandomProbe")); 180 | SECONDARY = U.objectFieldOffset(Thread.class.getDeclaredField("threadLocalRandomSecondarySeed")); 181 | } catch (Exception e) { 182 | throw new ExceptionInInitializerError(e); 183 | } 184 | } 185 | 186 | /** Generates per-thread initialization/probe field */ 187 | private static final AtomicInteger probeGenerator = new AtomicInteger(); 188 | 189 | /** 190 | * The next seed for default constructors. 191 | */ 192 | private static final AtomicLong seeder = new AtomicLong( 193 | mix64(System.currentTimeMillis()) ^ mix64(System.nanoTime())); 194 | 195 | // at end of to survive static initialization circularity 196 | static { 197 | if (java.security.AccessController.doPrivileged( 198 | new PrivilegedAction() { 199 | @Override 200 | public Boolean run() { 201 | return Boolean.getBoolean("java.util.secureRandomSeed"); 202 | } 203 | })) { 204 | byte[] seedBytes = java.security.SecureRandom.getSeed(8); 205 | long s = (long) seedBytes[0] & 0xffL; 206 | for (int i = 1; i < 8; ++i) { 207 | s = (s << 8) | ((long) seedBytes[i] & 0xffL); 208 | } 209 | seeder.set(s); 210 | } 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /src/main/java/java9/util/concurrent/UnsafeAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Stefan Zobel and released to the 3 | * public domain, as explained at 4 | * http://creativecommons.org/publicdomain/zero/1.0/ 5 | */ 6 | package java9.util.concurrent; 7 | 8 | import java.lang.reflect.Field; 9 | import sun.misc.Unsafe; 10 | 11 | class UnsafeAccess { 12 | 13 | static final Unsafe unsafe; 14 | static { 15 | try { 16 | Field field = Unsafe.class.getDeclaredField("theUnsafe"); 17 | field.setAccessible(true); 18 | unsafe = (Unsafe) field.get(null); 19 | } catch (Exception e) { 20 | throw new Error(e); 21 | } 22 | } 23 | 24 | private UnsafeAccess() { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/java9/util/concurrent/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /** 27 | * Some of the Java 8 and Java 9 utility classes commonly used in concurrent programming. 28 | * 29 | * Covers a backport of the upgraded (JEP 266) Java 9 CompletableFuture API for Java 8. 30 | * In addition, it includes a Java 8 version of the new Java 9 (JEP 266) reactive-streams 31 | * Flow and SubmissionPublisher API for Java 8. 32 | * 33 | * See JEP 266: More Concurrency Updates. 34 | * 35 | *

Memory Consistency Properties

36 | * 37 | * 39 | * Chapter 17 of The Java™ Language Specification defines 40 | * the happens-before relation on memory operations such as reads and 41 | * writes of shared variables. The results of a write by one thread are 42 | * guaranteed to be visible to a read by another thread only if the write 43 | * operation happens-before the read operation. The {@code synchronized} 44 | * and {@code volatile} constructs, as well as the {@code Thread.start()} and 45 | * {@code Thread.join()} methods, can form happens-before relationships. 46 | * In particular: 47 | * 48 | * 71 | * 72 | * @since 9 73 | */ 74 | package java9.util.concurrent; -------------------------------------------------------------------------------- /src/main/java/java9/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /** 27 | * Provides a Java 8 backport of the 28 | * JEP 269: Convenience Factory 29 | * Methods for Collections that were introduced in Java 9. 30 | * 31 | *

Unmodifiable collections

32 | *

33 | * An unmodifiable collection is a collection, all of whose mutator 34 | * methods are specified to throw {@code UnsupportedOperationException}. Such a 35 | * collection thus cannot be modified by calling any methods on it. For a 36 | * collection to be properly unmodifiable, any view collections derived from it 37 | * must also be unmodifiable. For example, if a List is unmodifiable, the List 38 | * returned by {@link java.util.List#subList List.subList} is also unmodifiable. 39 | * 40 | *

41 | * An unmodifiable collection is not necessarily immutable. If the contained 42 | * elements are mutable, the entire collection is clearly mutable, even though 43 | * it might be unmodifiable. For example, consider two unmodifiable lists 44 | * containing mutable elements. The result of calling 45 | * {@code list1.equals(list2)} might differ from one call to the next if the 46 | * elements had been mutated, even though both lists are unmodifiable. However, 47 | * if an unmodifiable collection contains all immutable elements, it can be 48 | * considered effectively immutable. 49 | * 50 | *

Value-based Classes

51 | *

52 | * Some classes, such as {@code java.util.Optional}, are value-based. Instances 53 | * of a value-based class: 54 | * 55 | *

72 | * 73 | * A program may produce unpredictable results if it attempts to distinguish two 74 | * references to equal values of a value-based class, whether directly via 75 | * reference equality or indirectly via an appeal to synchronization, identity 76 | * hashing, serialization, or any other identity-sensitive mechanism. Use of such 77 | * identity-sensitive operations on instances of value-based classes may have 78 | * unpredictable effects and should be avoided. 79 | *

80 | * 81 | * @since 9 82 | */ 83 | package java9.util; 84 | --------------------------------------------------------------------------------