Online Game Development Experience (server) (5)

Source: Internet
Author: User

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.