flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mjsax <...@git.apache.org>
Subject [GitHub] flink pull request: Set current class loader to user-class loader ...
Date Thu, 17 Dec 2015 15:37:19 GMT
Github user mjsax commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1457#discussion_r47919597
  
    --- Diff: flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java
---
    @@ -574,8 +574,11 @@ private static String getEntryPointClassNameFromJar(URL jarFile)
throws ProgramI
     	}
     	
     	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);
    --- End diff --
    
    Required for the Clojure case. If we initialize right here, the `main` method gets invoked
right away. This is too early as not everything got set up properly at this point by the client
and the execution fails.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message