< prev index next >

src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java

Print this page
rev 52470 : 8213596: test failure with Graal when security manager and policy file are used


  63     private final HotSpotGraalRuntime runtime;
  64 
  65     /**
  66      * The object name under which the bean is registered.
  67      */
  68     private final ObjectName objectName;
  69 
  70     HotSpotGraalRuntimeMBean(ObjectName objectName, HotSpotGraalRuntime runtime) {
  71         this.objectName = objectName;
  72         this.runtime = runtime;
  73     }
  74 
  75     ObjectName getObjectName() {
  76         return objectName;
  77     }
  78 
  79     HotSpotGraalRuntime getRuntime() {
  80         return runtime;
  81     }
  82 
  83     private static final boolean DEBUG = Boolean.getBoolean(HotSpotGraalRuntimeMBean.class.getSimpleName() + ".debug");









  84 
  85     @Override
  86     public Object getAttribute(String name) throws AttributeNotFoundException {
  87         String[] result = runtime.getOptionValues(name);
  88         String value = result[0];
  89         if (value == null) {
  90             throw new AttributeNotFoundException(name);
  91         }
  92         if (DEBUG) {
  93             System.out.printf("getAttribute: %s = %s (type: %s)%n", name, value, value == null ? "null" : value.getClass().getName());
  94         }
  95         return result[0];
  96     }
  97 
  98     @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "reference equality on the receiver is what we want")
  99     @Override
 100     public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException {
 101         String name = attribute.getName();
 102         Object value = attribute.getValue();
 103         String svalue = String.valueOf(value);




  63     private final HotSpotGraalRuntime runtime;
  64 
  65     /**
  66      * The object name under which the bean is registered.
  67      */
  68     private final ObjectName objectName;
  69 
  70     HotSpotGraalRuntimeMBean(ObjectName objectName, HotSpotGraalRuntime runtime) {
  71         this.objectName = objectName;
  72         this.runtime = runtime;
  73     }
  74 
  75     ObjectName getObjectName() {
  76         return objectName;
  77     }
  78 
  79     HotSpotGraalRuntime getRuntime() {
  80         return runtime;
  81     }
  82 
  83     private static final boolean DEBUG = initDebug();
  84 
  85     private static boolean initDebug() {
  86         try {
  87             return Boolean.getBoolean(HotSpotGraalRuntimeMBean.class.getSimpleName() + ".debug");
  88         } catch (SecurityException e) {
  89             // Swallow the exception
  90             return false;
  91         }
  92     }
  93 
  94     @Override
  95     public Object getAttribute(String name) throws AttributeNotFoundException {
  96         String[] result = runtime.getOptionValues(name);
  97         String value = result[0];
  98         if (value == null) {
  99             throw new AttributeNotFoundException(name);
 100         }
 101         if (DEBUG) {
 102             System.out.printf("getAttribute: %s = %s (type: %s)%n", name, value, value == null ? "null" : value.getClass().getName());
 103         }
 104         return result[0];
 105     }
 106 
 107     @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "reference equality on the receiver is what we want")
 108     @Override
 109     public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException {
 110         String name = attribute.getName();
 111         Object value = attribute.getValue();
 112         String svalue = String.valueOf(value);


< prev index next >