Forráskód Böngészése

Catch another case where shutdown state can cause a
key to be invalid before it is checked. The "bug"
was that shutdown of a network server would occasionally
log an exception about a canceled key.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10947 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

PSp..om 11 éve
szülő
commit
90913bf8c3

+ 5 - 1
engine/src/networking/com/jme3/network/kernel/tcp/SelectorKernel.java

@@ -455,11 +455,15 @@ public class SelectorKernel extends AbstractKernel
 
                 // Check for available keys and process them
                 try {
-                    select();
+                    select();                    
                 } catch( ClosedSelectorException e ) {
                     if( !go.get() )
                         return;  // it's because we're shutting down
                     throw new KernelException( "Premature selector closing", e );
+                } catch( CancelledKeyException e ) {
+                    if( !go.get() )
+                        return;  // it's because we're shutting down
+                    throw new KernelException( "Invalid key state", e );
                 } catch( IOException e ) {
                     if( !go.get() )
                         return;  // error likely due to shutting down