com.atlassian.confluence.mail.embed
Class ThreadLocalMimeBodyPartRecorder
java.lang.Object
com.atlassian.confluence.mail.embed.ThreadLocalMimeBodyPartRecorder
- All Implemented Interfaces:
- MimeBodyPartRecorder
public class ThreadLocalMimeBodyPartRecorder
- extends java.lang.Object
- implements MimeBodyPartRecorder
This implementation relies on a ThreadLocal
to keep track of embeddable images.
A single instance can be distributed amongst the application under the downside of having to track in the same thread
as the caller of record.
If the log level is set to debug, this implementation will perform a check for binary equality of
DataSources
with the same name.
- Since:
- 5.4
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThreadLocalMimeBodyPartRecorder
public ThreadLocalMimeBodyPartRecorder()
record
public <T> com.atlassian.fugue.Pair<com.atlassian.fugue.Maybe<T>,java.lang.Iterable<MimeBodyPartReference>> record(java.util.concurrent.Callable<T> callback)
throws java.lang.Exception
- Description copied from interface:
MimeBodyPartRecorder
- Activate the recorder so that it can record
MimeBodyPartRecorder.track(javax.activation.DataSource)
calls.
- Specified by:
record
in interface MimeBodyPartRecorder
- 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:
java.lang.Exception
- if the callback escapes
isRecording
public boolean isRecording()
- Specified by:
isRecording
in interface MimeBodyPartRecorder
- Returns:
- true if the current thread is being recorded.
track
public com.atlassian.fugue.Maybe<MimeBodyPartReference> track(javax.activation.DataSource source)
- Description copied from interface:
MimeBodyPartRecorder
- Track the given image source.
- Specified by:
track
in interface MimeBodyPartRecorder
- 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
Copyright © 2003-2014 Atlassian. All Rights Reserved.