You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2018/02/16 08:03:51 UTC

[2/2] flink git commit: [FLINK-8576][QS] Reduce verbosity when classes can't be found

[FLINK-8576][QS] Reduce verbosity when classes can't be found

This closes #5420.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/1b70f50d
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/1b70f50d
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/1b70f50d

Branch: refs/heads/release-1.4
Commit: 1b70f50d93805d13c7f37b6cd14e95ea8303412d
Parents: f2b5635
Author: zentol <ch...@apache.org>
Authored: Wed Feb 7 10:31:41 2018 +0100
Committer: zentol <ch...@apache.org>
Committed: Fri Feb 16 09:03:35 2018 +0100

----------------------------------------------------------------------
 .../runtime/query/QueryableStateUtils.java      | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/1b70f50d/flink-runtime/src/main/java/org/apache/flink/runtime/query/QueryableStateUtils.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/query/QueryableStateUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/query/QueryableStateUtils.java
index adbe15d..521b720 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/query/QueryableStateUtils.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/query/QueryableStateUtils.java
@@ -36,6 +36,10 @@ public final class QueryableStateUtils {
 
 	private static final Logger LOG = LoggerFactory.getLogger(QueryableStateUtils.class);
 
+	private static final String ERROR_MESSAGE_ON_LOAD_FAILURE =
+		"Probable reason: flink-queryable-state-runtime is not in the classpath. " +
+		"To enable Queryable State, please move the flink-queryable-state-runtime jar from the opt to the lib folder.";
+
 	/**
 	 * Initializes the {@link KvStateClientProxy client proxy} responsible for
 	 * receiving requests from the external (to the cluster) client and forwarding them internally.
@@ -73,10 +77,12 @@ public final class QueryableStateUtils {
 					KvStateRequestStats.class);
 			return constructor.newInstance(address, ports, eventLoopThreads, queryThreads, stats);
 		} catch (ClassNotFoundException e) {
-			LOG.warn("Could not load Queryable State Client Proxy. " +
-					"Probable reason: flink-queryable-state-runtime is not in the classpath. " +
-					"Please put the corresponding jar from the opt to the lib folder.");
-			LOG.debug("Caught exception", e);
+			final String msg = "Could not load Queryable State Client Proxy. " + ERROR_MESSAGE_ON_LOAD_FAILURE;
+			if (LOG.isDebugEnabled()) {
+				LOG.debug(msg + " Cause: " + e.getMessage());
+			} else {
+				LOG.warn(msg);
+			}
 			return null;
 		} catch (InvocationTargetException e) {
 			LOG.error("Queryable State Client Proxy could not be created: ", e.getTargetException());
@@ -128,10 +134,12 @@ public final class QueryableStateUtils {
 					KvStateRequestStats.class);
 			return constructor.newInstance(address, ports, eventLoopThreads, queryThreads, kvStateRegistry, stats);
 		} catch (ClassNotFoundException e) {
-			LOG.warn("Could not load Queryable State Server. " +
-					"Probable reason: flink-queryable-state-runtime is not in the classpath. " +
-					"Please put the corresponding jar from the opt to the lib folder.");
-			LOG.debug("Caught exception", e);
+			final String msg = "Could not load Queryable State Server. " + ERROR_MESSAGE_ON_LOAD_FAILURE;
+			if (LOG.isDebugEnabled()) {
+				LOG.debug(msg + " Cause: " + e.getMessage());
+			} else {
+				LOG.warn(msg);
+			}
 			return null;
 		} catch (InvocationTargetException e) {
 			LOG.error("Queryable State Server could not be created: ", e.getTargetException());