/** * 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); } }
/** * 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); } }
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); } }
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); } }
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); } }
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); } }
IOUtils.reThrowUnchecked(firstThrowable);
IOUtils.reThrowUnchecked(firstThrowable);
/** 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); }
/** 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); }