Solved

servlet concept

Posted on 2000-02-21
3
256 Views
Last Modified: 2013-11-24
I have asked some people and they said that JVM can only process one thread at a time, if the servlet needs to handle multiple requests simultanously or several servlet run simultanously,Thread.currentThread().yield() should be used. As I read several books, they never mention to use Thread.currentThread.yield() to handle multiple requests. On the contrast, they teach how to use synchronized word to make sure thread-safe. Then, is it greatly dependent on the servlet engine spawn threads for you?
if not, Thread.currentThread.yield() should be used in this case?
Also, JDK1.3's JVM still can only have one thread at a time?



0
Comment
Question by:Torus
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
terajiv earned 50 total points
ID: 2545012
JVM can process more than one thread at a time.
Now Comming to Servlets; here if the data is sharable/ common to all or if that change or that process is going to reflect all the clients then other clients must wait for the current thread to complete. In such case servlet will use Synchronized keyword else it will go for multi threading.
>>Thread.currentThread.yield()
This causes the currently executing thread object to temporarily pause and allow other threads to execute.
>>Then, is it greatly dependent on the servlet engine spawn threads for >>you?
yes. it depends on servlet to spawn threads.

I hope ur doubt is cleared.
0
 
LVL 2

Author Comment

by:Torus
ID: 2545279
oh! how come!? I have deleted the question. Don't know why it still exists.
Actually, my question is wrong. If only one thread could run in JVM at a time, I think Java had no multi-threading concept. So the sentences I got is totally wrong. That why I deleted the question.

What I want to ask is a process. As I know, netscape VM and Microsoft VM only allows one process at a time
Java VM can run multiple processes at a time, right?

0
 
LVL 3

Expert Comment

by:terajiv
ID: 2548939
Yes... Right...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

861 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now