[ 
https://issues.apache.org/jira/browse/HADOOP-18993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17808583#comment-17808583
 ] 

ASF GitHub Bot commented on HADOOP-18993:
-----------------------------------------

tmnd1991 commented on code in PR #6301:
URL: https://github.com/apache/hadoop/pull/6301#discussion_r1458691419


##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AFileSystemIsolatedClassloader.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.s3a;
+
+import java.io.IOException;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestS3AFileSystemIsolatedClassloader {
+
+  public static class CustomClassLoader extends ClassLoader {
+  }
+
+  private final ClassLoader classLoader = new CustomClassLoader();
+
+  @Test
+  public void isolatedClasspath() throws IOException {
+    try (S3AFileSystem fs = new S3AFileSystem()) {
+      Configuration conf = new Configuration();

Review Comment:
   I actually could not use getConfiguration() otherwise Configuration object 
would've been initialised in a way that made my tests fail, I hope the way I 
did it is still good enough



##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AFileSystemIsolatedClassloader.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.s3a;
+
+import java.io.IOException;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestS3AFileSystemIsolatedClassloader {
+
+  public static class CustomClassLoader extends ClassLoader {
+  }
+
+  private final ClassLoader classLoader = new CustomClassLoader();
+
+  @Test
+  public void isolatedClasspath() throws IOException {
+    try (S3AFileSystem fs = new S3AFileSystem()) {
+      Configuration conf = new Configuration();
+      conf.setBoolean(Constants.AWS_S3_EXTENSIONS_ISOLATED_CLASSLOADER, true);
+      fs.isolateClassloader(conf, classLoader);
+      Assert.assertTrue(conf.getClassLoader() instanceof CustomClassLoader);
+    }
+  }
+
+  @Test
+  public void isolatedClasspathDefault() throws IOException {
+    try (S3AFileSystem fs = new S3AFileSystem()) {
+      Configuration conf = new Configuration();

Review Comment:
   I actually could not use `getConfiguration()` otherwise `Configuration` 
object would've been initialised in a way that made my tests fail, I hope the 
way I did it is still good enough





> Allow to not isolate S3AFileSystem classloader when needed
> ----------------------------------------------------------
>
>                 Key: HADOOP-18993
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18993
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: hadoop-thirdparty
>    Affects Versions: 3.3.6
>            Reporter: Antonio Murgia
>            Priority: Minor
>              Labels: pull-request-available
>
> In HADOOP-17372 the S3AFileSystem forces the configuration classloader to be 
> the same as the one that loaded S3AFileSystem. This leads to the 
> impossibility in Spark applications to load third party credentials providers 
> as user jars.
> I propose to add a configuration key 
> {{fs.s3a.extensions.isolated.classloader}} with a default value of {{true}} 
> that if set to {{false}} will not perform the classloader set.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to