You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/09/21 07:26:04 UTC

[GitHub] dawidwys commented on a change in pull request #6725: [FLINK-10263] [sql-client] Fix classloader issues in SQL Client

dawidwys commented on a change in pull request #6725: [FLINK-10263] [sql-client] Fix classloader issues in SQL Client
URL: https://github.com/apache/flink/pull/6725#discussion_r219405018
 
 

 ##########
 File path: flink-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ExecutionContext.java
 ##########
 @@ -183,6 +184,21 @@ public EnvironmentInstance createEnvironmentInstance() {
 		return tableSinks;
 	}
 
+	/**
+	 * Executes the given supplier using the execution context's classloader as thread classloader.
+	 */
+	public <R> R wrapClassLoader(Supplier<R> supplier) {
+		final ClassLoader previousClassloader = Thread.currentThread().getContextClassLoader();
+		Thread.currentThread().setContextClassLoader(classLoader);
+		R returnValue;
+		try {
+			returnValue = supplier.get();
 
 Review comment:
   Can't we just return it here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services