[ 
https://issues.apache.org/jira/browse/DL-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035937#comment-16035937
 ] 

ASF GitHub Bot commented on DL-124:
-----------------------------------

Github user jiazhai commented on a diff in the pull request:

    
https://github.com/apache/incubator-distributedlog/pull/133#discussion_r119984686
  
    --- Diff: 
distributedlog-core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
 ---
    @@ -198,52 +196,52 @@ public synchronized BookKeeper get() throws 
IOException {
         }
     
         // Util functions
    -    public Future<LedgerHandle> createLedger(int ensembleSize,
    -                                             int writeQuorumSize,
    -                                             int ackQuorumSize) {
    +    public CompletableFuture<LedgerHandle> createLedger(int ensembleSize,
    +                                                        int 
writeQuorumSize,
    +                                                        int ackQuorumSize) 
{
             BookKeeper bk;
             try {
                 bk = get();
             } catch (IOException ioe) {
    -            return Future.exception(ioe);
    +            return FutureUtils.exception(ioe);
             }
    -        final Promise<LedgerHandle> promise = new Promise<LedgerHandle>();
    +        final CompletableFuture<LedgerHandle> promise = new 
CompletableFuture<LedgerHandle>();
             bk.asyncCreateLedger(ensembleSize, writeQuorumSize, ackQuorumSize,
                     BookKeeper.DigestType.CRC32, passwd, new 
AsyncCallback.CreateCallback() {
                         @Override
                         public void createComplete(int rc, LedgerHandle lh, 
Object ctx) {
                             if (BKException.Code.OK == rc) {
    -                            promise.updateIfEmpty(new 
Return<LedgerHandle>(lh));
    +                            promise.complete(lh);
                             } else {
    -                            promise.updateIfEmpty(new 
Throw<LedgerHandle>(BKException.create(rc)));
    +                            
promise.completeExceptionally(BKException.create(rc));
                             }
                         }
                     }, null);
             return promise;
         }
     
    -    public Future<Void> deleteLedger(long lid,
    +    public CompletableFuture<Void> deleteLedger(long lid,
                                          final boolean 
ignoreNonExistentLedger) {
    --- End diff --
    
    Please also do the code alignment change here.


> 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)

Reply via email to