• Post Reply Bookmark Topic Watch Topic
  • New Topic

Static variables...

 
Tom Diamond
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I've made a couple of JSPs which use some classes as beans. Everything in those beans is static. I thought that if there is only one object in the universe I might resque some memory... But I wonder, what will happen if two client-users try to modify the same object? For example I have an object that adds messages to a list by giving them a unique id. What if two clients try to add a message at the same time? Is Tomcat (my server) smart enough to wait until the first adding is complete before procceeding to the other?
Tom.
[This message has been edited by Tom Diamond (edited September 27, 2001).]
 
ashish sharma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as static fields are concerned ,the major effect will be that once one client changes the value of field others will get the updated value bcose static fields are class fields and shared by all objects.And if u want to make them threadsafe use finegrained synchronization or coarse grained synchronization which ever applicable.But in net applications synchronization is performance bottleneck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!