Skip to content

Commit

Permalink
Use the thread context classloader for loading functions (apache#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
sijie committed Mar 4, 2018
1 parent f026ef8 commit 13bbbf7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pulsar-functions/run-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# under the License.
#

CLASSPATH=`pwd`/api-examples/target/pulsar-functions-api-examples.jar bin/pulsar-functions functions run --function-config conf/example.yml --sink-topic persistent://sample/standalone/ns1/test_result --source-topic persistent://sample/standalone/ns1/test_src --serde-classname org.apache.pulsar.functions.runtime.container.SimpleStringSerDe --function-classpath `pwd`/api-examples/target/pulsar-functions-api-examples.jar
bin/pulsar-functions functions run --function-config conf/example.yml --sink-topic persistent://sample/standalone/ns1/test_result --source-topic persistent://sample/standalone/ns1/test_src --serde-classname org.apache.pulsar.functions.runtime.container.SimpleStringSerDe --function-classpath `pwd`/api-examples/target/pulsar-functions-api-examples.jar
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public class JavaInstance {
public static Object createObject(String userClassName) {
Object object;
try {
Class<?> clazz = Class.forName(userClassName);
Class<?> clazz = Class.forName(
userClassName,
true,
Thread.currentThread().getContextClassLoader());
object = clazz.newInstance();
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex + " User class must be in class path.");
Expand Down

0 comments on commit 13bbbf7

Please sign in to comment.