showuon commented on code in PR #16522:
URL: https://github.com/apache/kafka/pull/16522#discussion_r1732279351


##########
clients/src/main/java/org/apache/kafka/common/internals/SecurityManagerCompatibility.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.kafka.common.internals;
+
+import java.security.PrivilegedAction;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletionException;
+
+import javax.security.auth.Subject;
+
+/**
+ * This is a compatibility class to provide dual-support for JREs with and 
without SecurityManager support.
+ * <p>Users should call {@link #get()} to retrieve a singleton instance, and 
call instance methods
+ * {@link #doPrivileged(PrivilegedAction)}, {@link #current()}, and {@link 
#callAs(Subject, Callable)}.
+ * <p>This class's motivation and expected behavior is defined in
+ * <a 
href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-1006%3A+Remove+SecurityManager+Support";>KIP-1006</a>
+ */
+public interface SecurityManagerCompatibility {
+
+    /**
+     * @return an implementation of this interface which conforms to the 
functionality available in the current JRE.
+     */
+    static SecurityManagerCompatibility get() {
+        return CompositeStrategy.INSTANCE;
+    }
+
+    /**
+     * Performs the specified {@code PrivilegedAction} with privileges
+     * enabled. The action is performed with <i>all</i> of the permissions
+     * possessed by the caller's protection domain.
+     *
+     * <p> If the action's {@code run} method throws an (unchecked)
+     * exception, it will propagate through this method.
+     *
+     * <p> Note that any DomainCombiner associated with the current
+     * AccessControlContext will be ignored while the action is performed.
+     *
+     * @param <T> the type of the value returned by the PrivilegedAction's
+     *                  {@code run} method.

Review Comment:
   nit: indent



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to