Java Code Examples for jdk.jfr.consumer.RecordedClass#getValue()
The following examples show how to use
jdk.jfr.consumer.RecordedClass#getValue() .
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: TestRecordedEvent.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Throwable { Recording r = new Recording(); r.start(); TestEvent t = new TestEvent(); t.commit(); r.stop(); List<RecordedEvent> events = Events.fromRecording(r); Events.hasEvents(events); Asserts.assertEquals(events.size(), 1); RecordedEvent event = events.get(0); System.out.println(event); List<ValueDescriptor> descriptors = event.getFields(); System.out.println("Descriptors"); for (ValueDescriptor descriptor : descriptors) { System.out.println(descriptor.getName()); System.out.println(descriptor.getTypeName()); } System.out.println("Descriptors end"); Object recordedClass = event.getValue("clzField"); Asserts.assertTrue(recordedClass instanceof RecordedClass, "Expected Recorded Class got " + recordedClass); Object recordedInt = event.getValue("intField"); Asserts.assertTrue(recordedInt instanceof Integer); Object recordedString = event.getValue("stringField"); System.out.println("recordedString class: " + recordedString.getClass()); Asserts.assertTrue(recordedString instanceof String); Object myClass = event.getValue("myClass"); Asserts.assertTrue(myClass instanceof RecordedClass, "Expected Recorded Class got " + recordedClass); RecordedClass myRecClass = (RecordedClass) myClass; Asserts.assertEquals(MyClass.class.getName(), myRecClass.getName(), "Got " + myRecClass.getName()); Object recordedClassLoader = myRecClass.getValue("classLoader"); Asserts.assertTrue(recordedClassLoader instanceof RecordedClassLoader, "Expected Recorded ClassLoader got " + recordedClassLoader); RecordedClassLoader myRecClassLoader = (RecordedClassLoader)recordedClassLoader; ClassLoader cl = MyClass.class.getClassLoader(); Asserts.assertEquals(cl.getClass().getName(), myRecClassLoader.getType().getName(), "Expected Recorded ClassLoader type to equal loader type"); Asserts.assertNotNull(myRecClass.getModifiers()); }
Example 2
Source File: Events.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static RecordedObject getRecordedPackage(final RecordedClass rc) { if (rc == null) { throw new RuntimeException("RecordedClass must not be null!"); } return rc.getValue("package"); }
Example 3
Source File: TestRecordedEvent.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Throwable { Recording r = new Recording(); r.start(); TestEvent t = new TestEvent(); t.commit(); r.stop(); List<RecordedEvent> events = Events.fromRecording(r); Events.hasEvents(events); Asserts.assertEquals(events.size(), 1); RecordedEvent event = events.get(0); List<ValueDescriptor> descriptors = event.getFields(); System.out.println("Descriptors"); for (ValueDescriptor descriptor : descriptors) { System.out.println(descriptor.getName()); System.out.println(descriptor.getTypeName()); } System.out.println("Descriptors end"); Object recordedClass = event.getValue("clzField"); Asserts.assertTrue(recordedClass instanceof RecordedClass, "Expected Recorded Class got " + recordedClass); Object recordedInt = event.getValue("intField"); Asserts.assertTrue(recordedInt instanceof Integer); Object recordedString = event.getValue("stringField"); System.out.println("recordedString class: " + recordedString.getClass()); Asserts.assertTrue(recordedString instanceof String); Object myClass = event.getValue("myClass"); Asserts.assertTrue(myClass instanceof RecordedClass, "Expected Recorded Class got " + recordedClass); RecordedClass myRecClass = (RecordedClass) myClass; Asserts.assertEquals(MyClass.class.getName(), myRecClass.getName(), "Got " + myRecClass.getName()); Object recordedClassLoader = myRecClass.getValue("classLoader"); Asserts.assertTrue(recordedClassLoader instanceof RecordedClassLoader, "Expected Recorded ClassLoader got " + recordedClassLoader); RecordedClassLoader myRecClassLoader = (RecordedClassLoader)recordedClassLoader; ClassLoader cl = MyClass.class.getClassLoader(); Asserts.assertEquals(cl.getClass().getName(), myRecClassLoader.getType().getName(), "Expected Recorded ClassLoader type to equal loader type"); Asserts.assertNotNull(myRecClass.getModifiers()); }
Example 4
Source File: Events.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static RecordedObject getRecordedPackage(final RecordedClass rc) { if (rc == null) { throw new RuntimeException("RecordedClass must not be null!"); } return rc.getValue("package"); }
Example 5
Source File: TestRecordedEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Throwable { Recording r = new Recording(); r.start(); TestEvent t = new TestEvent(); t.commit(); r.stop(); List<RecordedEvent> events = Events.fromRecording(r); Events.hasEvents(events); Asserts.assertEquals(events.size(), 1); RecordedEvent event = events.get(0); List<ValueDescriptor> descriptors = event.getFields(); System.out.println("Descriptors"); for (ValueDescriptor descriptor : descriptors) { System.out.println(descriptor.getName()); System.out.println(descriptor.getTypeName()); } System.out.println("Descriptors end"); Object recordedClass = event.getValue("clzField"); Asserts.assertTrue(recordedClass instanceof RecordedClass, "Expected Recorded Class got " + recordedClass); Object recordedInt = event.getValue("intField"); Asserts.assertTrue(recordedInt instanceof Integer); Object recordedString = event.getValue("stringField"); System.out.println("recordedString class: " + recordedString.getClass()); Asserts.assertTrue(recordedString instanceof String); Object myClass = event.getValue("myClass"); Asserts.assertTrue(myClass instanceof RecordedClass, "Expected Recorded Class got " + recordedClass); RecordedClass myRecClass = (RecordedClass) myClass; Asserts.assertEquals(MyClass.class.getName(), myRecClass.getName(), "Got " + myRecClass.getName()); Object recordedClassLoader = myRecClass.getValue("classLoader"); Asserts.assertTrue(recordedClassLoader instanceof RecordedClassLoader, "Expected Recorded ClassLoader got " + recordedClassLoader); RecordedClassLoader myRecClassLoader = (RecordedClassLoader)recordedClassLoader; ClassLoader cl = MyClass.class.getClassLoader(); Asserts.assertEquals(cl.getClass().getName(), myRecClassLoader.getType().getName(), "Expected Recorded ClassLoader type to equal loader type"); Asserts.assertNotNull(myRecClass.getModifiers()); }
Example 6
Source File: Events.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static RecordedObject getRecordedPackage(final RecordedClass rc) { if (rc == null) { throw new RuntimeException("RecordedClass must not be null!"); } return rc.getValue("package"); }