Solved

servlet concept

Posted on 2000-02-21
3
250 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
Comment Utility
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
Comment Utility
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
Comment Utility
Yes... Right...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 79
topping3 challenge 14 48
word0 challenge 3 56
unix in java example 9 38
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

744 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

15 Experts available now in Live!

Get 1:1 Help Now