Jdk nio SelectionKey bug, nioselectionkey

Source: Internet
Author: User

Jdk nio SelectionKey bug, nioselectionkey

This bug occurs when elasticSearch is used in this project because the nio event selector, in the feature kernel and in jdk6, contains a bug where the thread is not hold and events are obtained through endless loops, this results in high CPU usage;

This bug has been fixed on the official website: http://bugs.java.com/bugdatabase/view_bug.do? Bug_id = 6403933

 

If the version is not upgraded,

System. setProperty ("org. elasticsearch. common. netty. epollBugWorkaround", true); add this code.

Fixed solution on the official website: removed the selector and created a new one.

If (SelectionKey! = Null) {// the key you registered on the temporary selector SelectionKey. cancel (); // cancel the SelectionKey that was registered with the temporary selector // flush the canceled key temporarySelector. selectNow ();} which is safe. now everything works fine.

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.