I mean this : getThreadLocalRequest().getSession().getId() gives me the same id for two different clients that are opened. Someone told me that maybe two browsers share a cookie cache/address space and because of that they see the same cookie. I googled this theme about two weeks but i did not find out how to separate them . So maybe this affects in some way the story with requests, maybe there is only one thread openes for two clients.
On Apr 26, 11:07 pm, Vitali Lovich <[email protected]> wrote: > On Sun, Apr 26, 2009 at 3:29 PM, [email protected] > <[email protected]>wrote: > > > > > > Are you sure you're not doing a notify? Maybe you actually receive an > > > event? InterruptedException (from memory, haven't looked at the javadoc) > > > get's called when wait times out - if you call notify, it'll wake up the > > > thread normally. > > > That's exactly what i do there, notifying. > > Forgive my newbieness, i thought notify should cause > > InterruptedException )))))))) > > Minus one problem. > > > But i still can't understand what is going on with Hosted Mode. > > There is something else, new session does not open for new client. > > Maybe it is something local on my comp, maybe there is something > > to configure ? > > What do you mean by new session (I hate this term in general because so many > things have sessions that the term loses all meaning). Is there some > specific session id you are referring to? Threads? > > > > > On Apr 24, 6:55 am, Vitali Lovich <[email protected]> wrote: > > > On Thu, Apr 23, 2009 at 2:05 PM, [email protected] > > > <[email protected]>wrote: > > > > > I tested both FF and IE6 . I'm pretty surprised too of the results, so > > > > I'm still searching the problem. > > > > > >Are you calling getEvents (the one > > > > > that sends of the request to the server) on the client-side more than > > > > once? > > > > > No, i checked it after you said that two requests is the maximum. > > > > I call the getEvents only once, after logging in. > > > > There is also something weird happens when it runs in browser . > > > > In the getEvents on server side in this part > > > > I can't imagine a case where the server side behavior will change if you > > use > > > hosted mode or a browser. I mean hosted mode runs in the same VM, but > > it's > > > a different thread. > > > > try > > > > > { > > > > synchronized( user ) > > > > { > > > > user.wait( 20*1000 ); > > > > } > > > > } > > > > > catch ( InterruptedException ignored ) > > > > { > > > > System.out.println("Server interupted, sending response"); > > > > > } > > > > > when interrupted the message is not printed. It does not enter the > > > > catch clause at all. > > > > Are you sure you're not doing a notify? Maybe you actually receive an > > > event? InterruptedException (from memory, haven't looked at the javadoc) > > > get's called when wait times out - if you call notify, it'll wake up the > > > thread normally. Or is the other way around? In any case, put the print > > > after your catch - that's where it belongs. > > > > But definitely, instrument getEvents something like this on the server > > side: > > > > System.out.println(user + " waiting for events"); > > > > try { > > > // code for getEvents} finally { > > > > System.out.println(user + " responding to client"); > > > > } > > > > That'll help you figure out what your server is doing. > > > > Also, you can usehttp:// > > code.google.com/p/google-web-toolkit/wiki/LightweightMetricsDe...to > > > inject profiling of your RPC calls to figure out what your browser is > > > actually doing (in case you miss something). > > > > > I've added some print after wait in the try > > > > clause, and when the server interrupted the message in the try clause > > > > printed. > > > > Is it magic or something ????? ))))))))))) > > > > > On Apr 23, 12:01 pm, Vitali Lovich <[email protected]> wrote: > > > > > Seriously doubt it's a hosted mode mode issue. Which browser did you > > > > test > > > > > web-mode with? Hosted mode actually launches a version of IE6, so > > using > > > > FF > > > > > or IE7 may present different issues (for instance they might have a > > > > raised > > > > > AJAX connection limit) > > > > > > The issue is purely on the client side. Are you calling getEvents > > (the > > > > one > > > > > that sends of the request to the server) on the client-side more than > > > > once? > > > > > > On Thu, Apr 23, 2009 at 4:44 AM, [email protected] > > > > > <[email protected]>wrote: > > > > > > > Well, it really looks like a bug, cause when i > > > > > > compile it to browser it works properly ( meanwhile )))) ). > > > > > > Thanks for your answers. > > > > > > > On Apr 23, 10:05 am, Salvador Diaz <[email protected]> > > wrote: > > > > > > > As Vitali said, there are some common pitfalls when trying to > > > > > > > implement something along the lines of whatyou're trying to do. > > > > > > > There have been plenty of discussions related to chat > > implementations > > > > > > > and server-push. You might want to look at this docs: > > >http://docs.codehaus.org/display/JETTY/GWT+RPC+Exampleshttp://code.go.. > > > > .. > > > > > > .. > > > > > > > And also comment on this bug if you have any problems or even if > > you > > > > > > > succeed: > > > >http://code.google.com/p/google-web-toolkit/issues/detail?id=267 > > > > > > > > Hope it helps, > > > > > > > > Salvador > > > > > > > > On Apr 23, 9:40 am, "[email protected]" <[email protected] > > > > > > > > wrote: > > > > > > > > > I open two clients, and trying to send a message from one to > > > > another. > > > > > > > > So i have two requests hanging on server's side, and the third > > one > > > > > > > > trying to send the message. > > > > > > > > the server side is like this : > > > > > > > > > @Override > > > > > > > > public ArrayList<Event> getEvents( Integer sessionId ) > > > > > > > > { > > > > > > > > UserInfo user = getUserById( sessionId );; > > > > > > > > ArrayList< Event > events = null ; > > > > > > > > > if( user != null ) > > > > > > > > { > > > > > > > > if( user.events.size() == 0 ) > > > > > > > > { > > > > > > > > try > > > > > > > > { > > > > > > > > synchronized( user ) > > > > > > > > { > > > > > > > > user.wait( > > 20*1000 > > > > ); > > > > > > > > } > > > > > > > > } > > > > > > > > catch ( InterruptedException > > > > ignored ) > > > > > > {} > > > > > > > > } > > > > > > > > synchronized( user ) > > > > > > > > { > > > > > > > > events = user.events; > > > > > > > > user.events = = new > > > > ArrayList<Event>(); > > > > > > ; > > > > > > > > } > > > > > > > > } > > > > > > > > return events; > > > > > > > > } > > > > > > > > > And the sendEvent() on the server side is like this : > > > > > > > > > @Override > > > > > > > > public void sendEvent( Integer senderId, Integer > > > > recieverId, > > > > > > String > > > > > > > > message ) > > > > > > > > { > > > > > > > > System.out.println( senderId + "entered the > > > > sendMessage > > > > > > > > method" ); > > > > > > > > > UserInfo reciever = getUserById( recieverId ); > > > > > > > > MessageEvent me = new MessageEvent( senderId , > > > > message > > > > > > ); > > > > > > > > > if( reciever != null ) > > > > > > > > { > > > > > > > > synchronized( reciever ) > > > > > > > > { > > > > > > > > reciever.events.add( me ); > > > > > > > > reciever.notifyAll(); > > > > > > > > } > > > > > > > > } > > > > > > > > } > > > > > > > > So I have two clients opened in hosted mode. For debugging > > > > > > > > i put System.out.println( senderId + "entered the sendEvent > > method" > > > > ); > > > > > > > > command at the enter > > > > > > > > to sendEvent() method. And the message "senderId entered the > > > > sendEvent > > > > > > > > method" appeared, only when > > > > > > > > one of the clients exited the getEvents(). So maybe the problem > > is > > > > > > > > that both clients are opened at the same > > > > > > > > computer, or maybe it's because of hosted mode ? > > > > > > > > > On Apr 22, 11:56 pm, Vitali Lovich <[email protected]> wrote: > > > > > > > > > > Most browsers only support 2 outstanding AJAX events - that > > may > > > > be > > > > > > what you > > > > > > > > > are running into. Without knowing what other calls you make, > > I > > > > > > cannot make > > > > > > > > > a recommendation. > > > > > > > > > > One thing that does come to mind is that I hope you only call > > > > > > getEvents once > > > > > > > > > on startup. > > > > > > > > > > On Wed, Apr 22, 2009 at 4:47 PM, [email protected] > > > > > > > > > <[email protected]>wrote: > > > > > > > > > > > Hi. > > > > > > > > > > I'm trying to implement chat on my GWT app. So client has > > > > > > getEvents() > > > > > > > > > > function implemented like this : > > > > > > > > > > > public void getEvents( ) > > > > > > > > > > { > > > > > > > > > > networkSvc.getEvents( > > > > > > > > > > new AsyncCallback< ArrayList<Event> > > >() > > > > > > > > > > { > > > > > > > > > > public void onSuccess( > > > > ArrayList< > > > > > > Event > > > > > > > > > > > events ) > > > > > > > > > > { > > > > > > > > > > handleEvents( events > > ); > > > networkSvc.getEvents( > > > > this > > > > > > ); > > > > > > > > > > } > > > > > > > > > > public void onFailure( > > Throwable > > > > > > caught ) > > > > > > > > > > { > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
