[
https://issues.apache.org/jira/browse/DL-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16043903#comment-16043903
]
ASF GitHub Bot commented on DL-124:
-----------------------------------
Github user leighst commented on a diff in the pull request:
https://github.com/apache/incubator-distributedlog/pull/133#discussion_r121046188
--- Diff:
distributedlog-core/src/main/java/org/apache/distributedlog/BKLogReadHandler.java
---
@@ -201,33 +183,31 @@ public void safeRun() {
* Begin asynchronous lock acquire, but ensure that the returned
future is satisfied on an
* executor service thread.
*/
- Future<Void> acquireLockOnExecutorThread(DistributedLock lock) throws
LockingException {
- final Future<? extends DistributedLock> acquireFuture =
lock.asyncAcquire();
+ CompletableFuture<Void> acquireLockOnExecutorThread(DistributedLock
lock) throws LockingException {
+ final CompletableFuture<? extends DistributedLock> acquireFuture =
lock.asyncAcquire();
// The future we return must be satisfied on an executor service
thread. If we simply
// return the future returned by asyncAcquire, user callbacks may
end up running in
// the lock state executor thread, which will cause deadlocks and
introduce latency
// etc.
- final Promise<Void> threadAcquirePromise = new Promise<Void>();
- threadAcquirePromise.setInterruptHandler(new Function<Throwable,
BoxedUnit>() {
- @Override
- public BoxedUnit apply(Throwable t) {
- FutureUtils.cancel(acquireFuture);
- return null;
+ final CompletableFuture<Void> threadAcquirePromise = new
CompletableFuture<Void>();
+ threadAcquirePromise.whenComplete((value, cause) -> {
--- End diff --
do i understand correctly java8 future doesn't really have the concept of
interrupt?
> Use Java8 Future rather than twitter Future
> -------------------------------------------
>
> Key: DL-124
> URL: https://issues.apache.org/jira/browse/DL-124
> Project: DistributedLog
> Issue Type: Bug
> Affects Versions: 0.4.0
> Reporter: Gerrit Sundaram
> Assignee: Sijie Guo
> Labels: help-wanted
> Fix For: 0.5.0
>
>
> Since it is written in java, it would be good to leverage java8 future rather
> than introducing dependencies on scala.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)