ExceptionUtils.rethrowException(error, error.getMessage());
ExceptionUtils.rethrowException(error, error.getMessage());
@Override public void close() throws Exception { lock.lock(); try { // close only once if (closed) { return; } closed = true; Throwable exception = null; try { blobStoreService.close(); } catch (Throwable t) { exception = t; } // we do not propagate exceptions here, but only log them try { hadoopFileSystem.close(); } catch (Throwable t) { exception = ExceptionUtils.firstOrSuppressed(t, exception); } if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close the YarnHighAvailabilityServices."); } } finally { lock.unlock(); } }
/** * This test validates that the factory can be instantiated and configured even * when Hadoop classes are missing from the classpath. */ @Test public void testHadoopFactoryInstantiationWithoutHadoop() throws Exception { // we do reflection magic here to instantiate the test in another class // loader, to make sure no hadoop classes are in the classpath final String testClassName = "org.apache.flink.runtime.fs.hdfs.HadoopFreeTests"; URLClassLoader parent = (URLClassLoader) getClass().getClassLoader(); ClassLoader hadoopFreeClassLoader = new HadoopFreeClassLoader(parent); Class<?> testClass = Class.forName(testClassName, false, hadoopFreeClassLoader); Method m = testClass.getDeclaredMethod("test"); try { m.invoke(null); } catch (InvocationTargetException e) { ExceptionUtils.rethrowException(e.getTargetException(), "exception in method"); } }
ExceptionUtils.rethrowException(exception, exception.getMessage());
@Override public Map<String, OptionalFailure<Object>> getAccumulators(final JobID jobID, ClassLoader loader) throws Exception { final JobAccumulatorsHeaders accumulatorsHeaders = JobAccumulatorsHeaders.getInstance(); final JobAccumulatorsMessageParameters accMsgParams = accumulatorsHeaders.getUnresolvedMessageParameters(); accMsgParams.jobPathParameter.resolve(jobID); accMsgParams.includeSerializedAccumulatorsParameter.resolve(Collections.singletonList(true)); CompletableFuture<JobAccumulatorsInfo> responseFuture = sendRequest( accumulatorsHeaders, accMsgParams); Map<String, OptionalFailure<Object>> result = Collections.emptyMap(); try { result = responseFuture.thenApply((JobAccumulatorsInfo accumulatorsInfo) -> { try { return AccumulatorHelper.deserializeAccumulators( accumulatorsInfo.getSerializedUserAccumulators(), loader); } catch (Exception e) { throw new CompletionException( new FlinkException( String.format("Deserialization of accumulators for job %s failed.", jobID), e)); } }).get(timeout.toMillis(), TimeUnit.MILLISECONDS); } catch (ExecutionException ee) { ExceptionUtils.rethrowException(ExceptionUtils.stripExecutionException(ee)); } return result; }
@Override public void closeAndCleanupAllData() throws Exception { LOG.info("Close and clean up all data for ZooKeeperHaServices."); Throwable exception = null; try { blobStoreService.closeAndCleanupAllData(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close and clean up all data of ZooKeeperHaServices."); } }
@Override public void closeAndCleanupAllData() throws Exception { LOG.info("Close and clean up all data for ZooKeeperHaServices."); Throwable exception = null; try { blobStoreService.closeAndCleanupAllData(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close and clean up all data of ZooKeeperHaServices."); } }
@Override public void closeAndCleanupAllData() throws Exception { LOG.info("Close and clean up all data for ZooKeeperHaServices."); Throwable exception = null; try { blobStoreService.closeAndCleanupAllData(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close and clean up all data of ZooKeeperHaServices."); } }
/** * Stop and clear the currently registered job leader id listeners. * * @throws Exception which is thrown in case a retrieval service cannot be stopped properly */ public void clear() throws Exception { Exception exception = null; for (JobLeaderIdListener listener: jobLeaderIdListeners.values()) { try { listener.stop(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly stop the " + JobLeaderIdService.class.getSimpleName() + '.'); } jobLeaderIdListeners.clear(); }
/** * Stop and clear the currently registered job leader id listeners. * * @throws Exception which is thrown in case a retrieval service cannot be stopped properly */ public void clear() throws Exception { Exception exception = null; for (JobLeaderIdListener listener: jobLeaderIdListeners.values()) { try { listener.stop(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly stop the " + JobLeaderIdService.class.getSimpleName() + '.'); } jobLeaderIdListeners.clear(); }
@Override public void close() throws Exception { Throwable exception = null; try { blobStoreService.close(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close the ZooKeeperHaServices."); } }
@Override public void close() throws Exception { Throwable exception = null; try { blobStoreService.close(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close the ZooKeeperHaServices."); } }
@Override public void closeAndCleanupAllData() throws Exception { Throwable exception = null; try { blobStoreService.closeAndCleanupAllData(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close and clean up all data of FileSystemHaServices."); } }
@Override public void close() throws Exception { Throwable exception = null; try { blobStoreService.close(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close the ZooKeeperHaServices."); } }
@Override public void closeAndCleanupAllData() throws Exception { Throwable exception = null; try { blobStoreService.closeAndCleanupAllData(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close and clean up all data of ZooKeeperHaServices."); } }
@Override public void close() throws Exception { Throwable exception = null; try { blobStoreService.close(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close the ZooKeeperHaServices."); } }
@Override public void close() throws Exception { Throwable exception = null; try { blobStoreService.close(); } catch (Throwable t) { exception = t; } internalClose(); if (exception != null) { ExceptionUtils.rethrowException(exception, "Could not properly close the FileSystemHaServices."); } }
/** * Shutdown the {@link JobMaster} services. * * <p>This method makes sure all services are closed or shut down, even when an exception occurred * in the shutdown of one component. The first encountered exception is thrown, with successive * exceptions added as suppressed exceptions. * * @throws Exception The first Exception encountered during shutdown. */ public void shutdown() throws Exception { Throwable firstException = null; try { scheduledExecutorService.shutdownNow(); } catch (Throwable t) { firstException = t; } libraryCacheManager.shutdown(); stackTraceSampleCoordinator.shutDown(); backPressureStatsTracker.shutDown(); if (firstException != null) { ExceptionUtils.rethrowException(firstException, "Error while shutting down JobManager services"); } }
/** * Shutdown the {@link JobMaster} services. * * <p>This method makes sure all services are closed or shut down, even when an exception occurred * in the shutdown of one component. The first encountered exception is thrown, with successive * exceptions added as suppressed exceptions. * * @throws Exception The first Exception encountered during shutdown. */ public void shutdown() throws Exception { Throwable firstException = null; try { scheduledExecutorService.shutdownNow(); } catch (Throwable t) { firstException = t; } libraryCacheManager.shutdown(); stackTraceSampleCoordinator.shutDown(); backPressureStatsTracker.shutDown(); if (firstException != null) { ExceptionUtils.rethrowException(firstException, "Error while shutting down JobManager services"); } }