Hi, Inder.

I ran the following test, which indicates to me that memcache is shared 
nicely between threads.

@Test
public void testThreadedMemcacheAccess() throws InterruptedException {
final String key = "foo";
final String value = "bar";
 Thread t = new Thread(new Runnable() {
public void run() {
ApiProxy.setEnvironmentForCurrentThread(testEnvironment);
MemcacheService mc = MemcacheServiceFactory.getMemcacheService();
mc.put(key, value);
}
});
t.start();
t.join(); // Wait for thread to finish

final Map<String, String> inCache = new HashMap<String, String>(); // A 
convenience to get a value out of the following thread so that our assert 
can be in the main test thread
 t = new Thread(new Runnable() {
public void run() {
ApiProxy.setEnvironmentForCurrentThread(testEnvironment);
MemcacheService mc = MemcacheServiceFactory.getMemcacheService();
String cached = (String)mc.get(key);
inCache.put(key, cached);
}
});
t.start();
t.join(); // Wait for thread to finish
 assertEquals(value, inCache.get(key));
}

So, I suspect your problem is elsewhere.  Run this test in your environment 
to confirm it for yourself.

This scares me: << I am using Memcache as the data store>>.  You're aware 
that the memcache may be cleared at any point for many reasons?  You can't 
rely on values you put there being there the next time you look.

Good luck,
- Frank

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/DWs0Y71eFgQJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to