Interface MimeBodyPartRecorder

All Known Implementing Classes:
ThreadLocalMimeBodyPartRecorder

public interface MimeBodyPartRecorder
Records the usage of images which are meant to be embedded in a MIME email.

Any call has to be done within the closure given to . Nested #record(java.util.concurrent.Callable) should be supported in the way that they start a new, isolated recording whilst remembering the outer tracking calls.

A MimeBodyPartRecorder implementation has to be thread-safe but is not required to share its state amongst threads. That is, even if a recorder instance is shared amongst threads, a call from a different thread than the one setting up the , will not necessarily be tracked.

Since:
5.4
  • Method Details

    • startRecording

      <T> io.atlassian.fugue.Pair<Optional<T>,Iterable<MimeBodyPartReference>> startRecording(Callable<T> callback) throws Exception
      Activate the recorder so that it can record trackSource(DataSource) calls.
      Type Parameters:
      T - the return type of the callback
      Parameters:
      callback - the code eligible for recording
      Returns:
      a pair of the result of the callback and the recorded references of the embeddable images
      Throws:
      Exception - if the callback escapes
      Since:
      7.0.1
    • isRecording

      boolean isRecording()
      Returns:
      true if the current thread is being recorded.
    • trackSource

      Optional<MimeBodyPartReference> trackSource(javax.activation.DataSource source)
      Track the given image source.
      Parameters:
      source - a DataSource encapsulating the access to the image data
      Returns:
      maybe a reference to the given image, will be empty if the recorder is not recording
      Since:
      7.0.1