Java Code Examples for org.apache.zookeeper.KeeperException#initCause()

The following examples show how to use org.apache.zookeeper.KeeperException#initCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZKWatcher.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Handles InterruptedExceptions in client calls.
 * @param ie the InterruptedException instance thrown
 * @throws KeeperException the exception to throw, transformed from the InterruptedException
 */
public void interruptedException(InterruptedException ie) throws KeeperException {
  interruptedExceptionNoThrow(ie, true);
  // Throw a system error exception to let upper level handle it
  KeeperException keeperException = new KeeperException.SystemErrorException();
  keeperException.initCause(ie);
  throw keeperException;
}
 
Example 2
Source File: ZKUtil.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Convert a {@link DeserializationException} to a more palatable {@link KeeperException}.
 * Used when can't let a {@link DeserializationException} out w/o changing public API.
 * @param e Exception to convert
 * @return Converted exception
 */
public static KeeperException convert(final DeserializationException e) {
  KeeperException ke = new KeeperException.DataInconsistencyException();
  ke.initCause(e);
  return ke;
}