nfhu / xmemcached

Automatically exported from code.google.com/p/xmemcached
Apache License 2.0
0 stars 0 forks source link

Null GetsResponse is thrown by cas operation #137

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
my code looks like

client.cas( "key", new CASOperation<byte[]>() {
  @Override
  public int getMaxTries() {
     return Integer.MAX_VALUE;
  }

  @Override
  public byte[] getNewValue(long currentCAS, byte[] currentValue) {
    return ...;
  }
});

and this is thrown 

net.rubyeye.xmemcached.exception.MemcachedException: Null GetsResponse
    at net.rubyeye.xmemcached.XMemcachedClient.cas0(XMemcachedClient.java:1639)
    at net.rubyeye.xmemcached.XMemcachedClient.cas(XMemcachedClient.java:1674)
    at net.rubyeye.xmemcached.XMemcachedClient.cas(XMemcachedClient.java:1767)
    at aaa.util.OptimisticUpdateModification.execute(OptimisticUpdateModification.java:33)
    at aa.util.CacheWriter.run(CacheWriter.java:36)
    at java.lang.Thread.run(Thread.java:619)

I looked in the code and found AbstractNioSession line 235

@Override
public void writeFromUserCode(WriteMessage message) {
  if (schduleWriteMessage(message)) {
    return;
  }
  onWrite(null);
}

the message will be scheduled because it is not the reactor thread and there is 
no wait for execution and so the response ist null.

It sounds like a pretty bug for me :-)

Original issue reported on code.google.com by andre.ku...@googlemail.com on 10 Jul 2011 at 12:52

GoogleCodeExporter commented 9 years ago
Upps,

I found me misstake. The values I want to update does not exists in the cache. 
I think it will be an pretty feature if the values will be created in the cache 
by calling the CasOperation with null parameter.

Original comment by andre.ku...@googlemail.com on 10 Jul 2011 at 1:05

GoogleCodeExporter commented 9 years ago
All right,i closed this issue now.

Original comment by killme2...@gmail.com on 14 Jul 2011 at 2:23