Java Code Examples for sun.management.Agent#loadManagementProperties()

The following examples show how to use sun.management.Agent#loadManagementProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AgentCMETest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 2
Source File: AgentCMETest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 3
Source File: AgentCMETest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 4
Source File: AgentCMETest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 5
Source File: AgentCMETest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 6
Source File: AgentCMETest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 7
Source File: AgentCMETest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 8
Source File: AgentCMETest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * In sun.management.Agent.loadManagementProperties(), call
 * properties.putAll API may fail with ConcurrentModifcationException if the
 * system properties are modified simultaneously by another thread
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println("Start...");

    final Properties properties = System.getProperties();
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            for (int i = 0; i < 100; i++) {
                properties.put(String.valueOf(i), "");
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    // do nothing
                }
            }
        }
    });
    t1.start();

    for (int i = 0; i < 10000; i++) {
        Agent.loadManagementProperties();
    }

    System.out.println("Finished...");
}
 
Example 9
Source File: AdaptorBootstrap.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the SNMP Adaptor Server.
 * If the com.sun.management.snmp.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #initialize(java.lang.String, java.util.Properties)}.
 *
 **/
public static synchronized AdaptorBootstrap initialize() {

    // Load a new properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) return null;

    final String portStr = props.getProperty(PropertyNames.PORT);

    return initialize(portStr,props);
}
 
Example 10
Source File: ConnectorBootstrap.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the JMX Connector Server.
 * If the com.sun.management.jmxremote.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #startRemoteConnectorServer
 *                            (java.lang.String, java.util.Properties)}.
 *
 * This method is used by some jtreg tests.
 **/
 public static synchronized JMXConnectorServer initialize() {

    // Load a new management properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) {
         return null;
    }

    final String portStr = props.getProperty(PropertyNames.PORT);
    return startRemoteConnectorServer(portStr, props);
}
 
Example 11
Source File: ConnectorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the JMX Connector Server.
 * If the com.sun.management.jmxremote.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #startRemoteConnectorServer
 *                            (java.lang.String, java.util.Properties)}.
 *
 * This method is used by some jtreg tests.
 **/
 public static synchronized JMXConnectorServer initialize() {

    // Load a new management properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) {
         return null;
    }

    final String portStr = props.getProperty(PropertyNames.PORT);
    return startRemoteConnectorServer(portStr, props);
}
 
Example 12
Source File: AdaptorBootstrap.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the SNMP Adaptor Server.
 * If the com.sun.management.snmp.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #initialize(java.lang.String, java.util.Properties)}.
 *
 **/
public static synchronized AdaptorBootstrap initialize() {

    // Load a new properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) return null;

    final String portStr = props.getProperty(PropertyNames.PORT);

    return initialize(portStr,props);
}
 
Example 13
Source File: ConnectorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the JMX Connector Server.
 * If the com.sun.management.jmxremote.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #startRemoteConnectorServer
 *                            (java.lang.String, java.util.Properties)}.
 *
 * This method is used by some jtreg tests.
 **/
 public static synchronized JMXConnectorServer initialize() {

    // Load a new management properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) {
         return null;
    }

    final String portStr = props.getProperty(PropertyNames.PORT);
    return startRemoteConnectorServer(portStr, props);
}
 
Example 14
Source File: AdaptorBootstrap.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the SNMP Adaptor Server.
 * If the com.sun.management.snmp.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #initialize(java.lang.String, java.util.Properties)}.
 *
 **/
public static synchronized AdaptorBootstrap initialize() {

    // Load a new properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) return null;

    final String portStr = props.getProperty(PropertyNames.PORT);

    return initialize(portStr,props);
}
 
Example 15
Source File: ConnectorBootstrap.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the JMX Connector Server.
 * If the com.sun.management.jmxremote.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #startRemoteConnectorServer
 *                            (java.lang.String, java.util.Properties)}.
 *
 * This method is used by some jtreg tests.
 **/
 public static synchronized JMXConnectorServer initialize() {

    // Load a new management properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) {
         return null;
    }

    final String portStr = props.getProperty(PropertyNames.PORT);
    return startRemoteConnectorServer(portStr, props);
}
 
Example 16
Source File: AdaptorBootstrap.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the SNMP Adaptor Server.
 * If the com.sun.management.snmp.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #initialize(java.lang.String, java.util.Properties)}.
 *
 **/
public static synchronized AdaptorBootstrap initialize() {

    // Load a new properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) return null;

    final String portStr = props.getProperty(PropertyNames.PORT);

    return initialize(portStr,props);
}
 
Example 17
Source File: ConnectorBootstrap.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the JMX Connector Server.
 * If the com.sun.management.jmxremote.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #startRemoteConnectorServer
 *                            (java.lang.String, java.util.Properties)}.
 *
 * This method is used by some jtreg tests.
 **/
 public static synchronized JMXConnectorServer initialize() {

    // Load a new management properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) {
         return null;
    }

    final String portStr = props.getProperty(PropertyNames.PORT);
    return startRemoteConnectorServer(portStr, props);
}
 
Example 18
Source File: AdaptorBootstrap.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the SNMP Adaptor Server.
 * If the com.sun.management.snmp.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #initialize(java.lang.String, java.util.Properties)}.
 *
 **/
public static synchronized AdaptorBootstrap initialize() {

    // Load a new properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) return null;

    final String portStr = props.getProperty(PropertyNames.PORT);

    return initialize(portStr,props);
}
 
Example 19
Source File: AdaptorBootstrap.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the SNMP Adaptor Server.
 * If the com.sun.management.snmp.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #initialize(java.lang.String, java.util.Properties)}.
 *
 **/
public static synchronized AdaptorBootstrap initialize() {

    // Load a new properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) return null;

    final String portStr = props.getProperty(PropertyNames.PORT);

    return initialize(portStr,props);
}
 
Example 20
Source File: AdaptorBootstrap.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes and starts the SNMP Adaptor Server.
 * If the com.sun.management.snmp.port property is not defined,
 * simply return. Otherwise, attempts to load the config file, and
 * then calls {@link #initialize(java.lang.String, java.util.Properties)}.
 *
 **/
public static synchronized AdaptorBootstrap initialize() {

    // Load a new properties
    final Properties props = Agent.loadManagementProperties();
    if (props == null) return null;

    final String portStr = props.getProperty(PropertyNames.PORT);

    return initialize(portStr,props);
}