26
27 import java.util.Map;
28 import java.util.concurrent.ConcurrentHashMap;
29
30 import jdk.jfr.events.DeserializationEvent;
31 import jdk.jfr.events.ErrorThrownEvent;
32 import jdk.jfr.events.ExceptionStatisticsEvent;
33 import jdk.jfr.events.ExceptionThrownEvent;
34 import jdk.jfr.events.FileForceEvent;
35 import jdk.jfr.events.FileReadEvent;
36 import jdk.jfr.events.FileWriteEvent;
37 import jdk.jfr.events.ProcessStartEvent;
38 import jdk.jfr.events.SecurityPropertyModificationEvent;
39 import jdk.jfr.events.SecurityProviderServiceEvent;
40 import jdk.jfr.events.SerializationMisdeclarationEvent;
41 import jdk.jfr.events.SocketReadEvent;
42 import jdk.jfr.events.SocketWriteEvent;
43 import jdk.jfr.events.TLSHandshakeEvent;
44 import jdk.jfr.events.ThreadSleepEvent;
45 import jdk.jfr.events.VirtualThreadEndEvent;
46 import jdk.jfr.events.VirtualThreadPinnedEvent;
47 import jdk.jfr.events.VirtualThreadStartEvent;
48 import jdk.jfr.events.VirtualThreadSubmitFailedEvent;
49 import jdk.jfr.events.X509CertificateEvent;
50 import jdk.jfr.events.X509ValidationEvent;
51 import jdk.jfr.internal.util.Utils;
52
53 /**
54 * This class registers all mirror events.
55 */
56 final class MirrorEvents {
57 private static final Map<String, Class<? extends MirrorEvent>> mirrorLookup = new ConcurrentHashMap<>();
58
59 // Add mirror event mapping here. See MirrorEvent class for details.
60 static {
61 register("jdk.internal.event.DeserializationEvent", DeserializationEvent.class);
62 register("jdk.internal.event.FileForceEvent", FileForceEvent.class);
63 register("jdk.internal.event.FileReadEvent", FileReadEvent.class);
64 register("jdk.internal.event.FileWriteEvent", FileWriteEvent.class);
65 register("jdk.internal.event.ProcessStartEvent", ProcessStartEvent.class);
66 register("jdk.internal.event.SecurityPropertyModificationEvent", SecurityPropertyModificationEvent.class);
67 register("jdk.internal.event.SecurityProviderServiceEvent", SecurityProviderServiceEvent.class);
68 register("jdk.internal.event.SerializationMisdeclarationEvent", SerializationMisdeclarationEvent.class);
69 register("jdk.internal.event.SocketReadEvent", SocketReadEvent.class);
70 register("jdk.internal.event.SocketWriteEvent", SocketWriteEvent.class);
71 register("jdk.internal.event.ThreadSleepEvent", ThreadSleepEvent.class);
72 register("jdk.internal.event.TLSHandshakeEvent", TLSHandshakeEvent.class);
73 register("jdk.internal.event.VirtualThreadStartEvent", VirtualThreadStartEvent.class);
74 register("jdk.internal.event.VirtualThreadEndEvent", VirtualThreadEndEvent.class);
75 register("jdk.internal.event.VirtualThreadPinnedEvent", VirtualThreadPinnedEvent.class);
76 register("jdk.internal.event.VirtualThreadSubmitFailedEvent", VirtualThreadSubmitFailedEvent.class);
77 register("jdk.internal.event.X509CertificateEvent", X509CertificateEvent.class);
78 register("jdk.internal.event.X509ValidationEvent", X509ValidationEvent.class);
79 register("jdk.internal.event.ErrorThrownEvent", ErrorThrownEvent.class);
80 register("jdk.internal.event.ExceptionStatisticsEvent", ExceptionStatisticsEvent.class);
81 register("jdk.internal.event.ExceptionThrownEvent", ExceptionThrownEvent.class);
82 };
83
84 private static void register(String eventClassName, Class<? extends MirrorEvent> mirrorClass) {
85 mirrorLookup.put(eventClassName, mirrorClass);
86 }
87
88 static Class<? extends MirrorEvent> find(Class<? extends jdk.internal.event.Event> eventClass) {
89 return find(Utils.isJDKClass(eventClass), eventClass.getName());
90 }
91
92 static Class<? extends MirrorEvent> find(boolean bootClassLoader, String name) {
93 if (bootClassLoader) {
94 return mirrorLookup.get(name);
95 }
|
26
27 import java.util.Map;
28 import java.util.concurrent.ConcurrentHashMap;
29
30 import jdk.jfr.events.DeserializationEvent;
31 import jdk.jfr.events.ErrorThrownEvent;
32 import jdk.jfr.events.ExceptionStatisticsEvent;
33 import jdk.jfr.events.ExceptionThrownEvent;
34 import jdk.jfr.events.FileForceEvent;
35 import jdk.jfr.events.FileReadEvent;
36 import jdk.jfr.events.FileWriteEvent;
37 import jdk.jfr.events.ProcessStartEvent;
38 import jdk.jfr.events.SecurityPropertyModificationEvent;
39 import jdk.jfr.events.SecurityProviderServiceEvent;
40 import jdk.jfr.events.SerializationMisdeclarationEvent;
41 import jdk.jfr.events.SocketReadEvent;
42 import jdk.jfr.events.SocketWriteEvent;
43 import jdk.jfr.events.TLSHandshakeEvent;
44 import jdk.jfr.events.ThreadSleepEvent;
45 import jdk.jfr.events.VirtualThreadEndEvent;
46 import jdk.jfr.events.VirtualThreadStartEvent;
47 import jdk.jfr.events.VirtualThreadSubmitFailedEvent;
48 import jdk.jfr.events.X509CertificateEvent;
49 import jdk.jfr.events.X509ValidationEvent;
50 import jdk.jfr.internal.util.Utils;
51
52 /**
53 * This class registers all mirror events.
54 */
55 final class MirrorEvents {
56 private static final Map<String, Class<? extends MirrorEvent>> mirrorLookup = new ConcurrentHashMap<>();
57
58 // Add mirror event mapping here. See MirrorEvent class for details.
59 static {
60 register("jdk.internal.event.DeserializationEvent", DeserializationEvent.class);
61 register("jdk.internal.event.FileForceEvent", FileForceEvent.class);
62 register("jdk.internal.event.FileReadEvent", FileReadEvent.class);
63 register("jdk.internal.event.FileWriteEvent", FileWriteEvent.class);
64 register("jdk.internal.event.ProcessStartEvent", ProcessStartEvent.class);
65 register("jdk.internal.event.SecurityPropertyModificationEvent", SecurityPropertyModificationEvent.class);
66 register("jdk.internal.event.SecurityProviderServiceEvent", SecurityProviderServiceEvent.class);
67 register("jdk.internal.event.SerializationMisdeclarationEvent", SerializationMisdeclarationEvent.class);
68 register("jdk.internal.event.SocketReadEvent", SocketReadEvent.class);
69 register("jdk.internal.event.SocketWriteEvent", SocketWriteEvent.class);
70 register("jdk.internal.event.ThreadSleepEvent", ThreadSleepEvent.class);
71 register("jdk.internal.event.TLSHandshakeEvent", TLSHandshakeEvent.class);
72 register("jdk.internal.event.VirtualThreadStartEvent", VirtualThreadStartEvent.class);
73 register("jdk.internal.event.VirtualThreadEndEvent", VirtualThreadEndEvent.class);
74 register("jdk.internal.event.VirtualThreadSubmitFailedEvent", VirtualThreadSubmitFailedEvent.class);
75 register("jdk.internal.event.X509CertificateEvent", X509CertificateEvent.class);
76 register("jdk.internal.event.X509ValidationEvent", X509ValidationEvent.class);
77 register("jdk.internal.event.ErrorThrownEvent", ErrorThrownEvent.class);
78 register("jdk.internal.event.ExceptionStatisticsEvent", ExceptionStatisticsEvent.class);
79 register("jdk.internal.event.ExceptionThrownEvent", ExceptionThrownEvent.class);
80 };
81
82 private static void register(String eventClassName, Class<? extends MirrorEvent> mirrorClass) {
83 mirrorLookup.put(eventClassName, mirrorClass);
84 }
85
86 static Class<? extends MirrorEvent> find(Class<? extends jdk.internal.event.Event> eventClass) {
87 return find(Utils.isJDKClass(eventClass), eventClass.getName());
88 }
89
90 static Class<? extends MirrorEvent> find(boolean bootClassLoader, String name) {
91 if (bootClassLoader) {
92 return mirrorLookup.get(name);
93 }
|