There is a troublesome problem in the multi-threaded crawl of WebMagic: When the scheduler can't get the URL, you can't quit immediately, you need to wait until the thread that has not been scratched is finished, and no new URL is generated to exit.
Thinking logic of computer programs (68) and thinking 68
This section continues with the content of the previous section and discusses how to use wait/notify to implement more collaboration scenarios.
Start at the same time
At the same time, it is
Package cn.itcast.thread;/*Thread communication: When a thread completes its current task, it notifies the other B thread to do something else.Producers and consumers.Problem one: The problem of price disorder. (Thread safety issues)Question: Now
1. Study summary 1.1 This week summarize multithreading related content in the way you like (mind map or other).2. Written work this time PTA job title set multi-thread 1. Mutually exclusive access and synchronous access complete the set of 4-4
Java Concurrency Programming-----thread Basic conceptsThread state diagramDescription :The thread altogether consists of the following 5 states.1. new state : When the thread object is created, it enters the new state. For example, thread thread =
When a thread is running inside the system, the program usually does not control the rotation of the thread accurately, but there are mechanisms to ensure that the thread is running in a coordinated way.Reconciling threads by the synchronization
ProcessA running instance of a computer program that contains the instructions that need to be executed:Has its own independent space, contains the program content and the data;The address space of different processes is isolated from each other;The
1. Thread SynchronizationMultithreaded programming is an interesting thing, he can easily suddenly appear "error Situation", which is caused by the system's thread scheduling has a certain randomness, but even if the program occasional problems, it
Threads ThreadThere are two ways of implementing Multithreading:1, inherit the thread class (nature is also an example of implementing the Runnable interface)Thread class source code Public class Thread implements Runnable {}Define a threadPublic
In the interview headlines, there is a very interesting topic, the use of two threads alternately print a string, here is mainly for multi-threaded wait/notify application, hereby recorded.For the understanding of Wait () and notify (), or to start
In this chapter, the thread wait/wake method is introduced. The topics involved include:1. Wait (), notify (), Notifyall () and other methods introduced2. Wait () and notify ()3. Wait (long Timeout) and notify ()4. Wait () and Notifyall ()5. Why
The state of the threadThread state diagram:
DescriptionA thread consists of the following 5 states altogether. 1. New State: After the thread object is created, it enters the new state. For example, thread thread = new Thread (). 2. Ready status
One. Java Thread Synchronization principle
Java assigns a monitor to each object object, and when a synchronization method (synchronized methods) is invoked by multiple threads, the object's monitor will handle the concurrent exclusive requirements
Reference:How to communicate between threads in Java multi-threadJava thread and thread, process and interprocess communicationThe above two blogs were sorted out, and the experiment code was run under JDK8 to test.
How to communicate between
1. Thread and Process Concepts1.1. Process: Has a separate memory space, each independently executed program is called a process1.2. Thread: A thread is an execution path inside a program, and a Java Virtual machine allows an application to run
Java programming specifications, java programming
Note:
The code automatically generated by the development tool can be inconsistent.
Note:
For (...)
{
... // Your code
}
Note:
If (filename! = Null
& New File (logPath + filename). length ()
20145326 "Java Program Design" The 6th Week study summary textbook Learning content Summary
Tenth Chapter
First, the use of InputStream and OutputStream
1. Concept of stream design
To use the input/output API, it is important to understand
Java multithreading-thread communication, java multithreading thread
The goal of thread communication is to enable threads to send signals to each other. On the other hand, thread communication enables threads to wait for signals from other
Developing high-performance concurrent applications is not an easy task. Examples of such applications include high-performance Web servers, game servers, and search engine crawlers. Such an application might require processing thousands of requests
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.