Thursday, May 30, 2013

Re: instance or class?

Solved my problem and answered my question as follows:

1.  The multi-user problem I was having was unrelated to GWT or Sencha but simply a bug in my program.  So neither GWT nor Sencha has a multi-user issue that I am aware of.

2.  With respect to the class or instance question, I discovered the following.  First GWT doesn't care whether you use a single instance of a class or static methods & variables if you only need a single copy at any given time.  However, when using Java generics, you can't variable type static methods or variables.  For this reason, you should always use a single instances rather than class methods & variables.  If you use the single instance method you leave open the possibility of generalizing your code.

Thanks.

Blake



On Fri, May 10, 2013 at 9:57 AM, Blake McBride <blake1024@gmail.com> wrote:
The way I define the connecting code is as is given in the examples.  I have no thread safety code there.  Nevertheless, I am having multi-user interference issues.  Actually, I am using Sencha grid control in the place where I am having the trouble.  I thought this was a generic GWT issue.  Perhaps I am wrong.  I'll bring this up with them.

Thanks.

Blake



On Fri, May 10, 2013 at 9:37 AM, Jens <jens.nehlmeier@gmail.com> wrote:

Something I am unclear about is the code that connects the frontend to the backend.  It seems like GWT duplicates some of the intermediary code that connects the two ends.  One in Java that runs on the backend, and another copy that runs on the frontend in JavaScript.  For example, the code that defines the data structure that is transmitted between the ends must be available on both ends.  This may be where my problem is. I do have instance variables there.  Off the cuff, I'm not sure how to protect that.

Using instance variables in objects transferred with GWT-RPC is totally thread safe. I would bet its your code that is wrong and not GWT-RPC code, otherwise GWT-RPC would be pretty unusable ;-)

You dont have to fear instance variables. Immutable instance variables are thread safe by definition and access to mutable instance variables needs to be synchronized/atomic to be thread safe.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment