|  | @@ -29,7 +29,14 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
 | 
	
		
			
				|  |  |  import org.elasticsearch.common.xcontent.XContentBuilderString;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  | -import java.lang.management.*;
 | 
	
		
			
				|  |  | +import java.lang.management.GarbageCollectorMXBean;
 | 
	
		
			
				|  |  | +import java.lang.management.ManagementFactory;
 | 
	
		
			
				|  |  | +import java.lang.management.ManagementPermission;
 | 
	
		
			
				|  |  | +import java.lang.management.MemoryMXBean;
 | 
	
		
			
				|  |  | +import java.lang.management.MemoryPoolMXBean;
 | 
	
		
			
				|  |  | +import java.lang.management.PlatformManagedObject;
 | 
	
		
			
				|  |  | +import java.lang.management.RuntimeMXBean;
 | 
	
		
			
				|  |  | +import java.lang.reflect.Method;
 | 
	
		
			
				|  |  |  import java.util.Collections;
 | 
	
		
			
				|  |  |  import java.util.HashMap;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
	
		
			
				|  | @@ -101,6 +108,21 @@ public class JvmInfo implements Streamable, ToXContent {
 | 
	
		
			
				|  |  |              info.memoryPools[i] = memoryPoolMXBean.getName();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            @SuppressWarnings("unchecked") Class<? extends PlatformManagedObject> clazz =
 | 
	
		
			
				|  |  | +                (Class<? extends PlatformManagedObject>)Class.forName("com.sun.management.HotSpotDiagnosticMXBean");
 | 
	
		
			
				|  |  | +            Class<?> vmOptionClazz = Class.forName("com.sun.management.VMOption");
 | 
	
		
			
				|  |  | +            PlatformManagedObject hotSpotDiagnosticMXBean = ManagementFactory.getPlatformMXBean(clazz);
 | 
	
		
			
				|  |  | +            Method vmOptionMethod = clazz.getMethod("getVMOption", String.class);
 | 
	
		
			
				|  |  | +            Object useCompressedOopsVmOption = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "UseCompressedOops");
 | 
	
		
			
				|  |  | +            Method valueMethod = vmOptionClazz.getMethod("getValue");
 | 
	
		
			
				|  |  | +            String value = (String)valueMethod.invoke(useCompressedOopsVmOption);
 | 
	
		
			
				|  |  | +            info.usingCompressedOops = Boolean.parseBoolean(value);
 | 
	
		
			
				|  |  | +        } catch (Throwable t) {
 | 
	
		
			
				|  |  | +            // unable to deduce the state of compressed oops
 | 
	
		
			
				|  |  | +            // usingCompressedOops will hold its default value of null
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          INSTANCE = info;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -135,6 +157,8 @@ public class JvmInfo implements Streamable, ToXContent {
 | 
	
		
			
				|  |  |      String[] gcCollectors = Strings.EMPTY_ARRAY;
 | 
	
		
			
				|  |  |      String[] memoryPools = Strings.EMPTY_ARRAY;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    private Boolean usingCompressedOops;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private JvmInfo() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -258,6 +282,10 @@ public class JvmInfo implements Streamable, ToXContent {
 | 
	
		
			
				|  |  |          return this.systemProperties;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public Boolean usingCompressedOops() {
 | 
	
		
			
				|  |  | +        return this.usingCompressedOops;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
 | 
	
		
			
				|  |  |          builder.startObject(Fields.JVM);
 | 
	
	
		
			
				|  | @@ -279,6 +307,8 @@ public class JvmInfo implements Streamable, ToXContent {
 | 
	
		
			
				|  |  |          builder.field(Fields.GC_COLLECTORS, gcCollectors);
 | 
	
		
			
				|  |  |          builder.field(Fields.MEMORY_POOLS, memoryPools);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        builder.field(Fields.USING_COMPRESSED_OOPS, usingCompressedOops == null ? "unknown" : usingCompressedOops);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          builder.endObject();
 | 
	
		
			
				|  |  |          return builder;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -306,6 +336,7 @@ public class JvmInfo implements Streamable, ToXContent {
 | 
	
		
			
				|  |  |          static final XContentBuilderString DIRECT_MAX_IN_BYTES = new XContentBuilderString("direct_max_in_bytes");
 | 
	
		
			
				|  |  |          static final XContentBuilderString GC_COLLECTORS = new XContentBuilderString("gc_collectors");
 | 
	
		
			
				|  |  |          static final XContentBuilderString MEMORY_POOLS = new XContentBuilderString("memory_pools");
 | 
	
		
			
				|  |  | +        static final XContentBuilderString USING_COMPRESSED_OOPS = new XContentBuilderString("using_compressed_ordinary_object_pointers");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public static JvmInfo readJvmInfo(StreamInput in) throws IOException {
 | 
	
	
		
			
				|  | @@ -337,6 +368,11 @@ public class JvmInfo implements Streamable, ToXContent {
 | 
	
		
			
				|  |  |          mem.readFrom(in);
 | 
	
		
			
				|  |  |          gcCollectors = in.readStringArray();
 | 
	
		
			
				|  |  |          memoryPools = in.readStringArray();
 | 
	
		
			
				|  |  | +        if (in.readBoolean()) {
 | 
	
		
			
				|  |  | +            usingCompressedOops = in.readBoolean();
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            usingCompressedOops = null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -361,6 +397,12 @@ public class JvmInfo implements Streamable, ToXContent {
 | 
	
		
			
				|  |  |          mem.writeTo(out);
 | 
	
		
			
				|  |  |          out.writeStringArray(gcCollectors);
 | 
	
		
			
				|  |  |          out.writeStringArray(memoryPools);
 | 
	
		
			
				|  |  | +        if (usingCompressedOops != null) {
 | 
	
		
			
				|  |  | +            out.writeBoolean(true);
 | 
	
		
			
				|  |  | +            out.writeBoolean(usingCompressedOops);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            out.writeBoolean(false);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public static class Mem implements Streamable {
 |