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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to