Hi Probably your only possibility will be for the Game Center instance to hold the current state in memcache, so that all instances of the Game Center see the same state. Load the state on each request. Remember each running instance is single threaded.
Your main problem will be to stop multiple requests overwriting state in memcache hopefully your data structure may not mean this happens. Also I would consider a task that is constantly copying the memcache state to the datastore so that if the memcache data is lost you can recreate it from a recent copy in the datastore. T On Apr 9, 9:45 pm, g3 insight <[email protected]> wrote: > Yes, it is causing problem for our solution. > Let me explain our solution on GAE. > > It is a game center, many client users join the game and play > together. > We supposed that there is a singleton Game Center instance, and all > user is saved in user list within this Game Center instance. > Then, if UserA did one request in game, and want to ask whether UserB > accept it, then system(server side) will do one reverse ajax call to > UserB to ask his response when processing UserA's request. > Also, when there is any data update on user or game, we will also use > reverse ajax call to push those new data to each client user in > UserList which is saved in Game Center instance. > > Now, we understood the Game Center class will be initialized in each > server (JVM), so Game Center is not singleton instance on GAE. > Also we found that it is becoming difficult to do reverse ajax call > crossing users on GAE, because we can not do reverse ajax call to > client UserY who is on serverB, when system is processing request of > UserX on serverA. > > Any idea for handling this type Reverse Ajax Solution (Comet) on GAE? > > On 4月6日, 午後12:44, "Mr. Rajiv Bakulesh Shah" <[email protected]> wrote: > > > > > Hi there. > > > Are you sure that you have a problem? Remember that Google App Engine is a > > cloud, and that your app could be running on multiple independent > > individual nodes. Each node could initialize one single instance of > > yoursingleton, as expected. > > > Good luck, > > Raj > > > On Apr 5, 2010, at 9:49 AM, g3 insight wrote: > > > > We are meeting one strange thing when we do testing on GAE. > > > The problem is that we implemented a GameCenter class as below. > > > It is asingletonclass in system, but we found it always initialize > > > multiple instances based on logs. > > > Please check the source code and info log below. > > > Could you explain why it happens and how to resolve it? > > > > Source Code: > > > public class GameCenter implements IGameCenter { > > > static final long serialVersionUID = -1L; > > > private static GameCenter instance = null; > > > private long instanceNumber = -1; > > > private GameCenter() { > > > instanceNumber = System.currentTimeMillis(); > > > initRoom(); > > > hostClientProxy = new HostClientProxyImpl(); > > > chatCenter = new ChatCenter(null); > > > log.info("GameCenter constructor--- : " + instanceNumber); > > > dataVersion = 0; > > > } > > > public static synchronized GameCenter getInstance() { > > > if(instance == null){ > > > instance =new GameCenter(); > > > } > > > return instance; > > > } > > > } > > > > Info Log in GAE: > > > 04-05 07:29AM 47.910 GameCenter <init>: GameCenter constructor--- : > > > 1270477784633 > > > 04-05 07:27AM 48.654 GameCenter <init>: GameCenter constructor--- : > > > 1270477664172 > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Google App Engine" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]. > > > For more options, visit this group > > > athttp://groups.google.com/group/google-appengine?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
