public void run() { log.log( Level.FINE, "Kernel started for connection:{0}.", address ); // An atomic is safest and costs almost nothing while( go.get() ) { try { // Could reuse the packet but I don't see the // point and it may lead to subtle bugs if not properly // reset. DatagramPacket packet = new DatagramPacket( buffer, buffer.length ); socket.receive(packet); newData( packet ); } catch( IOException e ) { if( !go.get() ) return; reportError( e ); } } } }
public void run() { log.log( Level.INFO, "Kernel started for connection:{0}.", address ); // An atomic is safest and costs almost nothing while( go.get() ) { try { // Could reuse the packet but I don't see the // point and it may lead to subtle bugs if not properly // reset. DatagramPacket packet = new DatagramPacket( buffer, buffer.length ); socket.receive(packet); newData( packet ); } catch( IOException e ) { if( !go.get() ) return; reportError( e ); } } } }
public void run() { log.log( Level.FINE, "Kernel started for connection:{0}.", address ); // An atomic is safest and costs almost nothing while( go.get() ) { try { // Could reuse the packet but I don't see the // point and it may lead to subtle bugs if not properly // reset. DatagramPacket packet = new DatagramPacket( buffer, buffer.length ); socket.receive(packet); newData( packet ); } catch( IOException e ) { if( !go.get() ) return; reportError( e ); } } } }