Remove AUTO_CLOSE option
- Related #1952 - Since 5.0, we ask users decide to close the channel on write failure.
This commit is contained in:
parent
e2de807fb0
commit
7fff25c0de
@ -234,12 +234,6 @@ final class DefaultRxtxChannelConfig extends DefaultChannelConfig implements Rxt
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RxtxChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RxtxChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
|
@ -288,9 +288,6 @@ public interface RxtxChannelConfig extends ChannelConfig {
|
||||
@Override
|
||||
RxtxChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
RxtxChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
RxtxChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
|
@ -209,12 +209,6 @@ public class DefaultSctpChannelConfig extends DefaultChannelConfig implements Sc
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
|
@ -192,12 +192,6 @@ public class DefaultSctpServerChannelConfig extends DefaultChannelConfig impleme
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||
|
@ -115,9 +115,6 @@ public interface SctpChannelConfig extends ChannelConfig {
|
||||
@Override
|
||||
SctpChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
|
@ -110,9 +110,6 @@ public interface SctpServerChannelConfig extends ChannelConfig {
|
||||
@Override
|
||||
SctpServerChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
|
@ -270,12 +270,6 @@ public class DefaultUdtChannelConfig extends DefaultChannelConfig implements
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UdtChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UdtChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||
|
@ -172,12 +172,6 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UdtServerChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UdtServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||
|
@ -130,9 +130,6 @@ public interface UdtChannelConfig extends ChannelConfig {
|
||||
@Override
|
||||
UdtChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
UdtChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
UdtChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
|
@ -64,9 +64,6 @@ public interface UdtServerChannelConfig extends UdtChannelConfig {
|
||||
@Override
|
||||
UdtServerChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
UdtServerChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
UdtServerChannelConfig setProtocolReceiveBufferSize(int size);
|
||||
|
||||
|
@ -638,9 +638,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
|
||||
doWrite(outboundBuffer);
|
||||
} catch (Throwable t) {
|
||||
outboundBuffer.failFlushed(t);
|
||||
if (t instanceof IOException && config().isAutoClose()) {
|
||||
close(voidPromise());
|
||||
}
|
||||
} finally {
|
||||
inFlush0 = false;
|
||||
}
|
||||
|
@ -188,18 +188,6 @@ public interface ChannelConfig {
|
||||
*/
|
||||
ChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
/**
|
||||
* Returns {@code true} if and only if the {@link Channel} will be closed automatically and immediately on
|
||||
* write failure. The default is {@code false}.
|
||||
*/
|
||||
boolean isAutoClose();
|
||||
|
||||
/**
|
||||
* Sets whether the {@link Channel} should be closed automatically and immediately on write faillure.
|
||||
* The default is {@code false}.
|
||||
*/
|
||||
ChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
/**
|
||||
* Returns the high water mark of the write buffer. If the number of bytes
|
||||
* queued in the write buffer exceeds this value, {@link Channel#isWritable()}
|
||||
|
@ -68,12 +68,6 @@ public final class ChannelOption<T> extends AbstractConstant<ChannelOption<T>> {
|
||||
public static final ChannelOption<Boolean> ALLOW_HALF_CLOSURE = valueOf("ALLOW_HALF_CLOSURE");
|
||||
public static final ChannelOption<Boolean> AUTO_READ = valueOf("AUTO_READ");
|
||||
|
||||
/**
|
||||
* {@code true} if and only if the {@link Channel} is closed automatically and immediately on write failure.
|
||||
* The default is {@code false}.
|
||||
*/
|
||||
public static final ChannelOption<Boolean> AUTO_CLOSE = valueOf("AUTO_CLOSE");
|
||||
|
||||
public static final ChannelOption<Boolean> SO_BROADCAST = valueOf("SO_BROADCAST");
|
||||
public static final ChannelOption<Boolean> SO_KEEPALIVE = valueOf("SO_KEEPALIVE");
|
||||
public static final ChannelOption<Integer> SO_SNDBUF = valueOf("SO_SNDBUF");
|
||||
|
@ -46,7 +46,6 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
private volatile int maxMessagesPerRead;
|
||||
private volatile int writeSpinCount = 16;
|
||||
private volatile boolean autoRead = true;
|
||||
private volatile boolean autoClose;
|
||||
private volatile int writeBufferHighWaterMark = 64 * 1024;
|
||||
private volatile int writeBufferLowWaterMark = 32 * 1024;
|
||||
|
||||
@ -69,7 +68,7 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
return getOptions(
|
||||
null,
|
||||
CONNECT_TIMEOUT_MILLIS, MAX_MESSAGES_PER_READ, WRITE_SPIN_COUNT,
|
||||
ALLOCATOR, AUTO_READ, AUTO_CLOSE, RCVBUF_ALLOCATOR, WRITE_BUFFER_HIGH_WATER_MARK,
|
||||
ALLOCATOR, AUTO_READ, RCVBUF_ALLOCATOR, WRITE_BUFFER_HIGH_WATER_MARK,
|
||||
WRITE_BUFFER_LOW_WATER_MARK, MESSAGE_SIZE_ESTIMATOR);
|
||||
}
|
||||
|
||||
@ -126,9 +125,6 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
if (option == AUTO_READ) {
|
||||
return (T) Boolean.valueOf(isAutoRead());
|
||||
}
|
||||
if (option == AUTO_CLOSE) {
|
||||
return (T) Boolean.valueOf(isAutoClose());
|
||||
}
|
||||
if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
|
||||
return (T) Integer.valueOf(getWriteBufferHighWaterMark());
|
||||
}
|
||||
@ -157,8 +153,6 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
setRecvByteBufAllocator((RecvByteBufAllocator) value);
|
||||
} else if (option == AUTO_READ) {
|
||||
setAutoRead((Boolean) value);
|
||||
} else if (option == AUTO_CLOSE) {
|
||||
setAutoClose((Boolean) value);
|
||||
} else if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
|
||||
setWriteBufferHighWaterMark((Integer) value);
|
||||
} else if (option == WRITE_BUFFER_LOW_WATER_MARK) {
|
||||
@ -266,17 +260,6 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoClose() {
|
||||
return autoClose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelConfig setAutoClose(boolean autoClose) {
|
||||
this.autoClose = autoClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWriteBufferHighWaterMark() {
|
||||
return writeBufferHighWaterMark;
|
||||
|
@ -174,9 +174,6 @@ public interface DatagramChannelConfig extends ChannelConfig {
|
||||
@Override
|
||||
DatagramChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
DatagramChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
DatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
||||
}
|
||||
|
@ -143,6 +143,7 @@ public class DefaultDatagramChannelConfig extends DefaultChannelConfig implement
|
||||
}
|
||||
this.activeOnOpen = activeOnOpen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBroadcast() {
|
||||
try {
|
||||
@ -395,12 +396,6 @@ public class DefaultDatagramChannelConfig extends DefaultChannelConfig implement
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatagramChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatagramChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
|
@ -315,12 +315,6 @@ public class DefaultSocketChannelConfig extends DefaultChannelConfig
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SocketChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
|
@ -175,9 +175,6 @@ public interface SocketChannelConfig extends ChannelConfig {
|
||||
@Override
|
||||
SocketChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
SocketChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
SocketChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
||||
}
|
||||
|
@ -145,12 +145,6 @@ public class DefaultOioServerSocketChannelConfig extends DefaultServerSocketChan
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OioServerSocketChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OioServerSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
|
@ -173,12 +173,6 @@ public class DefaultOioSocketChannelConfig extends DefaultSocketChannelConfig im
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OioSocketChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OioSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
|
@ -81,9 +81,6 @@ public interface OioServerSocketChannelConfig extends ServerSocketChannelConfig
|
||||
@Override
|
||||
OioServerSocketChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
OioServerSocketChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
OioServerSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
|
@ -96,9 +96,6 @@ public interface OioSocketChannelConfig extends SocketChannelConfig {
|
||||
@Override
|
||||
OioSocketChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
OioSocketChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
OioSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user