Solved

Multithreading implemetation

Posted on 2013-06-22
5
213 Views
Last Modified: 2013-06-23
Hello,

I get lot of question being asked  as "where one has to use multi threading implementation environment"
i hope, it is not at the  receiving of large no of requests which would be not at   Servlet, as it will allow only single threading environment or synchronisation  

can one use  it in maintaining at the resource pooling in terms of caching environment...
Any more suggestion would be appreciated in terms of code....

thanks
0
Comment
Question by:roy_sanu
  • 3
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 39268468
Not quite sure what you're saying about servlets. They are by default multithreaded
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 39268537
Anywhere you need to replicate a task asynchronously.
0
 

Author Comment

by:roy_sanu
ID: 39268964
thanks all.
Since in multithreaded servlets, all the user shares the same instance(if I understand correctly), the instance varibles will also be shared by all the clients. This is apparently a problem. The approach is handle this is to avoid using instance variable in multithreaded servlets? How that can be achieve ???
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 39268971
How that can be achieve ???
By using automatic (local) variables

http://www.javaworld.com/javaworld/jw-07-2004/jw-0712-threadsafe.html?page=1

Or use synchronization techniques (see above link)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39269140
:)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 41
eclipse formatting 6 87
tomcat startup error 5 59
login form jsp example 2 24
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question