Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session in servers

 
jacob deiter
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JEE application(contain many java objects) deployed in server.If several users access the application then server create session for each user, then all objects exist in the application available in each session. I explain as follow

For an example,

Functionallity-1
To display a value from database, application needs 4 java objects to display the value at browser. All objects are not singleton.

If 10 user access the application for the same functionality then server do follow the below listed sequence

1)create 10 sessions
2)every session has the new instance of 4 java objects
3)In session -1,if a user change the property of an object it never reflect in the property of the same object in session-2

Or

1) Create 10 sessions
2) Server creates 10 threads of 4 objects and assign each thread to each session.
3) In session -1,if a user change the property of an object it never reflect in the property of the same object in session-2
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jacob,

Is this a question from a mock exam? In that case you need to QuoteYourSources.

In answer to your question my understanding is that it is the first case.

Hope that helps!
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the question is very vague.
It totally depends on your application.
If for each server request you create a new instance(via the new operator), you will get different objects for each thread.
On the other hand, if there is a class that creates objects for you (like a factory) and it caches instances, then it may be so that two sessions share the same instance.

The application server will not do any magic for you. It will just invoke your request in a thread and rest is upto you to manage.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic