Java Code Examples for jdk.jfr.internal.JVMSupport#ensureWithIllegalStateException()
The following examples show how to use
jdk.jfr.internal.JVMSupport#ensureWithIllegalStateException() .
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: FlightRecorder.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns the Flight Recorder for the platform. * * @return a Flight Recorder instance, not {@code null} * * @throws IllegalStateException if the platform Flight Recorder couldn't be * created (for example, if the file repository can't be created or * accessed) * * @throws SecurityException if a security manager exists and the caller does * not have {@code FlightRecorderPermission("accessFlightRecorder")} */ public static FlightRecorder getFlightRecorder() throws IllegalStateException, SecurityException { synchronized (PlatformRecorder.class) { Utils.checkAccessFlightRecorder(); JVMSupport.ensureWithIllegalStateException(); if (platformRecorder == null) { try { platformRecorder = new FlightRecorder(new PlatformRecorder()); } catch (IllegalStateException ise) { throw ise; } catch (Exception e) { throw new IllegalStateException("Can't create Flight Recorder. " + e.getMessage(), e); } // Must be in synchronized block to prevent instance leaking out // before initialization is done initialized = true; Logger.log(JFR, INFO, "Flight Recorder initialized"); Logger.log(JFR, DEBUG, "maxchunksize: " + Options.getMaxChunkSize()+ " bytes"); Logger.log(JFR, DEBUG, "memorysize: " + Options.getMemorySize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffersize: " + Options.getGlobalBufferSize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffercount: " + Options.getGlobalBufferCount()); Logger.log(JFR, DEBUG, "dumppath: " + Options.getDumpPath()); Logger.log(JFR, DEBUG, "samplethreads: " + Options.getSampleThreads()); Logger.log(JFR, DEBUG, "stackdepth: " + Options.getStackDepth()); Logger.log(JFR, DEBUG, "threadbuffersize: " + Options.getThreadBufferSize()); Logger.log(JFR, LogLevel.INFO, "Created repository " + Repository.getRepository().getRepositoryPath().toString()); PlatformRecorder.notifyRecorderInitialized(platformRecorder); } } return platformRecorder; }
Example 2
Source File: FlightRecorder.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the Flight Recorder for the platform. * * @return a Flight Recorder instance, not {@code null} * * @throws IllegalStateException if Flight Recorder can't be created (for * example, if the Java Virtual Machine (JVM) lacks Flight Recorder * support, or if the file repository can't be created or accessed) * * @throws SecurityException if a security manager exists and the caller does * not have {@code FlightRecorderPermission("accessFlightRecorder")} */ public static FlightRecorder getFlightRecorder() throws IllegalStateException, SecurityException { synchronized (PlatformRecorder.class) { Utils.checkAccessFlightRecorder(); JVMSupport.ensureWithIllegalStateException(); if (platformRecorder == null) { try { platformRecorder = new FlightRecorder(new PlatformRecorder()); } catch (IllegalStateException ise) { throw ise; } catch (Exception e) { throw new IllegalStateException("Can't create Flight Recorder. " + e.getMessage(), e); } // Must be in synchronized block to prevent instance leaking out // before initialization is done initialized = true; Logger.log(JFR, INFO, "Flight Recorder initialized"); Logger.log(JFR, DEBUG, "maxchunksize: " + Options.getMaxChunkSize()+ " bytes"); Logger.log(JFR, DEBUG, "memorysize: " + Options.getMemorySize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffersize: " + Options.getGlobalBufferSize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffercount: " + Options.getGlobalBufferCount()); Logger.log(JFR, DEBUG, "dumppath: " + Options.getDumpPath()); Logger.log(JFR, DEBUG, "samplethreads: " + Options.getSampleThreads()); Logger.log(JFR, DEBUG, "stackdepth: " + Options.getStackDepth()); Logger.log(JFR, DEBUG, "threadbuffersize: " + Options.getThreadBufferSize()); Logger.log(JFR, LogLevel.INFO, "Created repository " + Repository.getRepository().getRepositoryPath().toString()); PlatformRecorder.notifyRecorderInitialized(platformRecorder); } } return platformRecorder; }
Example 3
Source File: FlightRecorder.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Returns the Flight Recorder for the platform. * * @return a Flight Recorder instance, not {@code null} * * @throws IllegalStateException if Flight Recorder can't be created (for * example, if the Java Virtual Machine (JVM) lacks Flight Recorder * support, or if the file repository can't be created or accessed) * * @throws SecurityException if a security manager exists and the caller does * not have {@code FlightRecorderPermission("accessFlightRecorder")} */ public static FlightRecorder getFlightRecorder() throws IllegalStateException, SecurityException { synchronized (PlatformRecorder.class) { Utils.checkAccessFlightRecorder(); JVMSupport.ensureWithIllegalStateException(); if (platformRecorder == null) { try { platformRecorder = new FlightRecorder(new PlatformRecorder()); } catch (IllegalStateException ise) { throw ise; } catch (Exception e) { throw new IllegalStateException("Can't create Flight Recorder. " + e.getMessage(), e); } // Must be in synchronized block to prevent instance leaking out // before initialization is done initialized = true; Logger.log(JFR, INFO, "Flight Recorder initialized"); Logger.log(JFR, DEBUG, "maxchunksize: " + Options.getMaxChunkSize()+ " bytes"); Logger.log(JFR, DEBUG, "memorysize: " + Options.getMemorySize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffersize: " + Options.getGlobalBufferSize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffercount: " + Options.getGlobalBufferCount()); Logger.log(JFR, DEBUG, "dumppath: " + Options.getDumpPath()); Logger.log(JFR, DEBUG, "samplethreads: " + Options.getSampleThreads()); Logger.log(JFR, DEBUG, "stackdepth: " + Options.getStackDepth()); Logger.log(JFR, DEBUG, "threadbuffersize: " + Options.getThreadBufferSize()); Logger.log(JFR, LogLevel.INFO, "Created repository " + Repository.getRepository().getRepositoryPath().toString()); PlatformRecorder.notifyRecorderInitialized(platformRecorder); } } return platformRecorder; }