From 7497cf5a186211058b27e62e5861e839e649336b Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Thu, 3 Aug 2017 15:38:13 -0400 Subject: [PATCH] Add compatibility with Java 8 CompletableFuture converting our Guava-supplied ListenableFuture. --- helenus-core.iml | 4 ++++ pom.xml | 13 ++++++++++++- .../helenus/core/operation/AbstractOperation.java | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/helenus-core.iml b/helenus-core.iml index 42b1cc5..386e779 100644 --- a/helenus-core.iml +++ b/helenus-core.iml @@ -32,6 +32,10 @@ + + + + diff --git a/pom.xml b/pom.xml index cd51b84..6215c57 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 net.helenus helenus-core - 2.0.6-SNAPSHOT + 2.0.7-SNAPSHOT jar helenus @@ -50,6 +50,11 @@ + + 1.8 + 1.8 + + @@ -127,6 +132,12 @@ 1.8.10 + + net.javacrumbs.future-converter + future-converter-java8-guava + 1.1.0 + + org.apache.commons commons-lang3 diff --git a/src/main/java/net/helenus/core/operation/AbstractOperation.java b/src/main/java/net/helenus/core/operation/AbstractOperation.java index 64d7523..cb90747 100644 --- a/src/main/java/net/helenus/core/operation/AbstractOperation.java +++ b/src/main/java/net/helenus/core/operation/AbstractOperation.java @@ -26,6 +26,9 @@ import net.helenus.core.AbstractSessionOperations; import net.helenus.support.Fun; import net.helenus.support.Scala; import scala.concurrent.Future; +import java.util.concurrent.CompletableFuture; +import static net.javacrumbs.futureconverter.java8guava.FutureConverter.*; + public abstract class AbstractOperation> extends AbstractStatementOperation { @@ -96,6 +99,10 @@ public abstract class AbstractOperation> ex return future; } + public CompletableFuture completable() { + return toCompletableFuture(async()); + } + public Future future() { return Scala.asFuture(async()); }