aspose file tools*
The moose likes Servlets and the fly likes ask about bean instant per request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ask about bean instant per request" Watch "ask about bean instant per request" New topic
Author

ask about bean instant per request

ali mojt
Greenhorn

Joined: Jan 24, 2012
Posts: 2
Hello ,All ,
I have concern about objects name and interesting know about how it is working
Let assume I have a bean of user information AND I am creating new object (new user) from servlet
User user=new User(...)
but object name is the same for per request ,so what will happen If at the same time two object with the same name created is Data overwritten ?
And if other code start to manipulating an object, Is it separating true object
Does exist a method to avoid concurrency?
Many thanks



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

It depends where the variable is declared. If it's an instance variable, you've got a world of trouble. If it's a variable within a method, there's no concurrency issues.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ask about bean instant per request