Fixed a case where an exception would kill the kernel

adapter thread.  Also improved the details of the error
logging.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7255 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 14 years ago
parent bfd49c43e3
commit 5225599ee2
  1. 13
      engine/src/networking/com/jme3/network/base/KernelAdapter.java

@ -93,11 +93,11 @@ public class KernelAdapter extends Thread
kernel.terminate(); kernel.terminate();
} }
protected void reportError( Exception e ) protected void reportError( Endpoint p, Object context, Exception e )
{ {
// Should really be queued up so the outer thread can // Should really be queued up so the outer thread can
// retrieve them. For now we'll just log it. FIXME // retrieve them. For now we'll just log it. FIXME
log.log( Level.SEVERE, "Unhandled error", e ); log.log( Level.SEVERE, "Unhandled error, endpoint:" + p + ", context:" + context, e );
} }
protected HostedConnection getConnection( Endpoint p ) protected HostedConnection getConnection( Endpoint p )
@ -148,7 +148,7 @@ public class KernelAdapter extends Thread
} }
messageDispatcher.messageReceived( source, m ); messageDispatcher.messageReceived( source, m );
} catch( Exception e ) { } catch( Exception e ) {
reportError(e); reportError(p, m, e);
} }
} }
@ -186,7 +186,7 @@ public class KernelAdapter extends Thread
try { try {
createAndDispatch( event ); createAndDispatch( event );
} catch( Exception e ) { } catch( Exception e ) {
reportError(e); reportError(event.getEndpoint(), event, e);
} }
} }
} }
@ -209,7 +209,12 @@ public class KernelAdapter extends Thread
// when the connection add events come through // when the connection add events come through
flushEvents(); flushEvents();
try {
createAndDispatch( e ); createAndDispatch( e );
} catch( Exception ex ) {
reportError(e.getSource(), e, ex);
}
} catch( InterruptedException ex ) { } catch( InterruptedException ex ) {
if( !go.get() ) if( !go.get() )
return; return;

Loading…
Cancel
Save