File tree Expand file tree Collapse file tree 5 files changed +0
-52
lines changed
modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4
main/java/org/elasticsearch/transport
test/java/org/elasticsearch/transport
test/framework/src/main/java/org/elasticsearch/transport Expand file tree Collapse file tree 5 files changed +0
-52
lines changed Original file line number Diff line number Diff line change 2020package org .elasticsearch .transport .netty4 ;
2121
2222import io .netty .channel .Channel ;
23- import io .netty .channel .ChannelException ;
2423import io .netty .channel .ChannelFuture ;
25- import io .netty .channel .ChannelOption ;
2624import io .netty .channel .ChannelPromise ;
2725import org .elasticsearch .ExceptionsHelper ;
2826import org .elasticsearch .action .ActionListener ;
3230import org .elasticsearch .transport .TcpChannel ;
3331import org .elasticsearch .transport .TransportException ;
3432
35- import java .io .IOException ;
3633import java .net .InetSocketAddress ;
3734
3835public class Netty4TcpChannel implements TcpChannel {
@@ -95,17 +92,6 @@ public void addConnectListener(ActionListener<Void> listener) {
9592 connectContext .addListener (ActionListener .toBiConsumer (listener ));
9693 }
9794
98- @ Override
99- public void setSoLinger (int value ) throws IOException {
100- if (channel .isOpen ()) {
101- try {
102- channel .config ().setOption (ChannelOption .SO_LINGER , value );
103- } catch (ChannelException e ) {
104- throw new IOException (e );
105- }
106- }
107- }
108-
10995 @ Override
11096 public boolean isOpen () {
11197 return channel .isOpen ();
Original file line number Diff line number Diff line change 2323import org .elasticsearch .common .bytes .BytesReference ;
2424import org .elasticsearch .common .network .CloseableChannel ;
2525
26- import java .io .IOException ;
2726import java .net .InetSocketAddress ;
2827
2928
@@ -39,14 +38,6 @@ public interface TcpChannel extends CloseableChannel {
3938 */
4039 String getProfile ();
4140
42- /**
43- * This sets the low level socket option {@link java.net.StandardSocketOptions} SO_LINGER on a channel.
44- *
45- * @param value to set for SO_LINGER
46- * @throws IOException that can be throw by the low level socket implementation
47- */
48- void setSoLinger (int value ) throws IOException ;
49-
5041 /**
5142 * Returns the local address for this channel.
5243 *
Original file line number Diff line number Diff line change @@ -348,24 +348,6 @@ protected void innerOnFailure(Exception e) {
348348 public void close () {
349349 if (isClosing .compareAndSet (false , true )) {
350350 try {
351- if (lifecycle .stopped ()) {
352- /* We set SO_LINGER timeout to 0 to ensure that when we shutdown the node we don't
353- * have a gazillion connections sitting in TIME_WAIT to free up resources quickly.
354- * This is really the only part where we close the connection from the server side
355- * otherwise the client (node) initiates the TCP closing sequence which doesn't cause
356- * these issues. Setting this by default from the beginning can have unexpected
357- * side-effects an should be avoided, our protocol is designed in a way that clients
358- * close connection which is how it should be*/
359-
360- channels .forEach (c -> {
361- try {
362- c .setSoLinger (0 );
363- } catch (IOException e ) {
364- logger .warn (new ParameterizedMessage ("unexpected exception when setting SO_LINGER on channel {}" , c ), e );
365- }
366- });
367- }
368-
369351 boolean block = lifecycle .stopped () && Transports .isTransportThread (Thread .currentThread ()) == false ;
370352 CloseableChannel .closeChannels (channels , block );
371353 } finally {
Original file line number Diff line number Diff line change @@ -273,10 +273,6 @@ public void addCloseListener(ActionListener<Void> listener) {
273273 public void addConnectListener (ActionListener <Void > listener ) {
274274 }
275275
276- @ Override
277- public void setSoLinger (int value ) throws IOException {
278- }
279-
280276 @ Override
281277 public boolean isOpen () {
282278 return false ;
Original file line number Diff line number Diff line change @@ -399,13 +399,6 @@ public void addConnectListener(ActionListener<Void> listener) {
399399 connectFuture .addListener (ActionListener .toBiConsumer (listener ));
400400 }
401401
402- @ Override
403- public void setSoLinger (int value ) throws IOException {
404- if (activeChannel != null && activeChannel .isClosed () == false ) {
405- activeChannel .setSoLinger (true , value );
406- }
407- }
408-
409402 @ Override
410403 public boolean isOpen () {
411404 return isOpen .get ();
You can’t perform that action at this time.
0 commit comments