• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

Static variables...

 
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).]
 
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.
 
To get a wish, you need a genie. To get a genie, you need a lamp. To get a lamp, you need a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic