org.apache.lucene.util.IOUtils.reThrowUnchecked()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.apache.lucene.util.IOUtils.reThrowUnchecked()方法的一些代码示例,展示了IOUtils.reThrowUnchecked()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.reThrowUnchecked()方法的具体详情如下:
包路径:org.apache.lucene.util.IOUtils
类名称:IOUtils
方法名:reThrowUnchecked

IOUtils.reThrowUnchecked介绍

[英]Simple utility method that takes a previously caught Throwable and rethrows it as an unchecked exception. If the argument is null then this method does nothing.
[中]一种简单的实用方法,它接受以前捕获的可丢弃项,并将其作为未经检查的异常重新引用。如果参数为null,则此方法不执行任何操作。

代码示例

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * Simple utility method that takes a previously caught
 * {@code Throwable} and rethrows either {@code
 * IOException} or an unchecked exception.  If the
 * argument is null then this method does nothing.
 */
public static void reThrow(Throwable th) throws IOException {
 if (th != null) {
  if (th instanceof IOException) {
   throw (IOException) th;
  }
  reThrowUnchecked(th);
 }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Simple utility method that takes a previously caught
 * {@code Throwable} and rethrows either {@code
 * IOException} or an unchecked exception.  If the
 * argument is null then this method does nothing.
 */
public static void reThrow(Throwable th) throws IOException {
 if (th != null) {
  if (th instanceof IOException) {
   throw (IOException) th;
  }
  reThrowUnchecked(th);
 }
}

代码示例来源:origin: harbby/presto-connectors

private void notifyCoreClosedListeners(Throwable th) {
 synchronized(coreClosedListeners) {
  for (CoreClosedListener listener : coreClosedListeners) {
   // SegmentReader uses our instance as its
   // coreCacheKey:
   try {
    listener.onClose(this);
   } catch (Throwable t) {
    if (th == null) {
     th = t;
    } else {
     th.addSuppressed(t);
    }
   }
  }
  IOUtils.reThrowUnchecked(th);
 }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private void notifyReaderClosedListeners(Throwable th) {
 synchronized(readerClosedListeners) {
  for(ReaderClosedListener listener : readerClosedListeners) {
   try {
    listener.onClose(this);
   } catch (Throwable t) {
    if (th == null) {
     th = t;
    } else {
     th.addSuppressed(t);
    }
   }
  }
  IOUtils.reThrowUnchecked(th);
 }
}

代码示例来源:origin: harbby/presto-connectors

private void notifyReaderClosedListeners(Throwable th) {
 synchronized(readerClosedListeners) {
  for(ReaderClosedListener listener : readerClosedListeners) {
   try {
    listener.onClose(this);
   } catch (Throwable t) {
    if (th == null) {
     th = t;
    } else {
     th.addSuppressed(t);
    }
   }
  }
  IOUtils.reThrowUnchecked(th);
 }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private void notifyCoreClosedListeners(Throwable th) {
 synchronized(coreClosedListeners) {
  for (CoreClosedListener listener : coreClosedListeners) {
   // SegmentReader uses our instance as its
   // coreCacheKey:
   try {
    listener.onClose(this);
   } catch (Throwable t) {
    if (th == null) {
     th = t;
    } else {
     th.addSuppressed(t);
    }
   }
  }
  IOUtils.reThrowUnchecked(th);
 }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

IOUtils.reThrowUnchecked(firstThrowable);

代码示例来源:origin: harbby/presto-connectors

IOUtils.reThrowUnchecked(firstThrowable);

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/** Decrefs all provided files, even on exception; throws first exception hit, if any. */
void decRef(Collection<String> files) {
 assert locked();
 Throwable firstThrowable = null;
 for(final String file : files) {
  try {
   decRef(file);
  } catch (Throwable t) {
   if (firstThrowable == null) {
    // Save first exception and throw it in the end, but be sure to finish decRef all files
    firstThrowable = t;
   }
  }
 }
 try {
  deletePendingFiles();
 } catch (Throwable t) {
  if (firstThrowable == null) {
   // Save first exception and throw it in the end, but be sure to finish decRef all files
   firstThrowable = t;
  }
 }
 // NOTE: does nothing if firstThrowable is null
 IOUtils.reThrowUnchecked(firstThrowable);
}

代码示例来源:origin: harbby/presto-connectors

/** Decrefs all provided files, even on exception; throws first exception hit, if any. */
void decRef(Collection<String> files) {
 assert locked();
 Throwable firstThrowable = null;
 for(final String file : files) {
  try {
   decRef(file);
  } catch (Throwable t) {
   if (firstThrowable == null) {
    // Save first exception and throw it in the end, but be sure to finish decRef all files
    firstThrowable = t;
   }
  }
 }
 try {
  deletePendingFiles();
 } catch (Throwable t) {
  if (firstThrowable == null) {
   // Save first exception and throw it in the end, but be sure to finish decRef all files
   firstThrowable = t;
  }
 }
 // NOTE: does nothing if firstThrowable is null
 IOUtils.reThrowUnchecked(firstThrowable);
}

相关文章