Repository: flink Updated Branches: refs/heads/master f361e7d00 -> 63720634e
[FLINK-1479] [runtime] Spawned threads in sorter get the same context class loader as the parent thread Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/63720634 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/63720634 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/63720634 Branch: refs/heads/master Commit: 63720634e2333a86eed0e9957bcc35122067dae6 Parents: f361e7d Author: Stephan Ewen <[email protected]> Authored: Thu Feb 5 14:09:51 2015 +0100 Committer: Stephan Ewen <[email protected]> Committed: Thu Feb 5 14:15:12 2015 +0100 ---------------------------------------------------------------------- .../runtime/operators/sort/UnilateralSortMerger.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/63720634/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java index cdd5eb4..a938e98 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java @@ -373,6 +373,20 @@ public class UnilateralSortMerger<E> implements Sorter<E> { memoryManager, ioManager, serializerFactory, comparator, this.sortReadMemory, this.writeMemory, maxNumFileHandles); + // propagate the context class loader to the spawned threads + ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); + if (contextLoader != null) { + if (this.readThread != null) { + this.readThread.setContextClassLoader(contextLoader); + } + if (this.sortThread != null) { + this.sortThread.setContextClassLoader(contextLoader); + } + if (this.spillThread != null) { + this.spillThread.setContextClassLoader(contextLoader); + } + } + startThreads(); }
