Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-7436

Stopwatch throw NPE when toString is called without having statistics

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.5.2.Final, 2.6.0.Alpha2
    • 2.5.0.Final, 2.5.1.Final, 2.6.0.Alpha1
    • core-library
    • None
    • False
    • None
    • False
    • Low

      try {
          executeStopWatch.start();
          changeEventSink.execute(records);
          executeStopWatch.stop();
          
      }
      catch (Throwable throwable) {
      
          // Capture failure
          LOGGER.error("Failed to process record: {}", throwable.getMessage(), throwable);
         
      }
      
      putStopWatch.stop();
      LOGGER.trace("[PERF] Total put execution time {}", putStopWatch.durations());
      LOGGER.trace("[PERF] Sink execute execution time {}", executeStopWatch.durations()); 

      For example, in the code above if the changeEventSink.execute(records); throws an exception the executeStopWatch.durations() will throw a NPE, since not stop method has been called. 

      Let Stopwatch to be more resilient in this case. 

            rh-ee-mvitale Mario Fiore Vitale
            rh-ee-mvitale Mario Fiore Vitale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: