Solved

servlet concept

Posted on 2000-02-21
3
261 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

776 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