HADOOP-9523. Merge 1478634 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1478636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0b64df0630
commit
881480a16f
|
@ -53,6 +53,9 @@ Release 2.0.5-beta - UNRELEASED
|
|||
HADOOP-9322. LdapGroupsMapping doesn't seem to set a timeout for
|
||||
its directory search. (harsh)
|
||||
|
||||
HADOOP-9523. Provide a generic IBM java vendor flag in PlatformName.java
|
||||
to support non-Sun JREs. (Tian Hong Wang via suresh)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-9150. Avoid unnecessary DNS resolution attempts for logical URIs
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.hadoop.classification.InterfaceStability;
|
|||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.io.compress.DefaultCodec;
|
||||
import org.apache.hadoop.io.compress.zlib.*;
|
||||
import static org.apache.hadoop.util.PlatformName.IBM_JAVA;
|
||||
|
||||
/**
|
||||
* This class creates gzip compressors/decompressors.
|
||||
|
@ -40,6 +41,10 @@ public class GzipCodec extends DefaultCodec {
|
|||
protected static class GzipOutputStream extends CompressorStream {
|
||||
|
||||
private static class ResetableGZIPOutputStream extends GZIPOutputStream {
|
||||
private static final int TRAILER_SIZE = 8;
|
||||
public static final String JVMVersion= System.getProperty("java.version");
|
||||
private static final boolean HAS_BROKEN_FINISH =
|
||||
(IBM_JAVA && JVMVersion.contains("1.6.0"));
|
||||
|
||||
public ResetableGZIPOutputStream(OutputStream out) throws IOException {
|
||||
super(out);
|
||||
|
|
|
@ -62,6 +62,7 @@ import org.apache.hadoop.security.token.Token;
|
|||
import org.apache.hadoop.security.token.TokenIdentifier;
|
||||
import org.apache.hadoop.util.Shell;
|
||||
import org.apache.hadoop.util.Time;
|
||||
import static org.apache.hadoop.util.PlatformName.IBM_JAVA;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
|
@ -294,12 +295,11 @@ public class UserGroupInformation {
|
|||
System.getProperty("os.name").startsWith("Windows");
|
||||
private static final boolean is64Bit =
|
||||
System.getProperty("os.arch").contains("64");
|
||||
private static final boolean ibmJava = System.getProperty("java.vendor").contains("IBM");
|
||||
private static final boolean aix = System.getProperty("os.name").equals("AIX");
|
||||
|
||||
/* Return the OS login module class name */
|
||||
private static String getOSLoginModuleName() {
|
||||
if (ibmJava) {
|
||||
if (IBM_JAVA) {
|
||||
if (windows) {
|
||||
return is64Bit ? "com.ibm.security.auth.module.Win64LoginModule"
|
||||
: "com.ibm.security.auth.module.NTLoginModule";
|
||||
|
@ -321,7 +321,7 @@ public class UserGroupInformation {
|
|||
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||
try {
|
||||
String principalClass = null;
|
||||
if (ibmJava) {
|
||||
if (IBM_JAVA) {
|
||||
if (is64Bit) {
|
||||
principalClass = "com.ibm.security.auth.UsernamePrincipal";
|
||||
} else {
|
||||
|
@ -418,7 +418,7 @@ public class UserGroupInformation {
|
|||
private static final Map<String,String> USER_KERBEROS_OPTIONS =
|
||||
new HashMap<String,String>();
|
||||
static {
|
||||
if (ibmJava) {
|
||||
if (IBM_JAVA) {
|
||||
USER_KERBEROS_OPTIONS.put("useDefaultCcache", "true");
|
||||
} else {
|
||||
USER_KERBEROS_OPTIONS.put("doNotPrompt", "true");
|
||||
|
@ -427,7 +427,7 @@ public class UserGroupInformation {
|
|||
}
|
||||
String ticketCache = System.getenv("KRB5CCNAME");
|
||||
if (ticketCache != null) {
|
||||
if (ibmJava) {
|
||||
if (IBM_JAVA) {
|
||||
// The first value searched when "useDefaultCcache" is used.
|
||||
System.setProperty("KRB5CCNAME", ticketCache);
|
||||
} else {
|
||||
|
@ -443,7 +443,7 @@ public class UserGroupInformation {
|
|||
private static final Map<String,String> KEYTAB_KERBEROS_OPTIONS =
|
||||
new HashMap<String,String>();
|
||||
static {
|
||||
if (ibmJava) {
|
||||
if (IBM_JAVA) {
|
||||
KEYTAB_KERBEROS_OPTIONS.put("credsType", "both");
|
||||
} else {
|
||||
KEYTAB_KERBEROS_OPTIONS.put("doNotPrompt", "true");
|
||||
|
@ -475,7 +475,7 @@ public class UserGroupInformation {
|
|||
} else if (USER_KERBEROS_CONFIG_NAME.equals(appName)) {
|
||||
return USER_KERBEROS_CONF;
|
||||
} else if (KEYTAB_KERBEROS_CONFIG_NAME.equals(appName)) {
|
||||
if (ibmJava) {
|
||||
if (IBM_JAVA) {
|
||||
KEYTAB_KERBEROS_OPTIONS.put("useKeytab",
|
||||
prependFileAuthority(keytabFile));
|
||||
} else {
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.hadoop.classification.InterfaceStability;
|
|||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.security.authentication.client.ConnectionConfigurator;
|
||||
import org.apache.hadoop.util.ReflectionUtils;
|
||||
import static org.apache.hadoop.util.PlatformName.IBM_JAVA;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
@ -58,9 +59,7 @@ public class SSLFactory implements ConnectionConfigurator {
|
|||
"hadoop.ssl.client.conf";
|
||||
public static final String SSL_SERVER_CONF_KEY =
|
||||
"hadoop.ssl.server.conf";
|
||||
private static final boolean IBMJAVA =
|
||||
System.getProperty("java.vendor").contains("IBM");
|
||||
public static final String SSLCERTIFICATE = IBMJAVA?"ibmX509":"SunX509";
|
||||
public static final String SSLCERTIFICATE = IBM_JAVA?"ibmX509":"SunX509";
|
||||
|
||||
public static final boolean DEFAULT_SSL_REQUIRE_CLIENT_CERT = false;
|
||||
|
||||
|
|
|
@ -32,19 +32,23 @@ public class PlatformName {
|
|||
* The complete platform 'name' to identify the platform as
|
||||
* per the java-vm.
|
||||
*/
|
||||
private static final String platformName = System.getProperty("os.name") + "-" +
|
||||
private static final String PLATFORM_NAME = System.getProperty("os.name") + "-" +
|
||||
System.getProperty("os.arch") + "-" +
|
||||
System.getProperty("sun.arch.data.model");
|
||||
|
||||
/**
|
||||
* Get the complete platform as per the java-vm.
|
||||
* @return returns the complete platform as per the java-vm.
|
||||
* The java vendor name used in this platform.
|
||||
*/
|
||||
public static String getPlatformName() {
|
||||
return platformName;
|
||||
}
|
||||
public static final String JAVA_VENDOR_NAME = System.getProperty("java.vendor");
|
||||
|
||||
/**
|
||||
* A public static variable to indicate the current java vendor is
|
||||
* IBM java or not.
|
||||
*/
|
||||
public static final boolean IBM_JAVA = JAVA_VENDOR_NAME.contains("IBM");
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(platformName);
|
||||
System.out.println("platform name: " + PLATFORM_NAME);
|
||||
System.out.println("java vendor name: " + JAVA_VENDOR_NAME);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.commons.lang.StringUtils;
|
|||
import org.apache.hadoop.conf.Configuration.IntegerRanges;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.net.NetUtils;
|
||||
import static org.apache.hadoop.util.PlatformName.IBM_JAVA;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
|
||||
public class TestConfiguration extends TestCase {
|
||||
|
@ -51,9 +52,8 @@ public class TestConfiguration extends TestCase {
|
|||
final static String CONFIG = new File("./test-config.xml").getAbsolutePath();
|
||||
final static String CONFIG2 = new File("./test-config2.xml").getAbsolutePath();
|
||||
final static Random RAN = new Random();
|
||||
final static boolean IBMJAVA = System.getProperty("java.vendor").contains("IBM");
|
||||
final static String XMLHEADER =
|
||||
IBMJAVA?"<?xml version=\"1.0\" encoding=\"UTF-8\"?><configuration>":
|
||||
IBM_JAVA?"<?xml version=\"1.0\" encoding=\"UTF-8\"?><configuration>":
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><configuration>";
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue