Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-6890

Background threads might not be automatically restarted

    XMLWordPrintableJSON

Details

    Description

      The background threads used in FileStore are implemented by wrapping Runnable instances in SafeRunnable, and by handing the SafeRunnable instances over to a ScheduledExecutorService.

      The documentation of ScheduledExecutorService#scheduleAtFixedRate states that "if any execution of the task encounters an exception, subsequent executions are suppressed". But a SafeRunnable always re-throws any Throwable that it catches, effectively preventing itself from executing again in the future.

      There is more than one solution to this problem. One of these is to never re-throw any exception. Even if it doesn't always make sense, e.g. in case of an OutOfMemoryError, never re-throwing an exception would better fulfil the assumption that background threads should always be up and running even in case of error.

      Attachments

        Activity

          People

            frm Francesco Mari
            frm Francesco Mari
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: