protected void reportError( Endpoint p, Object context, Exception e ) { // Should really be queued up so the outer thread can // retrieve them. For now we'll just log it. FIXME log.log( Level.SEVERE, "Unhandled error, endpoint:" + p + ", context:" + context, e ); if( p.isConnected() ) { // In lieu of other options, at least close the endpoint p.close(); } }
protected void closeConnection() { if( closed ) return; closed = true; // Make sure all endpoints are closed. Note: reliable // should always already be closed through all paths that I // can conceive... but it doesn't hurt to be sure. for( Endpoint p : channels ) { if( p == null || !p.isConnected() ) continue; p.close(); } fireConnectionRemoved( this ); }
protected void connectionClosed( Endpoint p ) if( p.isConnected() ) { log.log( Level.FINE, "Connection closed:{0}.", p ); } else {
public void run() { // Not guaranteed to always work but an extra datagram // to a dead connection isn't so big of a deal. if( !endpoint.isConnected() ) { return; } try { thread.getSocket().send(packet); } catch( Exception e ) { KernelException exc = new KernelException( "Error sending datagram to:" + address, e ); exc.fillInStackTrace(); reportError(exc); } } }
protected void reportError( Endpoint p, Object context, Exception e ) { // Should really be queued up so the outer thread can // retrieve them. For now we'll just log it. FIXME log.log( Level.SEVERE, "Unhandled error, endpoint:" + p + ", context:" + context, e ); if( p.isConnected() ) { // In lieu of other options, at least close the endpoint p.close(); } }
protected void closeConnection() { if( closed ) return; closed = true; // Make sure both endpoints are closed. Note: reliable // should always already be closed through all paths that I // can conceive... but it doesn't hurt to be sure. if( reliable != null && reliable.isConnected() ) { reliable.close(); } if( fast != null && fast.isConnected() ) { fast.close(); } fireConnectionRemoved( this ); }
protected void closeConnection() { if( closed ) return; closed = true; // Make sure all endpoints are closed. Note: reliable // should always already be closed through all paths that I // can conceive... but it doesn't hurt to be sure. for( Endpoint p : channels ) { if( p == null || !p.isConnected() ) continue; p.close(); } fireConnectionRemoved( this ); }
protected void connectionClosed( Endpoint p ) if( p.isConnected() ) { log.log( Level.FINE, "Connection closed:{0}.", p ); } else {
public void run() { // Not guaranteed to always work but an extra datagram // to a dead connection isn't so big of a deal. if( !endpoint.isConnected() ) { return; } try { thread.getSocket().send(packet); } catch( Exception e ) { KernelException exc = new KernelException( "Error sending datagram to:" + address, e ); exc.fillInStackTrace(); reportError(exc); } } }
public void run() { // Not guaranteed to always work but an extra datagram // to a dead connection isn't so big of a deal. if( !endpoint.isConnected() ) { return; } try { thread.getSocket().send(packet); } catch( Exception e ) { KernelException exc = new KernelException( "Error sending datagram to:" + address, e ); exc.fillInStackTrace(); reportError(exc); } } }