From 1d1920cbb18020fb55d6fe4a9068276c252c5f64 Mon Sep 17 00:00:00 2001 From: gaohongtao Date: Wed, 12 Jul 2017 14:39:03 +0800 Subject: [PATCH] ContextClassLoader is null --- RELEASE-NOTES.md | 5 +++++ .../dangdang/ddframe/job/cloud/executor/TaskExecutor.java | 1 + 2 files changed, 6 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index f5ed4d4440..419423b0d3 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,10 @@ ## 2.1.6 +### 缺陷修正 + +1. [ISSUE #384](https://github.com/dangdangdotcom/elastic-job/issues/384) Cloud的执行器线程ContextClassLoader为空 + + ## 2.1.5 ### 新功能 diff --git a/elastic-job-cloud/elastic-job-cloud-executor/src/main/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutor.java b/elastic-job-cloud/elastic-job-cloud-executor/src/main/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutor.java index c56949f36c..131afcc167 100644 --- a/elastic-job-cloud/elastic-job-cloud-executor/src/main/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutor.java +++ b/elastic-job-cloud/elastic-job-cloud-executor/src/main/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutor.java @@ -117,6 +117,7 @@ class TaskThread implements Runnable { @Override public void run() { + Thread.currentThread().setContextClassLoader(TaskThread.class.getClassLoader()); executorDriver.sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(Protos.TaskState.TASK_RUNNING).build()); Map data = SerializationUtils.deserialize(taskInfo.getData().toByteArray()); ShardingContexts shardingContexts = (ShardingContexts) data.get("shardingContext");