multithreading - java threads common questions -


I have a few questions about the Java thread:

  1. If I have a class Is the number of threads that when a thread is exited (1) from the command line to exit, does it exit the entire app including thread or other threads?

2. How can I inform one thread to all other threads which are being run from the same class to stop?

3. To use it to synchronize, to make it to be part of the code, its source in the code, can only create one thread?

4. If I run a thread in Java through Run (), then I call any method from within the run (), it is still running as a thread or it is not allowed?

If I have a class that runs multiple threads, when one thread is out (1) Command Line Exit the entire application including this thread or other threads?

Calling thread to system.ext (1) and All other threads This is the most cruel way to eliminate a Java program That is, completely shutting down JVM, and seldom should be used in all.

How can I make a thread to notify all other threads that are being run from the same class to stop?

Of course if you have references to other threads objects, then you can call thread # interrupt () But other threads can check their interrupted status or reach at a place where they can take the interrupted steps they are left.

To synchronize this part of the code, to use only one thread, regardless of its source in the code,

However, When the wait () in this block, the related lock (that is, the synchronized object) will be released and it can be obtained other threads < / P>

If I run a thread in Java using Run (), then I run () Area I call a method in what it is not is still running as a thread or permission?

When a thread calls a method, then the same thread runs this method (quietly thinking how it should be and how to ...)


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -