Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-11 Thread Michael Hermus
Yes, the channel itself is one way from server to client, while the client to server communication is via normal HTTP requests. You seem to be stuck on the pattern of having two threads on the server side that need to interact directly with each other. I don't think that is correct. Your appl

Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-11 Thread Davide
Hi Michael, I have clicked on the link you provide and read the documentation. I have created a small project to test channel api. I can make it running. From the "main" request I can send a message to the client using the channel. The client can then respond to me. But I have seen that the re

Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-10 Thread Michael Hermus
You should click the link I provided in my first post, and read the doc. The Channel API allows you to create a persistent connection between the server and a JavaScript client, allowing you to send data back and forth. I imagine that would allow you to accomplish your goals. -- You received t

Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-10 Thread Davide
Hi Michael, many thanks for the help! Yes I think I am using the wrong way. What I need is a long running request "main" that execute some code server side. At some time the "main" request need client values. I have thinked to use a second request that take the work to fetch a client value and o

Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-10 Thread Michael Hermus
It is definitely NOT written until the end of the request. You cannot use the session object that way. Memcache would be your best alternative, but it is possible you are attempting to implement a flawed pattern. On Thursday, May 10, 2012 5:12:01 PM UTC-4, Davide wrote: > > Hi, > > is possible

Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-10 Thread Michael Hermus
I suppose you could force the use of multiple instances by setting false and using long running requests. Remember, though, the HttpSession state will not be committed to shared state (Memcache and Datastore) until *after *the HTTP request completes. You cannot use the HttpSession object to sen

Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-10 Thread Davide
Hi, is possible that session is not replicated until the end of the http request is reached? How is possible to replicate DURING the http request? I am on the wrong way? On 05/10/2012 10:07 PM, Davide wrote: Hi Michael, thanks for the reply! Is possible to test a case in which two HTTP requ

Re: [google-appengine] Re: java two request/thread that interact on the same session

2012-05-10 Thread Davide
Hi Michael, thanks for the reply! Is possible to test a case in which two HTTP requests are on different VM? I like to understand if exchanging info through the session works. Must I use synchronized when accessing the HttpSession? On 05/10/2012 03:53 PM, Michael Hermus wrote: The two HTTP r

[google-appengine] Re: java two request/thread that interact on the same session

2012-05-10 Thread Michael Hermus
The two HTTP requests are not guaranteed to execute in the same VM, regardless of session ID, so you should definitely NOT rely on thread interaction. The session object is updated in real time, and of course memcache is a great tool for sharing short lived state, as long as you can tolerate fa