Skip to content

Commit

Permalink
cells: reduce dependency on ListenableFuture
Browse files Browse the repository at this point in the history
Motivation:
as java8 provides CompletableFuture there are no reasons to depend on guava's
ListenableFuture.

Modification:
Update CellNucleus#start to return CompletableFuture

Result:
no visible changes.

Acked-by: Olufemi Adeyemi
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Sep 9, 2019
1 parent 0fb511c commit 58d479b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -43,7 +43,6 @@
import org.dcache.util.Version;
import org.dcache.util.cli.CommandExecutor;

import static org.dcache.util.CompletableFutures.fromListenableFuture;
import static org.dcache.util.MathUtils.addWithInfinity;
import static org.dcache.util.MathUtils.subWithInfinity;

Expand Down Expand Up @@ -206,7 +205,7 @@ public CellAdapter(String cellName,
*/
public CompletableFuture<Void> start()
{
return fromListenableFuture(_nucleus.start());
return _nucleus.start();
}

public void addCommandListener(Object commandListener)
Expand Down
Expand Up @@ -58,6 +58,7 @@
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.consumingIterable;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static org.dcache.util.CompletableFutures.fromListenableFuture;
import static org.dcache.util.MathUtils.addWithInfinity;
import static org.dcache.util.MathUtils.subWithInfinity;

Expand Down Expand Up @@ -906,7 +907,7 @@ private void setState(State newState)
*
* Must only be called once.
*/
public ListenableFuture<Void> start()
public CompletableFuture<Void> start()
{
_lifeCycleMonitor.enter();
try {
Expand All @@ -916,7 +917,7 @@ public ListenableFuture<Void> start()
} finally {
_lifeCycleMonitor.leave();
}
return Futures.nonCancellationPropagating(_startup);
return fromListenableFuture(Futures.nonCancellationPropagating(_startup));
}

private Void doStart() throws Exception
Expand Down

0 comments on commit 58d479b

Please sign in to comment.