{
KeyValueMessage result = null;
final String key = (String) parameters[0];
final EncodingMetadata expectedEncoding = (EncodingMetadata) parameters[1];
// FIXME: use the vector clock...
IRiakObject riakObj = null;
try {
riakObj = RiakOperationFactory.this.bucket.fetch (key).execute ();
} catch (final UnresolvedConflictException e) {
FallbackExceptionTracer.defaultInstance.traceIgnoredException (e);
} catch (final RiakRetryFailedException e) {
// TODO: shutdown all connectors for this bucket?
FallbackExceptionTracer.defaultInstance.traceIgnoredException (e);
} catch (final ConversionException e) {
FallbackExceptionTracer.defaultInstance.traceIgnoredException (e);
}
if (null != riakObj) {
result = new KeyValueMessage (key, riakObj.getValue (), riakObj.getUsermeta (IOperationFactory.CONTENT_ENCODING), riakObj.getContentType ());
} else {
result = new KeyValueMessage (key, null, expectedEncoding.getContentEncoding (), expectedEncoding.getContentType ());
}
return result;
}