@@ -123,21 +123,22 @@ public long startRecording(
123123 Object [] params = formOptions (recordingOptions , recordingConfiguration );
124124
125125 // jfrStart returns "Started recording 2." and some more stuff, but all we care about is the
126- // name of the recording.
126+ // id of the recording.
127+ String jfrStart ;
127128 try {
128- String jfrStart =
129- (String ) mBeanServerConnection .invoke (objectName , "jfrStart" , params , signature );
130- String name ;
129+ jfrStart = (String ) mBeanServerConnection .invoke (objectName , "jfrStart" , params , signature );
131130 Matcher matcher = JFR_START_PATTERN .matcher (jfrStart );
132131 if (matcher .find ()) {
133- name = matcher .group (1 );
134- return Long .parseLong (name );
132+ String id = matcher .group (1 );
133+ return Long .parseLong (id );
135134 }
136135 } catch (InstanceNotFoundException | ReflectionException | MBeanException e ) {
137136 throw JfrConnectionException .canonicalJfrConnectionException (getClass (), "startRecording" , e );
138137 }
139138 throw JfrConnectionException .canonicalJfrConnectionException (
140- getClass (), "startRecording" , new IllegalStateException ("Failed to parse jfrStart output" ));
139+ getClass (),
140+ "startRecording" ,
141+ new IllegalStateException ("Failed to parse: '" + jfrStart + "'" ));
141142 }
142143
143144 private static Object [] formOptions (
@@ -159,7 +160,7 @@ private static Object[] formOptions(
159160 @ Override
160161 public void stopRecording (long id ) throws JfrConnectionException {
161162 try {
162- Object [] params = mkParams ("name =" + id );
163+ Object [] params = mkParams ("recording =" + id );
163164 mBeanServerConnection .invoke (objectName , "jfrStop" , params , signature );
164165 } catch (InstanceNotFoundException | MBeanException | ReflectionException | IOException e ) {
165166 throw JfrConnectionException .canonicalJfrConnectionException (getClass (), "stopRecording" , e );
@@ -169,7 +170,7 @@ public void stopRecording(long id) throws JfrConnectionException {
169170 @ Override
170171 public void dumpRecording (long id , String outputFile ) throws IOException , JfrConnectionException {
171172 try {
172- Object [] params = mkParams ("filename=" + outputFile , "name =" + id );
173+ Object [] params = mkParams ("filename=" + outputFile , "recording =" + id );
173174 mBeanServerConnection .invoke (objectName , "jfrDump" , params , signature );
174175 } catch (InstanceNotFoundException | MBeanException | ReflectionException e ) {
175176 throw JfrConnectionException .canonicalJfrConnectionException (getClass (), "dumpRecording" , e );
0 commit comments