Add compatibility with Java 8 CompletableFuture converting our Guava-supplied ListenableFuture.

This commit is contained in:
Greg Burd 2017-08-03 15:38:13 -04:00
parent b44c898682
commit 7497cf5a18
3 changed files with 23 additions and 1 deletions

View file

@ -32,6 +32,10 @@
<orderEntry type="library" name="Maven: com.github.jnr:jnr-constants:0.9.0" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.10" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.10" level="project" />
<orderEntry type="library" name="Maven: net.javacrumbs.future-converter:future-converter-java8-guava:1.1.0" level="project" />
<orderEntry type="library" name="Maven: net.javacrumbs.future-converter:future-converter-common:1.1.0" level="project" />
<orderEntry type="library" name="Maven: net.javacrumbs.future-converter:future-converter-java8-common:1.1.0" level="project" />
<orderEntry type="library" name="Maven: net.javacrumbs.future-converter:future-converter-guava-common:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />

13
pom.xml
View file

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.helenus</groupId>
<artifactId>helenus-core</artifactId>
<version>2.0.6-SNAPSHOT</version>
<version>2.0.7-SNAPSHOT</version>
<packaging>jar</packaging>
<name>helenus</name>
@ -50,6 +50,11 @@
</repository>
</repositories>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<profiles>
<profile>
@ -127,6 +132,12 @@
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>net.javacrumbs.future-converter</groupId>
<artifactId>future-converter-java8-guava</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>

View file

@ -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<E, O extends AbstractOperation<E, O>> extends AbstractStatementOperation<E, O> {
@ -96,6 +99,10 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> ex
return future;
}
public CompletableFuture<E> completable() {
return toCompletableFuture(async());
}
public Future<E> future() {
return Scala.asFuture(async());
}