Network online game development experience (server side) (5)

xiaoxiao2021-03-06  37

Bromon Originally invited copyright five, threads actually do not have complex thread management, but I want to provide a console to manage the host thread, let it stop, mid-to-segment, recovery, restart, original design It is administrator to deal with thread a, through A to manage the main thread B, but friends who are familiar with Java thread know that threads are basically unrealistic, and the simplest example, how how to destroy B? Maybe you will say that the destroy () method of calling B is fine. Many of the online information on the Java thread is really saying, but they are all ghosts, go to see the Java source code, thread.destroy The actual code of the method is as follows:

Public void destroy ()

{

Throw new nosuchmethoderror ();

}

The truth is that the thread.destroy () method is not implemented from beginning to end. All people who write articles and teaches others to destroy the threads, they are going to hit the wall, and the shame is lost.

The best way is to generate a B and start it, then b management survival cycle, A and B communications by using a shared method, this is a SUN recommendation.

Next: Asynchronous message communication

转载请注明原文地址:https://www.9cbs.com/read-68891.html

New Post(0)