First of all, you should be aware that the application engine can replicate your application on multiple servers. This means that your static variables will be unique on only one server. Thus, your DataCoordinator will coordinate only access to data on one server. Therefore, if you need common data for all the servers on which your application is running, you should always use the data store for this (or in some cases the gae HTTP session mechanism).
Regarding thread safety DataCoordinator : you only need to synchronize the methods of this coordinator, if these methods are not implemented by a safe thread. For example, you do not need to synchronize any methods that do not have access to any instances / static data, but simply retrieve data from the data warehouse. If access methods to shared instances / static data that change (are also recorded at the same time), you can synchronize on a special monitor to access the data in most cases instead of synchronization on the entire coordinator.
Regarding your ThreadLocal used to store the authentication token: you can do it (I do this, for example, to authenticate the user in gae for GWT factory requests), and yes, each thread will have its own variable value for how long you set it for this flow. This means that it is better to make sure that the variable is set for each thread, and we recommend using try - finally -block after setting it, which ultimately deletes the authentication data after use. What for? Worse, it could otherwise have happened that the thread belonging to the request of user B still has the authentication token of user A. This is because the threads used on the application server are usually combined between requests and not cleared and recreated.
I can not say anything about memcache since I did not use it.
As a rule, you should know that any web requests (servlet / JSP / ...) can be processed simultaneously by the server. Thus, any modified shared resources that these threads access must be synchronized or implemented in thread safe mode.
Perhaps http://download.oracle.com/javase/tutorial/essential/concurrency/ is a good starting point to read.
source share