Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

servlet concept

Posted on 2000-02-21
3
Medium Priority
?
290 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
terajiv earned 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

636 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