Skip to content

Commit 2202dcd

Browse files
committed
Minor changes to the visibility of internal methods & doc fixes
1 parent c51daea commit 2202dcd

File tree

8 files changed

+26
-17
lines changed

8 files changed

+26
-17
lines changed

src/main/java/net/tascalate/concurrent/AsyncCloseable.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
import java.util.function.Function;
2020

2121
/**
22-
* An object that may hold resources that must be explicitly released, where the release may be
23-
* performed asynchronously.
22+
* An object that may hold resources that must be explicitly released, and the release operation
23+
* should be performed asynchronously.
2424
*
2525
* <p>
26-
* Examples of such resources are manually managed memory, open file handles, socket descriptors
26+
* Examples of such resources are database connections, open file handles, socket descriptors
2727
* etc. While similar to {@link AutoCloseable}, this interface should be used when the resource
28-
* release operation may possibly be async. For example, if an object is thread-safe and has many
29-
* consumers, an implementation may require all current ongoing operations to complete before
30-
* resources are relinquished.
28+
* release operation may possibly be asynchronous. For example, if an object is thread-safe and
29+
* has many consumers, an implementation may require all current ongoing operations to complete
30+
* before resources are relinquished.
3131
*
3232
* <p>
3333
* May be used with the methods {@link Promises#tryApplyEx(CompletionStage, Function)},
@@ -38,10 +38,10 @@
3838
@FunctionalInterface
3939
public interface AsyncCloseable {
4040
/**
41-
* Relinquishes any resources associated with this object.
41+
* Release any resources associated with this object.
4242
*
4343
* @return a {@link CompletionStage} that completes when all resources associated with this object
44-
* have been released, or with an exception if the resources cannot be released.
44+
* have been released, or settled with an exception if the resources cannot be released.
4545
*/
4646
CompletionStage<Void> close();
4747
}

src/main/java/net/tascalate/concurrent/CompletablePromise.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public Promise<T> completeAsync(Supplier<? extends T> supplier) {
5959
return result; // use what is provided
6060
} else {
6161
// defaultExecutor might be changed in ad-hoc manner via subclassing
62-
// let take back to the actual default executor
62+
// let us take back to the actual default executor
6363
return result.dependent()
6464
.thenApplyAsync(Function.identity())
6565
.unwrap();

src/main/java/net/tascalate/concurrent/DependentPromise.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@
4848
* <p>In the example <code>p2</code> is created with specifying <code>p1</code> as origin (last argument is <code>true</code>).
4949
* Now when canceling <code>p2</code> both <code>p2</code> and <code>p1</code> will be cancelled if not completed yet.
5050
*
51-
* <p>The class add overloads to all composition methods declared in {@link CompletionStage} interface.
51+
* <p>The class add overloads to all composition methods declared in {@link CompletionStage} and {@link Promise} interface.
5252
*
5353
* <p>The ones that accepts another {@link CompletionStage} as argument (named <code>*Both*</code> and
5454
* <code>*Either*</code> are overloaded with a set of @{link {@link PromiseOrigin} as an argument to let
5555
* you specify what to enlist as origin: "this" related to the method call or the parameter.
5656
*
57-
* <p>Rest of methods from {@link CompletionStage} API are overloaded with boolean argument
57+
* <p>Rest of methods from {@link CompletionStage} and {@link Promise} API are overloaded with boolean argument
5858
* <code>enlistOrigin</code> that specify whether or not the {@link Promise} object whose
5959
* method is invoked should be added as an origin to result.
6060
*
61-
* <p>All methods originally specified in {@link CompletionStage} does not add "this" as an origin to
61+
* <p>All methods originally specified in {@link CompletionStage} does not add "this" as an origin to
6262
* resulting promise.
6363
*
6464
* @author vsilaev

src/main/java/net/tascalate/concurrent/Promise.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ default Promise<T> onTimeout(Supplier<? extends T> supplier, Duration duration,
175175
* created DependentPromise
176176
*/
177177
default DependentPromise<T> dependent() {
178-
return DependentPromise.from(this);
178+
return ConfigurableDependentPromise.from(this);
179179
}
180180

181181
/**
@@ -190,7 +190,7 @@ default DependentPromise<T> dependent() {
190190
* created DependentPromise
191191
*/
192192
default DependentPromise<T> dependent(Set<PromiseOrigin> defaultEnlistOptions) {
193-
return DependentPromise.from(this, defaultEnlistOptions);
193+
return ConfigurableDependentPromise.from(this, defaultEnlistOptions);
194194
}
195195

196196
default Promise<T> defaultAsyncOn(Executor executor) {

src/main/java/net/tascalate/concurrent/core/CurrentCompletionStageAPI.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
*/
1616
package net.tascalate.concurrent.core;
1717

18-
class CurrentCompletionStageAPI {
18+
final class CurrentCompletionStageAPI {
1919
static final CompletionStageAPI INSTANCE;
2020

21+
private CurrentCompletionStageAPI() {}
22+
2123
private static int getJavaVersion() {
2224
String version = System.getProperty("java.version");
2325

src/main/java/net/tascalate/concurrent/core/J12CompletionStageAPI.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
import java.util.concurrent.Executor;
2121
import java.util.function.Function;
2222

23-
public class J12CompletionStageAPI implements CompletionStageAPI {
23+
class J12CompletionStageAPI implements CompletionStageAPI {
24+
25+
J12CompletionStageAPI() {}
26+
2427
@Override
2528
public boolean defaultExecutorOverridable() {
2629
return true;

src/main/java/net/tascalate/concurrent/core/J8CompletionStageAPI.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
import java.util.concurrent.ForkJoinPool;
2222
import java.util.function.Function;
2323

24-
public class J8CompletionStageAPI implements CompletionStageAPI {
24+
class J8CompletionStageAPI implements CompletionStageAPI {
25+
26+
J8CompletionStageAPI() {}
2527

2628
@Override
2729
public boolean defaultExecutorOverridable() {

src/main/java/net/tascalate/concurrent/core/J9CompletionStageAPI.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
class J9CompletionStageAPI extends J8CompletionStageAPI {
2222

23+
J9CompletionStageAPI() {}
24+
2325
@Override
2426
public boolean defaultExecutorOverridable() {
2527
return true;

0 commit comments

Comments
 (0)