flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
/**
	 * Starts the web runtime monitor. Because the actual implementation of the runtime monitor is
	 * in another project, we load the runtime monitor dynamically.
	 *
	 * <p>Because failure to start the web runtime monitor is not considered fatal, this method does
	 * not throw any exceptions, but only logs them.
	 *
	 * @param config The configuration for the runtime monitor.
	 * @param highAvailabilityServices HighAvailabilityServices used to start the WebRuntimeMonitor
	 * @param jobManagerRetriever which retrieves the currently leading JobManager
	 * @param queryServiceRetriever which retrieves the query service
	 * @param timeout for asynchronous operations
	 * @param scheduledExecutor to run asynchronous operations
	 */
Starts the web runtime monitor. Because the actual implementation of the runtime monitor is
in another project, we load the runtime monitor dynamically.

Because failure to start the web runtime monitor is not considered fatal, this method does
not throw any exceptions, but only logs them.

@param config The configuration for the runtime monitor.
Starts the web runtime monitor . Because the actual implementation of the runtime monitor is in another project we load the runtime monitor dynamically . Because failure to start the web runtime monitor is not considered fatal this method does not throw any exceptions but only logs them . @param config The configuration for the runtime monitor .
public static WebMonitor startWebRuntimeMonitor(
			Configuration config,
			HighAvailabilityServices highAvailabilityServices,
			LeaderGatewayRetriever<JobManagerGateway> jobManagerRetriever,
			MetricQueryServiceRetriever queryServiceRetriever,
			Time timeout,
			ScheduledExecutor scheduledExecutor) {
		try {
			String classname = "org.apache.flink.runtime.webmonitor.WebRuntimeMonitor";
			Class<? extends WebMonitor> clazz = Class.forName(classname).asSubclass(WebMonitor.class);
			Constructor<? extends WebMonitor> constructor = clazz.getConstructor(
				Configuration.class,
				LeaderRetrievalService.class,
				LeaderGatewayRetriever.class,
				MetricQueryServiceRetriever.class,
				Time.class,
				ScheduledExecutor.class);
			return constructor.newInstance(
				config,
				highAvailabilityServices.getJobManagerLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID),
				jobManagerRetriever,
				queryServiceRetriever,
				timeout,
				scheduledExecutor);
		} catch (ClassNotFoundException e) {
			LOG.error("Could not load web runtime monitor. " +
					"Probably reason: flink-runtime-web is not in the classpath");
			LOG.debug("Caught exception", e);
			return null;
		} catch (InvocationTargetException e) {
			LOG.error("WebServer could not be created", e.getTargetException());
			return null;
		} catch (Throwable t) {
			LOG.error("Failed to instantiate web runtime monitor.", t);
			return null;
		}
	}
public static WebMonitor startWebRuntimeMonitor ( Configuration config , HighAvailabilityServices highAvailabilityServices , LeaderGatewayRetriever < JobManagerGateway > jobManagerRetriever , MetricQueryServiceRetriever queryServiceRetriever , Time timeout , ScheduledExecutor scheduledExecutor ) { try { String classname = "org.apache.flink.runtime.webmonitor.WebRuntimeMonitor" ; Class < ? extends WebMonitor > clazz = Class . forName ( classname ) . asSubclass ( WebMonitor . class ) ; Constructor < ? extends WebMonitor > constructor = clazz . getConstructor ( Configuration . class , LeaderRetrievalService . class , LeaderGatewayRetriever . class , MetricQueryServiceRetriever . class , Time . class , ScheduledExecutor . class ) ; return constructor . newInstance ( config , highAvailabilityServices . getJobManagerLeaderRetriever ( HighAvailabilityServices . DEFAULT_JOB_ID ) , jobManagerRetriever , queryServiceRetriever , timeout , scheduledExecutor ) ; } catch ( ClassNotFoundException e ) { LOG . error ( "Could not load web runtime monitor. " + "Probably reason: flink-runtime-web is not in the classpath" ) ; LOG . debug ( "Caught exception" , e ) ; return null ; } catch ( InvocationTargetException e ) { LOG . error ( "WebServer could not be created" , e . getTargetException ( ) ) ; return null ; } catch ( Throwable t ) { LOG . error ( "Failed to instantiate web runtime monitor." , t ) ; return null ; } }
Starts the web runtime monitor.
Starts the web runtime monitor .
// try to load and instantiate the class