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

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_r121046543
  
    --- Diff: 
distributedlog-core/src/main/java/org/apache/distributedlog/util/Utils.java ---
    @@ -635,4 +631,80 @@ public static String getParent(final String path) {
             return path.substring(0, lastIndex);
         }
     
    +    /**
    +     * Convert the <i>throwable</i> to zookeeper related exceptions.
    +     *
    +     * @param throwable cause
    +     * @param path zookeeper path
    +     * @return zookeeper related exceptions
    +     */
    +    public static Throwable zkException(Throwable throwable, String path) {
    +        if (throwable instanceof KeeperException) {
    +            return new ZKException("Encountered zookeeper exception on " + 
path, (KeeperException) throwable);
    +        } else if (throwable instanceof 
ZooKeeperClient.ZooKeeperConnectionException) {
    +            return new ZKException("Encountered zookeeper connection loss 
on " + path,
    +                    KeeperException.Code.CONNECTIONLOSS);
    +        } else if (throwable instanceof InterruptedException) {
    +            return new DLInterruptedException("Interrupted on operating " 
+ path, throwable);
    +        } else {
    +            return new UnexpectedException("Encountered unexpected 
exception on operatiing " + path, throwable);
    +        }
    +    }
    +
    +    /**
    +     * Create transmit exception from transmit result.
    +     *
    +     * @param transmitResult
    +     *          transmit result (basically bk exception code)
    +     * @return transmit exception
    +     */
    +    public static BKTransmitException transmitException(int 
transmitResult) {
    +        return new BKTransmitException("Failed to write to bookkeeper; 
Error is ("
    +            + transmitResult + ") "
    +            + BKException.getMessage(transmitResult), transmitResult);
    +    }
    +
    +    public static <T> T ioResult(CompletableFuture<T> result) throws 
IOException {
    --- End diff --
    
    why not have a java8 version of FutureUtils? 
    seems weird to throw all of this into one file


> 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