Wowza Community

Is recording interrupted internally when writing files?

HI,
I’m always grateful for the help from the staff at Wowza.
I’m going to stop the recorder when the file is written while recording the stream.

public class MyModuleAutoRecord extends ModuleBase implements IModuleOnApp{
    private IApplicationInstance appInstance = null;
    private IVHost vhost = null;

class MyMediaWriterActionNotify implements IMediaWriterActionNotify
{

	@Override
	public void onFLVAddMetadata(IMediaStream arg0, Map<String, Object> arg1) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onWriteComplete(IMediaStream stream, File file) {
		// TODO Auto-generated method stub
		getLogger().info("★ "+stream);
		getLogger().info("★ "+file);
        IStreamRecorder rec = appInstance.getVHost().getLiveStreamRecordManager().getRecorder(appInstance, stream.getName());
		rec.stopRecorder();
		
	}
	
}

    @Override
    public void onAppStart(IApplicationInstance appInstance) {
	    // TODO Auto-generated method stub
	    getLogger().info("ModuleMyModuleAutoRecord onAppStart");
	
 	    this.appInstance = appInstance;
 	    this.vhost = appInstance.getVHost();
 	    appInstance.addMediaWriterListener(new MyMediaWriterActionNotify());
 	    
 	    StreamRecorderParameters recordParams = null;
 	    recordParams = new StreamRecorderParameters(appInstance);
        recordParams.fileFormat = IStreamRecorderConstants.FORMAT_MP4;
        recordParams.fileTemplate = "${SourceStreamName}_${SegmentTime}";
        recordParams.segmentationType = IStreamRecorderConstants.SEGMENT_BY_DURATION;
        recordParams.segmentDuration = 10000;
        recordParams.outputPath = "D:/wowza/content/myStream1.stream/2021-04-21/";
        vhost.getLiveStreamRecordManager().startRecording(appInstance, "myStream1.stream", recordParams);

        }

        @Override
        public void onAppStop(IApplicationInstance appInstance) {
            // TODO Auto-generated method stub
        }
    }

I am creating a module to stop the recorder while saving the file in time units.
The code above specifies param to save the file in 10-second increments, and stops the recorder when the first file is written.

However, as shown in the image above, as the recorder stopped, the wowza engine outputted logs endlessly and eventually stopped.

The first file is being written, and onWriteComplete is called when the write is complete.
The stopRecorder works. This stops the recorder and completes the second file you were creating, so I understand that onWriteComplete is called again. But isn’t it weird to call onWriteComplete again because the second stopRecorder is already frozen and there are no files being written?
Is there a function that stops the recorder and destroys the instance? Or should I use a conditional statement to understand the status of the recorder and write additional code to add branches?
I need your help. Thank you.