permaculture playing cards*
The moose likes Threads and Synchronization and the fly likes session in servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "session in servers" Watch "session in servers" New topic
Author

session in servers

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
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

Joined: Jun 24, 2003
Posts: 3274
    
    5

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!


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

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.


apigee, a better way to API!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: session in servers
 
Similar Threads
Chapter 6(Session Management) notes (HFSJ) for revision
thread is logically equal to a context
000-341 sample test questions
long post IBM.158
PreAssessment Questions and Answers