From d98e7e79d02f202145356ee63ea3156024e96501 Mon Sep 17 00:00:00 2001 From: Renjie Liu Date: Sun, 28 Jan 2024 17:47:51 +0800 Subject: [PATCH] Add comment for pakcage overrides --- .../src/main/java/org/apache/iceberg/common/README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 java/connector-node/risingwave-sink-iceberg/src/main/java/org/apache/iceberg/common/README.md diff --git a/java/connector-node/risingwave-sink-iceberg/src/main/java/org/apache/iceberg/common/README.md b/java/connector-node/risingwave-sink-iceberg/src/main/java/org/apache/iceberg/common/README.md new file mode 100644 index 0000000000000..21ae34ca3c734 --- /dev/null +++ b/java/connector-node/risingwave-sink-iceberg/src/main/java/org/apache/iceberg/common/README.md @@ -0,0 +1,6 @@ +# Why we need this package? + +In this package we have overrided the `iceberg-common` package, since in original `iceberg-common` it uses `Thread.getContextClassLoader` to load classes dynamically. +While this works well in most cases, it will fail when invoked by jni, since by default jni threads was passed bootstrap class loader, and `Thread.getContextClassLoader` +will inherit parent thread's class loader. That's to say, all threads created by jni will use bootstrap class loader. While we can use `Thread.setContextClassLoader` to it system class loader +manually, but it's not possible in all cases since iceberg used thread pools internally, which can't be hooked by us. \ No newline at end of file