Re: Failure creating a timer in ServerImplementation
It indeed was the reason. No GWT-Client-Code in ServerImplementation. Sounds sane ;-) On 15 Jun., 16:39, uwi_u wrote: > A. I guess it's the following: > > I included com.google.gwt.user.client.Timer instead of > java.util.Timer... could this be the reason? > > On 15 Jun., 16:25, uwi_u wrote: > > > Hi! > > > I'm writing an application which starts a new timer for each user > > logging in. > > I'm storing the timers in a HashMap for easy access. A KeepAlive from > > Client will get the timer out of the Hashmap and reset it. But when > > executing "Timer t = new Timer(){}", the method crashes. Can > > somebody tell me why? > > > Heres the Code of my ServerImplementation: > > > if (setConnection(server, DBschemeName, user, passwd) == false) return > > 0; > > else { > > connectedUsers.put(user, passwd); > > logWarn("Baue Timer"); > > Timer t = new Timer(){ > > public void run() { > > logoutUser(user); > > logWarn("User "+user+" logged out due to Timeout!"); > > } > > }; > > t.schedule(logoutTime); > > userLogoutTimers.put(user, t); > > return 1; > > > } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Failure creating a timer in ServerImplementation
A. I guess it's the following: I included com.google.gwt.user.client.Timer instead of java.util.Timer... could this be the reason? On 15 Jun., 16:25, uwi_u wrote: > Hi! > > I'm writing an application which starts a new timer for each user > logging in. > I'm storing the timers in a HashMap for easy access. A KeepAlive from > Client will get the timer out of the Hashmap and reset it. But when > executing "Timer t = new Timer(){}", the method crashes. Can > somebody tell me why? > > Heres the Code of my ServerImplementation: > > if (setConnection(server, DBschemeName, user, passwd) == false) return > 0; > else { > connectedUsers.put(user, passwd); > logWarn("Baue Timer"); > Timer t = new Timer(){ > public void run() { > logoutUser(user); > logWarn("User "+user+" logged out due to Timeout!"); > } > }; > t.schedule(logoutTime); > userLogoutTimers.put(user, t); > return 1; > > } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Failure creating a timer in ServerImplementation
Hi! I'm writing an application which starts a new timer for each user logging in. I'm storing the timers in a HashMap for easy access. A KeepAlive from Client will get the timer out of the Hashmap and reset it. But when executing "Timer t = new Timer(){}", the method crashes. Can somebody tell me why? Heres the Code of my ServerImplementation: if (setConnection(server, DBschemeName, user, passwd) == false) return 0; else { connectedUsers.put(user, passwd); logWarn("Baue Timer"); Timer t = new Timer(){ public void run() { logoutUser(user); logWarn("User "+user+" logged out due to Timeout!"); } }; t.schedule(logoutTime); userLogoutTimers.put(user, t); return 1; } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Returning values, next try. Sending was too fast for me
It's working now! Thank you very much On 9 Jun., 14:36, Stefan Bachert wrote: > Hi, > > GUIs are asynchronously. You still think synchronously. No change to > succeed synchronously. > Your GUI continue to run while your service is send. > > Remove the return int. > Put Code to continue with in onSuccess > > Stefan Bacherthttp://gwtworld.de > > On Jun 8, 3:07 pm, uwi_u wrote: > > > Hi there, > > > I'm currently writing an Application with GWT, and am Stuck at one > > position: > > > When I call my RPC, the value which is to be returned, will be passed > > to an global variable. Unfortunately, the returning of this global > > variable out of the method happens before the onSuccess comes > > back. > > > the only way to block which I see is to do a while until " > > loginFeedback < 0" > > > Heres some Code (loginFeedback shall get a value from 0 to 2): > > > public int loginUser(String user, String passwd, boolean override){ > > loginFeedback = -1; > > XGENgwt.loginUser(user, passwd, override, new AsyncCallback(){ > > public void onSuccess(Object result){ > > loginFeedback = Integer.parseInt(result.toString()); > > } > > public void onFailure (Throwable caught){ > > Window.alert("Unable to login: "+caught.toString()); > > } > > }); > > logToServer("Bei der Zuweisung: "+loginFeedback); > > return loginFeedback; > > } > > > Is there a better way? I hope so -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Returning values, next try. Sending was too fast for me
Thanks a lot, but I've got further questions ;) I'm using gwt-mvc. So, the described Method is located in the Model. What to do in the Controller exactly? After calling loginUser, my program decides which way to go by taking the feedback. So should I do the following? loginModel.loginUser(user, passwd, false, new XGENgwtModelCallback( /* Decide what to do, but how to get the "loginFeedback" */ )); Thinking Async almost drives my crazy :-( BTW: I've got other methods, which return DB2-SQL-Queries as a Vector> I guess, I should rename LoginCallback to ModelCallback and add another Method "public void onSQLQuery(Vector> vec)" as well, should I? On 9 Jun., 00:15, Chad wrote: > Oh, BTW, you would need to move your call to logToServer into the > onSuccess as well. I didn't notice that one at first. > > HTH, > Chad > > On Jun 8, 2:28 pm, Chad wrote: > > > You don't want to block the UI with a while loop. Instead, consider > > creating an interface with a single method: > > > public interface LoginCallback { > > void onLogin(int feedback); > > > } > > > Then, alter your loginUser method to return void and take as an > > addition parameter a LoginCallback: > > > public void loginUser(String user, String passwd, boolean override, > > final LoginCallback cb) { > > XGENgwt.loginUser(user, passwd, override, new AsyncCallback() { > > public void onSuccess(Object result) { > > cb.onLogin(Integer.parseInt(result.toString())); > > } > > > public void onFailure (Throwable caught) { > > Window.alert("Unable to login: "+caught.toString()); > > } > > }); > > > logToServer("Bei der Zuweisung: "+loginFeedback); > > > } > > > You could also call the onLogin from the onFailure if you wanted to. > > Or create an addition method in your LoginCallback to call from the > > onFailure. > > > Take the code that currently follows the call to your loginUser method > > and move it into the onLogin method of an instance of LoginCallback > > that gets passed to the new loginUser method. Think Async! ;-) > > > HTH, > > Chad > > > On Jun 8, 8:07 am, uwi_u wrote: > > > > Hi there, > > > > I'm currently writing an Application with GWT, and am Stuck at one > > > position: > > > > When I call my RPC, the value which is to be returned, will be passed > > > to an global variable. Unfortunately, the returning of this global > > > variable out of the method happens before the onSuccess comes > > > back. > > > > the only way to block which I see is to do a while until " > > > loginFeedback < 0" > > > > Heres some Code (loginFeedback shall get a value from 0 to 2): > > > > public int loginUser(String user, String passwd, boolean override){ > > > loginFeedback = -1; > > > XGENgwt.loginUser(user, passwd, override, new AsyncCallback(){ > > > public void onSuccess(Object result){ > > > loginFeedback = Integer.parseInt(result.toString()); > > > } > > > public void onFailure (Throwable caught){ > > > Window.alert("Unable to login: "+caught.toString()); > > > } > > > }); > > > logToServer("Bei der Zuweisung: "+loginFeedback); > > > return loginFeedback; > > > } > > > > Is there a better way? I hope so -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Returning values, next try. Sending was too fast for me
Hi there, I'm currently writing an Application with GWT, and am Stuck at one position: When I call my RPC, the value which is to be returned, will be passed to an global variable. Unfortunately, the returning of this global variable out of the method happens before the onSuccess comes back. the only way to block which I see is to do a while until " loginFeedback < 0" Heres some Code (loginFeedback shall get a value from 0 to 2): public int loginUser(String user, String passwd, boolean override){ loginFeedback = -1; XGENgwt.loginUser(user, passwd, override, new AsyncCallback(){ public void onSuccess(Object result){ loginFeedback = Integer.parseInt(result.toString()); } public void onFailure (Throwable caught){ Window.alert("Unable to login: "+caught.toString()); } }); logToServer("Bei der Zuweisung: "+loginFeedback); return loginFeedback; } Is there a better way? I hope so -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Returning values from RPC-Call
Hi there, I'm currently writing an application which fetches Data from an DB2 Database. I've got a very basic question opn returning values from RPC Here's the method, which calls the RPC: public int loginUser(String user, String passwd, boolean override){ loginFeedback = -1; XGENgwt.loginUser(user, passwd, override, new AsyncCallback(){ public void onSuccess(Object result){ loginFeedback = Integer.parseInt(result.toString()); } public void onFailure (Throwable caught){ Window.alert("Unable to login: "+caught.toString()); } }); logToServer("Bei der Zuweisung: "+loginFeedback); return loginFeedback; } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.