flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject flink git commit: [FLINK-1479] [runtime] Spawned threads in sorter get the same context class loader as the parent thread
Date Mon, 09 Feb 2015 12:23:56 GMT
Repository: flink
Updated Branches:
  refs/heads/release-0.8 aca62100f -> 44b799d6e


[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/44b799d6
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/44b799d6
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/44b799d6

Branch: refs/heads/release-0.8
Commit: 44b799d6edc7eb006a3c669df5f63294e18f4268
Parents: aca6210
Author: Stephan Ewen <sewen@apache.org>
Authored: Thu Feb 5 14:09:51 2015 +0100
Committer: Stephan Ewen <sewen@apache.org>
Committed: Mon Feb 9 13:23:27 2015 +0100

----------------------------------------------------------------------
 .../runtime/operators/sort/UnilateralSortMerger.java  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/44b799d6/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 459ef82..a24c702 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
@@ -401,6 +401,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();
 	}
 	


Mime
View raw message