/** * Deserialize RecordedEvents. * @param recordingPath path where the data was saved. */ void deserializeRecordedEvents(String recordingPath) { String filepath = recordingPath + EVENT_DIR + recordAndReplayUtils.getFileCount() + JSON; recordAndReplayUtils.setFileCount(recordAndReplayUtils.getFileCount() + 1); recordedEventStore.setEvents(recordedEventSerializer.deserializeRecordedEvents(filepath)); logger.info("RecordedEvents Deserialization completed!"); }
/** * Serialize RecordedEvents. * @param recordingPath path where the data should be saved. */ public void serializeRecordedEvents(String recordingPath) { String filepath = recordingPath + EVENT_DIR + recordAndReplayUtils.getFileCount() + JSON; recordAndReplayUtils.setFileAmount(recordAndReplayUtils.getFileAmount() + 1); recordAndReplayUtils.setFileCount(recordAndReplayUtils.getFileCount() + 1); recordedEventSerializer.serializeRecordedEvents(recordedEventStore.popEvents(), filepath); logger.info("RecordedEvents Serialization completed!"); }
/** * Processes recorded events for a certain amount of time and only if the timestamp is right. */ private void processRecordedEvents() { if (recordAndReplayCurrentStatus.getStatus() == RecordAndReplayStatus.REPLAYING && !this.areRecordedEventsLoaded) { initialiseReplayData(); } //If replay is ready, process some recorded events if the time is right. if (recordAndReplayCurrentStatus.getStatus() == RecordAndReplayStatus.REPLAYING) { processRecordedEventsBatch(1); if (this.recordedEvents.isEmpty()) { if (recordAndReplayUtils.getFileCount() <= recordAndReplayUtils.getFileAmount()) { //Get next recorded events file loadNextRecordedEventFile(); } else { finishReplay(); } } } }