HADOOP-17544. Mark KeyProvider as Stable. (#2776)

Reviewed-by: Masatake Iwasaki <iwasakims@apache.org>
This commit is contained in:
Akira Ajisaka 2021-08-30 09:55:53 +09:00 committed by GitHub
parent 7b5be74228
commit 50dda774f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,17 +27,17 @@
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.Security; import java.security.Security;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter; import com.google.gson.stream.JsonWriter;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
@ -57,7 +57,7 @@
* <code>KeyProvider</code> implementations must be thread safe. * <code>KeyProvider</code> implementations must be thread safe.
*/ */
@InterfaceAudience.Public @InterfaceAudience.Public
@InterfaceStability.Unstable @InterfaceStability.Stable
public abstract class KeyProvider implements Closeable { public abstract class KeyProvider implements Closeable {
public static final String DEFAULT_CIPHER_NAME = public static final String DEFAULT_CIPHER_NAME =
CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_DEFAULT_CIPHER_KEY; CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_DEFAULT_CIPHER_KEY;
@ -135,20 +135,14 @@ public boolean equals(Object rhs) {
return false; return false;
} }
final KeyVersion kv = (KeyVersion) rhs; final KeyVersion kv = (KeyVersion) rhs;
return new EqualsBuilder(). return Objects.equals(name, kv.name)
append(name, kv.name). && Objects.equals(versionName, kv.versionName)
append(versionName, kv.versionName). && Arrays.equals(material, kv.material);
append(material, kv.material).
isEquals();
} }
@Override @Override
public int hashCode() { public int hashCode() {
return new HashCodeBuilder(). return Objects.hash(name, versionName, Arrays.hashCode(material));
append(name).
append(versionName).
append(material).
toHashCode();
} }
} }