Java Code Examples for jdk.jfr.internal.Utils#checkRegisterPermission()
The following examples show how to use
jdk.jfr.internal.Utils#checkRegisterPermission() .
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: ValueDescriptor.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
ValueDescriptor(Class<?> type, String name, List<AnnotationElement> annotations, boolean allowArray) { Objects.requireNonNull(annotations); Utils.checkRegisterPermission(); if (!allowArray) { if (type.isArray()) { throw new IllegalArgumentException("Array types are not allowed"); } } this.name = Objects.requireNonNull(name, "Name of value descriptor can't be null"); this.type = Objects.requireNonNull(Utils.getValidType(Objects.requireNonNull(type), Objects.requireNonNull(name))); this.annotationConstruct = new AnnotationConstruct(annotations); this.javaFieldName = name; // Needed for dynamic events this.isArray = type.isArray(); // Assume we always want to store String and Thread in constant pool this.constantPool = type == Class.class || type == Thread.class; }
Example 2
Source File: ValueDescriptor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
ValueDescriptor(Class<?> type, String name, List<AnnotationElement> annotations, boolean allowArray) { Objects.requireNonNull(annotations); Utils.checkRegisterPermission(); if (!allowArray) { if (type.isArray()) { throw new IllegalArgumentException("Array types are not allowed"); } } this.name = Objects.requireNonNull(name, "Name of value descriptor can't be null"); this.type = Objects.requireNonNull(Utils.getValidType(Objects.requireNonNull(type), Objects.requireNonNull(name))); this.annotationConstruct = new AnnotationConstruct(annotations); this.javaFieldName = name; // Needed for dynamic events this.isArray = type.isArray(); // Assume we always want to store String and Thread in constant pool this.constantPool = type == Class.class || type == Thread.class; }
Example 3
Source File: ValueDescriptor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
ValueDescriptor(Class<?> type, String name, List<AnnotationElement> annotations, boolean allowArray) { Objects.requireNonNull(annotations); Utils.checkRegisterPermission(); if (!allowArray) { if (type.isArray()) { throw new IllegalArgumentException("Array types are not allowed"); } } this.name = Objects.requireNonNull(name, "Name of value descriptor can't be null"); this.type = Objects.requireNonNull(Utils.getValidType(Objects.requireNonNull(type), Objects.requireNonNull(name))); this.annotationConstruct = new AnnotationConstruct(annotations); this.javaFieldName = name; // Needed for dynamic events this.isArray = type.isArray(); // Assume we always want to store String and Thread in constant pool this.constantPool = type == Class.class || type == Thread.class; }
Example 4
Source File: FlightRecorder.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Removes a callback hook for a periodic event. * * @param hook the hook to remove, not {@code null} * @return {@code true} if hook is removed, {@code false} otherwise * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static boolean removePeriodicEvent(Runnable hook) throws SecurityException { Objects.requireNonNull(hook); Utils.checkRegisterPermission(); if (JVMSupport.isNotAvailable()) { return false; } return RequestEngine.removeHook(hook); }
Example 5
Source File: FlightRecorder.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Removes a hook for a periodic event. * * @param hook the hook to remove, not {@code null} * @return {@code true} if hook is removed, {@code false} otherwise * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static boolean removePeriodicEvent(Runnable hook) throws SecurityException { Objects.requireNonNull(hook); Utils.checkRegisterPermission(); if (JVMSupport.isNotAvailable()) { return false; } return RequestEngine.removeHook(hook); }
Example 6
Source File: FlightRecorder.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Removes a hook for a periodic event. * * @param hook the hook to remove, not {@code null} * @return {@code true} if hook is removed, {@code false} otherwise * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static boolean removePeriodicEvent(Runnable hook) throws SecurityException { Objects.requireNonNull(hook); Utils.checkRegisterPermission(); if (JVMSupport.isNotAvailable()) { return false; } return RequestEngine.removeHook(hook); }
Example 7
Source File: FlightRecorder.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
/** * Adds a callback for a periodic event. * <p> * The implementation of the hook should return as soon as possible, to * avoid blocking other Flight Recorder operations. The hook should emit * one or more events of the specified type. When a hook is added, the * interval at which the call is invoked is configurable using the * {@code "period"} setting. * * @param eventClass the class that the hook should run for, not {@code null} * @param hook the hook, not {@code null} * @throws IllegalArgumentException if a class is not a subclass of * {@link Event}, is abstract, or the hook is already added * @throws IllegalStateException if the event class has the * {@code Registered(false)} annotation and is not registered manually * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static void addPeriodicEvent(Class<? extends Event> eventClass, Runnable hook) throws SecurityException { Objects.requireNonNull(eventClass); Objects.requireNonNull(hook); if (JVMSupport.isNotAvailable()) { return; } Utils.ensureValidEventSubclass(eventClass); Utils.checkRegisterPermission(); AccessControlContext acc = AccessController.getContext(); RequestEngine.addHook(acc, EventType.getEventType(eventClass).getPlatformEventType(), hook); }
Example 8
Source File: FlightRecorder.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * Adds a hook for a periodic event. * <p> * The implementation of the hook should return as soon as possible, to * avoid blocking other Flight Recorder operations. The hook should emit * one or more events of the specified type. When a hook is added, the * interval at which the call is invoked is configurable using the * {@code "period"} setting. * * @param eventClass the class that the hook should run for, not {@code null} * @param hook the hook, not {@code null} * @throws IllegalArgumentException if a class is not a subclass of * {@link Event}, is abstract, or the hook is already added * @throws IllegalStateException if the event class has the * {@code Registered(false)} annotation and is not registered manually * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static void addPeriodicEvent(Class<? extends Event> eventClass, Runnable hook) throws SecurityException { Objects.requireNonNull(eventClass); Objects.requireNonNull(hook); if (JVMSupport.isNotAvailable()) { return; } Utils.ensureValidEventSubclass(eventClass); Utils.checkRegisterPermission(); AccessControlContext acc = AccessController.getContext(); RequestEngine.addHook(acc, EventType.getEventType(eventClass).getPlatformEventType(), hook); }
Example 9
Source File: FlightRecorder.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * Adds a hook for a periodic event. * <p> * The implementation of the hook should return as soon as possible, to * avoid blocking other Flight Recorder operations. The hook should emit * one or more events of the specified type. When a hook is added, the * interval at which the call is invoked is configurable using the * {@code "period"} setting. * * @param eventClass the class that the hook should run for, not {@code null} * @param hook the hook, not {@code null} * @throws IllegalArgumentException if a class is not a subclass of * {@link Event}, is abstract, or the hook is already added * @throws IllegalStateException if the event class has the * {@code Registered(false)} annotation and is not registered manually * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static void addPeriodicEvent(Class<? extends Event> eventClass, Runnable hook) throws SecurityException { Objects.requireNonNull(eventClass); Objects.requireNonNull(hook); if (JVMSupport.isNotAvailable()) { return; } Utils.ensureValidEventSubclass(eventClass); Utils.checkRegisterPermission(); AccessControlContext acc = AccessController.getContext(); RequestEngine.addHook(acc, EventType.getEventType(eventClass).getPlatformEventType(), hook); }