Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
1.1.3
-
Security Level: Public
-
None
Description
When a custom transcoder has an error, certain CAS operations fail with an error about the operation being cancelled, which is misleading and doesn't point to the transcoder as a problem.
Logs:
Mar 7, 2013 10:20:37 AM net.spy.memcached.protocol.TCPMemcachedNodeImpl setupResend
WARNING: Discarding partially completed op: Cmd: 0 Opaque: 120 Key: *****
Mar 7, 2013 10:20:40 AM net.spy.memcached.auth.AuthThread$1 receivedStatus
INFO: Authenticated to 127.0.0.1/127.0.0.1:11210
The error occurs on the get on the future. It is in fact a marshalling error in the transcoder but that never gets reported.
Code:
OperationFuture<CASValue<documentType>> future = this.client.asyncGets(key, transcoder);
return future.get(5, TimeUnit.SECONDS);
Transcoder (incorrect):
@Component
public class TranscoderImpl<T> implements Transcoder<T> {
@Autowired
@Qualifier("JSON")
Marshaller marshaler;
@Autowired
@Qualifier("JSON")
Unmarshaller unmarshaler;
@Override
public boolean asyncDecode(CachedData arg0)
@Override
public T decode(CachedData arg0) {
// TODO Auto-generated method stub
StreamSource str = new StreamSource(new java.io.ByteArrayInputStream(arg0.getData()));
Object obj;
try
catch (Exception e)
{ // TODO Auto-generated catch block throw new RuntimeException(e); }return (T)obj;
}
@Override
public CachedData encode(T arg0) {
// TODO Auto-generated method stub
ByteArrayOutputStream sink = new ByteArrayOutputStream();
try { marshaler.marshal(arg0, new StreamResult(sink)); } catch (Exception e) { // TODO Auto-generated catch block throw new RuntimeException(e); }
return new CachedData(0, sink.toByteArray(), getMaxSize());
}
@Override
public int getMaxSize()
}