• 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

synchronize in struts

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I have a web application and will have users connected to it simmultaneous.

The problem is the next:

With Accept button go to Configuration Action class, and it makes a session.setattribute("configuration", config_object) for save some object into session, after it redirect to Generation Action class.

Generation Action class make a session.getattribute("configuration") for get the object saved in Configuration Action class, after it
Generation Action class make a session.setattribute("generation", generation_object), and session.setattribute("configuration", config_object_modified) after it redirect to the jsp.

In the jsp obtain the attributes with:
<jsp:useBean id="generation" scope="session" class="package.generationActionForm"></jsp:useBean>
<jsp:useBean id="configuration" scope="session" class="package.configurationActionForm"></jsp:useBean>

The problem is when two user acceded to click button I guess that the setattribute are saving like to application scope (getServlet().setattribute..) because both users the application display the same information and at the began the configuration was different. If the users acceded in different second the application run correctly.

If I synchronize the execute methods of Generation Action class and Configuration Action class the application runs correctly; but I dont want it, because if the user1 acceded to the database and his/her SQL Query runs slowly, the second user will be waiting until user1 finish.

Thanks! I hope I can help
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Each user has a separate session.

If you're testing locally and attempting to simulate two users on a single machine then you might have a problem--different browsers handle the opening of new windows differently; some create a new session with the server, some don't. The best solution is to use two different browsers for two different users.

If two users on separate *machines* are getting the same session then something is very wrong with your server.
reply
    Bookmark Topic Watch Topic
  • New Topic