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.