flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobUtils.java
/**
	 * Adds a shutdown hook to the JVM and returns the Thread, which has been registered.
	 */
Adds a shutdown hook to the JVM and returns the Thread, which has been registered.
Adds a shutdown hook to the JVM and returns the Thread which has been registered .
static Thread addShutdownHook(final Closeable service, final Logger logger) {
		checkNotNull(service);
		checkNotNull(logger);
		final Thread shutdownHook = new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					service.close();
				}
				catch (Throwable t) {
					logger.error("Error during shutdown of blob service via JVM shutdown hook.", t);
				}
			}
		});
		try {
			Runtime.getRuntime().addShutdownHook(shutdownHook);
			return shutdownHook;
		}
		catch (IllegalStateException e) {
			return null;
		}
		catch (Throwable t) {
			logger.error("Cannot register shutdown hook that cleanly terminates the BLOB service.");
			return null;
		}
	}
static Thread addShutdownHook ( final Closeable service , final Logger logger ) { checkNotNull ( service ) ; checkNotNull ( logger ) ; final Thread shutdownHook = new Thread ( new Runnable ( ) { @ Override public void run ( ) { try { service . close ( ) ; } catch ( Throwable t ) { logger . error ( "Error during shutdown of blob service via JVM shutdown hook." , t ) ; } } } ) ; try { Runtime . getRuntime ( ) . addShutdownHook ( shutdownHook ) ; return shutdownHook ; } catch ( IllegalStateException e ) { return null ; } catch ( Throwable t ) { logger . error ( "Cannot register shutdown hook that cleanly terminates the BLOB service." ) ; return null ; } }
Adds a shutdown hook to the JVM and returns the Thread, which has been registered.
Adds a shutdown hook to the JVM and returns the Thread which has been registered .
// Add JVM shutdown hook to call shutdown of service // JVM is already shutting down. no need to do our work