< prev index next >

application/org.openjdk.jmc.rjmx.services.jfr/src/main/java/org/openjdk/jmc/rjmx/services/jfr/internal/FlightRecorderServiceV2.java

Print this page

        

*** 91,100 **** --- 91,101 ---- private Map<EventTypeIDV2, EventTypeMetadataV2> eventTypeInfoById; private Map<org.openjdk.jmc.flightrecorder.configuration.events.EventOptionID, OptionInfo<?>> optionInfoById; private final ICommercialFeaturesService cfs; private final IMBeanHelperService mbhs; private final String serverId; + private final IConnectionHandle connection; @Override public String getVersion() { return "2.0"; //$NON-NLS-1$ }
*** 102,116 **** private boolean isDynamicFlightRecorderSupported(IConnectionHandle handle) { return ConnectionToolkit.isHotSpot(handle) && ConnectionToolkit.isJavaVersionAboveOrEqual(handle, JavaVersionSupport.DYNAMIC_JFR_SUPPORTED); } private boolean isFlightRecorderDisabled(IConnectionHandle handle) { ! if (cfs != null) { return !cfs.isCommercialFeaturesEnabled() || JVMSupportToolkit.isFlightRecorderDisabled(handle, false); } else { ! return true; } } public static boolean isAvailable(IConnectionHandle handle) { return FlightRecorderCommunicationHelperV2.isAvailable(handle); --- 103,122 ---- private boolean isDynamicFlightRecorderSupported(IConnectionHandle handle) { return ConnectionToolkit.isHotSpot(handle) && ConnectionToolkit.isJavaVersionAboveOrEqual(handle, JavaVersionSupport.DYNAMIC_JFR_SUPPORTED); } + private boolean isFlightRecorderCommercial() { + return ConnectionToolkit.isHotSpot(connection) + && !ConnectionToolkit.isJavaVersionAboveOrEqual(connection, JavaVersionSupport.JFR_NOT_COMMERCIAL); + } + private boolean isFlightRecorderDisabled(IConnectionHandle handle) { ! if (cfs != null && isFlightRecorderCommercial()) { return !cfs.isCommercialFeaturesEnabled() || JVMSupportToolkit.isFlightRecorderDisabled(handle, false); } else { ! return JVMSupportToolkit.isFlightRecorderDisabled(handle, false); } } public static boolean isAvailable(IConnectionHandle handle) { return FlightRecorderCommunicationHelperV2.isAvailable(handle);
*** 122,131 **** --- 128,138 ---- throw new ServiceNotAvailableException(""); //$NON-NLS-1$ } if (JVMSupportToolkit.isFlightRecorderDisabled(handle, true)) { throw new ServiceNotAvailableException(""); //$NON-NLS-1$ } + connection = handle; helper = new FlightRecorderCommunicationHelperV2(handle.getServiceOrThrow(MBeanServerConnection.class)); mbhs = handle.getServiceOrThrow(IMBeanHelperService.class); serverId = handle.getServerDescriptor().getGUID(); }
*** 468,478 **** return openStream(descriptor, startDate, endDate, removeOnClose); } @Override public boolean isEnabled() { ! return cfs.isCommercialFeaturesEnabled(); } @Override public void enable() throws FlightRecorderException { try { --- 475,487 ---- return openStream(descriptor, startDate, endDate, removeOnClose); } @Override public boolean isEnabled() { ! return isFlightRecorderCommercial() ! ? cfs.isCommercialFeaturesEnabled() ! : isAvailable(connection); } @Override public void enable() throws FlightRecorderException { try {
< prev index next >