V. threads
In fact, the system does not have complex thread management, but I want to provide a console for administrators to manage the main thread of the game and enable it to stop, center, recover, and restart, the original design was that the Administrator managed to manage main thread B by dealing with thread A and using thread A. But friends familiar with java threads know that thread management is basically impractical, for example, how does A destroy B? Maybe you will say that calling the destroy () method of B is fine. This is also true for a lot of information about java threads on the Internet, but they are all bullshit, let's take a look at the java source code, Thread. the actual code of the destroy () method is as follows:
Public void destroy ()
{
Throw new NoSuchMethodError ();
}
The truth is that the Thread. destroy () method has never been implemented from start to end. All the people who write articles and teach others to use this method to destroy threads hit the wall.
The best solution is that A is responsible for generating a B and starting it, and B manages the lifecycle by itself. A and B communicate by using A shareable method, which is recommended by sun.
Next article: Asynchronous Message Communication