roc230 / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

data loss with new connection in spymemcached #81

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
I am using this library on windows and I have the following:
------
mcClient = new MemcachedClient(KetamaConnectionFactory(),serverPoolName);
String key = "string";
int expTime = 10;
String value ="test";
Object o = value;
mcClient.set(key, expTime, o);
System.out.println("Get Object: "+ mcClient.get(key));

mcClient.shutdown();
mcClient = null;
//get the connection again 
mcClient = new MemcachedClient(KetamaConnectionFactory(),serverPoolName);

String intKey= "integer";
int expTimekey = 10;
Integer intValue =10;
Object intObj= intValue;

System.out.println("Get Object: "+ mcClient.get(intKey));
mcClient.shutdown();
mcClient = null;
------

The problem is that I cannot grab the last value that I write even though 
there are no errors in the set() method. 

The serverPoolName is not changing and neither are the connections, all 
memcached servers are alive and well (I verified it). I would expect to be 
able to read it.

I was doing some unit testing on my own project and this seemed to fail 
since the setUp() from the unit tests runs everytime a method call. 
Perhaps I am mistaken but this should not happen even when a new connection  
is opened since the pool of servers is the same and the connections all are 
alive and well working.

I would expect to read the object and have its value but it is not 
possible.

Any help?

Original issue reported on code.google.com by wuilber...@gmail.com on 30 Jul 2009 at 8:21

GoogleCodeExporter commented 9 years ago
I am sorry if I put this here but I am wondering if this could be a potential 
bug. I 
have posted it in the group a few minutes ago.

Original comment by wuilber...@gmail.com on 30 Jul 2009 at 8:58

GoogleCodeExporter commented 9 years ago

set is async operation, try this:

Future<Boolean> operation = mcClient.set(key, expTime, o);
operation.get();

Original comment by maq...@gmail.com on 9 Dec 2009 at 9:26

GoogleCodeExporter commented 9 years ago
This issue is due to confusion over synchronous and asynchronous commands.

Original comment by mikewie...@gmail.com on 13 Sep 2011 at 9:50