• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Static variables...

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic