Result result = Result.SUCCESS;
try {
// Create new instance of transcoder in synchronized block, since
// the TranscoderFactory is not guaranteed to be thread-safe.
Transcoder transcoder;
synchronized (mutex) {
transcoder = transcoderFactory.createTranscoder(); }
// Perform transcoding on local instance of transcoder,
// thus in thread-safe way.
transcoder.transcode(descriptor, request, response);
} catch (TranscoderFactoryException e) {
// thrown when the TranscoderFactory instantiation fails.
LOGGER.error(e);
result = Result.UNSUPPORTED;