flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [1/2] flink git commit: [CLI] Set current class loader to user-class loader and disable class initialization. Enalbes submission of Flink programs written in Clojure.
Date Wed, 03 Feb 2016 10:38:35 GMT
Repository: flink
Updated Branches:
  refs/heads/release-0.10 bef39f881 -> e5b191081


[CLI] Set current class loader to user-class loader and disable class initialization.
Enalbes submission of Flink programs written in Clojure.

This closes #1457


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

Branch: refs/heads/release-0.10
Commit: 602151fea48b21079c7ea35b051c7a29ec111211
Parents: bef39f8
Author: mjsax <mjsax@informatik.hu-berlin.de>
Authored: Tue Dec 15 14:14:17 2015 +0100
Committer: Ufuk Celebi <uce@apache.org>
Committed: Wed Feb 3 11:11:23 2016 +0100

----------------------------------------------------------------------
 .../org/apache/flink/client/program/PackagedProgram.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/602151fe/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java
b/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java
index aeac296..8375ec2 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java
@@ -574,8 +574,11 @@ public class PackagedProgram {
 	}
 	
 	private static Class<?> loadMainClass(String className, ClassLoader cl) throws ProgramInvocationException
{
+		ClassLoader contextCl = null;
 		try {
-			return Class.forName(className, true, cl);
+			contextCl = Thread.currentThread().getContextClassLoader();
+			Thread.currentThread().setContextClassLoader(cl);
+			return Class.forName(className, false, cl);
 		}
 		catch (ClassNotFoundException e) {
 			throw new ProgramInvocationException("The program's entry point class '" + className
@@ -592,6 +595,10 @@ public class PackagedProgram {
 		catch (Throwable t) {
 			throw new ProgramInvocationException("The program's entry point class '" + className
 				+ "' caused an exception during initialization: "+ t.getMessage(), t);
+		} finally {
+			if (contextCl != null) {
+				Thread.currentThread().setContextClassLoader(contextCl);
+			}
 		}
 	}
 	


Mime
View raw message