From a9cdb915d2338f3650fbb9c46a5b1a667a3bf46d Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Mon, 3 Jun 2024 15:04:04 -0400 Subject: [PATCH] refactor --- .../net/CryostatFlightRecorderService.java | 21 +++++-------------- .../core/net/JmxFlightRecorderService.java | 7 ++----- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java b/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java index 86942d98..2215c296 100644 --- a/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java +++ b/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java @@ -32,30 +32,19 @@ import io.cryostat.core.EventOptionsBuilder.EventOptionException; import io.cryostat.core.EventOptionsBuilder.EventTypeException; import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; public interface CryostatFlightRecorderService extends IFlightRecorderService { - IRecordingDescriptor start( - IConstrainedMap recordingOptions, - String templateName, - TemplateType preferredTemplateType) + IRecordingDescriptor start(IConstrainedMap recordingOptions, Template eventTemplate) throws io.cryostat.core.FlightRecorderException, FlightRecorderException, - ConnectionException, IOException, FlightRecorderException, + ConnectionException, ParseException, IOException, FlightRecorderException, ServiceNotAvailableException, QuantityConversionException, EventOptionException, EventTypeException; - default IRecordingDescriptor start( - IConstrainedMap recordingOptions, Template eventTemplate) - throws io.cryostat.core.FlightRecorderException, FlightRecorderException, - ConnectionException, IOException, FlightRecorderException, - ServiceNotAvailableException, QuantityConversionException, EventOptionException, - EventTypeException { - return start(recordingOptions, eventTemplate.getName(), eventTemplate.getType()); - } - default IRecordingDescriptor start(IConstrainedMap recordingOptions, String template) - throws FlightRecorderException, ParseException, IOException { + throws io.cryostat.core.FlightRecorderException, FlightRecorderException, + ConnectionException, ParseException, IOException, ServiceNotAvailableException, + QuantityConversionException, EventOptionException, EventTypeException { XMLModel model = EventConfiguration.createModel(template); IConstrainedMap eventOptions = new EventConfiguration(model) diff --git a/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java b/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java index c4237200..1023e1b9 100644 --- a/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java +++ b/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java @@ -229,16 +229,13 @@ public IDescribedMap getDefaultEventOptions() { } @Override - public IRecordingDescriptor start( - IConstrainedMap recordingOptions, - String templateName, - TemplateType preferredTemplateType) + public IRecordingDescriptor start(IConstrainedMap recordingOptions, Template template) throws io.cryostat.core.FlightRecorderException, FlightRecorderException, ConnectionException, IOException, FlightRecorderException, ServiceNotAvailableException, QuantityConversionException, EventOptionException, EventTypeException { return tryConnect() - .start(recordingOptions, enableEvents(templateName, preferredTemplateType)); + .start(recordingOptions, enableEvents(template.getName(), template.getType())); } private IConstrainedMap enableEvents(