stoty commented on code in PR #7892:
URL: https://github.com/apache/hadoop/pull/7892#discussion_r2307456822


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/HadoopThread.java:
##########
@@ -0,0 +1,105 @@
+/**
+ * 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.util.concurrent;
+
+import java.security.PrivilegedAction;
+import javax.security.auth.Subject;
+
+import org.apache.hadoop.security.authentication.util.SubjectUtil;
+
+/**
+ * Helper class to restore Subject propagation behavior after the JEP411/JEP486
+ * changes
+ * 
+ * Runnables can be specified normally, but the work() method has to be
+ * overridden instead of run() when subclassing.
+ */
+public class HadoopThread extends Thread {

Review Comment:
   I have added a unit test.
   
   It's really up to downstream projects.
   
   For example, in HBase we support multiple Hadoop versions, so we will have 
to clone HadoopThread, otherwise we'd have to drop support for all earlier 
Hadoop versions. 
   
   Downstream users who are fine with supporting only the latest Hadoop release 
can use it directly.
   
   If we consider this a public API, then maybe we could try to find a better 
name for it, as HadoopThread is not very descriptive, I just haven't been able 
to find one that is not super long or awkward.
   
   _SubjectInheritingThread_ would be a candidate, but it's too long IMO.
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to