java.lang.management.PlatformLoggingMXBean Java Examples
The following examples show how to use
java.lang.management.PlatformLoggingMXBean.
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: MainWindow.java From Recaf with MIT License | 6 votes |
/** * @param controller * Window context. * * @return main window instance. */ public static MainWindow get(GuiController controller) { if(window == null) { MainWindow app = window = new MainWindow(controller); PlatformImpl.startup(() -> { Stage stage = new Stage(); try { Field field = Stage.class.getDeclaredField("primary"); field.setAccessible(true); field.setBoolean(stage, true); app.init(); app.start(stage); } catch (Exception ex) { throw new RuntimeException(ex); } // Disable CSS logger, it complains a lot about non-issues try { ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class) .setLoggerLevel("javafx.css", "OFF"); } catch (IllegalArgumentException ignored) { // Expected: logger may not exist } }); } return window; }
Example #2
Source File: GetObjectName.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #3
Source File: PlatformLoggingMXBeanTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #4
Source File: GetObjectName.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #5
Source File: PlatformLoggingMXBeanTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #6
Source File: GetObjectName.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #7
Source File: PlatformLoggingMXBeanTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #8
Source File: GetObjectName.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #9
Source File: PlatformLoggingMXBeanTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #10
Source File: GetObjectName.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #11
Source File: PlatformLoggingMXBeanTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #12
Source File: GetObjectName.java From hottub with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #13
Source File: PlatformLoggingMXBeanTest.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #14
Source File: GetObjectName.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #15
Source File: PlatformLoggingMXBeanTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #16
Source File: PlatformLoggingMXBeanTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #17
Source File: GetObjectName.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #18
Source File: PlatformLoggingMXBeanTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #19
Source File: GetObjectName.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #20
Source File: PlatformLoggingMXBeanTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #21
Source File: GetObjectName.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #22
Source File: PlatformLoggingMXBeanTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #23
Source File: GetObjectName.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #24
Source File: PlatformLoggingMXBeanTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #25
Source File: GetObjectName.java From native-obfuscator with GNU General Public License v3.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #26
Source File: PlatformLoggingMXBeanTest.java From native-obfuscator with GNU General Public License v3.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #27
Source File: GetObjectName.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }
Example #28
Source File: PlatformLoggingMXBeanTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] argv) throws Exception { PlatformLoggingMXBean mbean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); } // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } // test if PlatformLoggingMXBean works properly in a MBeanServer PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest(); test.runTest(mbean); }
Example #29
Source File: GetObjectName.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static void submitTasks(ExecutorService executor, int count) { for (int i=0; i < count && !failed; i++) { executor.execute(new Runnable() { @Override public void run() { List<PlatformManagedObject> mbeans = new ArrayList<>(); mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)); mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)); for (PlatformManagedObject pmo : mbeans) { // Name should not be null if (pmo.getObjectName() == null) { failed = true; throw new RuntimeException("TEST FAILED: getObjectName() returns null"); } } } }); } }