Question: I'd like to subclass [CompletableFuture](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html) to override the default `Executor`. That is, if a user invokes a method without specifying an `Executor`, I want my own `Executor` to get used instead of the one normally used by `CompletableFuture`.

The Javadoc hints at the possibility of subclassing:

> 
> All CompletionStage methods are implemented independently of other public methods, so the behavior of one method is not impacted by overrides of others in subclasses.
> 
> 
> 

How am I supposed to implement static methods like `CompletableFuture.supplyAsync()` in the subclass if the underlying implementation depends on methods like `internalComplete()` which is package-private?

**How is one supposed to subclass CompletableFuture?**

---

What I'm trying to do...
------------------------

My user code needs to execute multiple tasks asynchronously using the same executor. For example: `CompletableFuture.supplyAsync(..., executor).thenApplyAsync(..., executor).thenApplyAsync(..., executor)`. I'd like the custom `CompletableFuture` implementation to use the first executor throughout all follow-up calls.

Answer: 
Answering the original question -- **How is one supposed to subclass CompletableFuture?**

Probably starting from a clean-room CompletionStage interface implementation (rather than from the concrete CompletableFuture class) a is a better option. Please take a look here:

<https://github.com/lukas-krecan/completion-stage>
As far as I can see, you need your own implementation of `internalComplete()` which instantiates your own equivalent of `AltResult` in case of null or exception. And your subclass `supplyAsync()` is supposed to return a new instance of your new `CompletableFuture` subclass.