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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public RxtxChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RxtxChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
public RxtxChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||||
|
@ -288,9 +288,6 @@ public interface RxtxChannelConfig extends ChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
RxtxChannelConfig setAutoRead(boolean autoRead);
|
RxtxChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
RxtxChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
RxtxChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
RxtxChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||||
|
|
||||||
|
@ -209,12 +209,6 @@ public class DefaultSctpChannelConfig extends DefaultChannelConfig implements Sc
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SctpChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
public SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||||
|
@ -192,12 +192,6 @@ public class DefaultSctpServerChannelConfig extends DefaultChannelConfig impleme
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SctpServerChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SctpServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
public SctpServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||||
|
@ -115,9 +115,6 @@ public interface SctpChannelConfig extends ChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
SctpChannelConfig setAutoRead(boolean autoRead);
|
SctpChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
SctpChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||||
|
|
||||||
|
@ -110,9 +110,6 @@ public interface SctpServerChannelConfig extends ChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
SctpServerChannelConfig setAutoRead(boolean autoRead);
|
SctpServerChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
SctpServerChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
SctpServerChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
SctpServerChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||||
|
|
||||||
|
@ -270,12 +270,6 @@ public class DefaultUdtChannelConfig extends DefaultChannelConfig implements
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UdtChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UdtChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
public UdtChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||||
|
@ -172,12 +172,6 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UdtServerChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UdtServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
public UdtServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||||
|
@ -130,9 +130,6 @@ public interface UdtChannelConfig extends ChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
UdtChannelConfig setAutoRead(boolean autoRead);
|
UdtChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
UdtChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
UdtChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
UdtChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||||
|
|
||||||
|
@ -64,9 +64,6 @@ public interface UdtServerChannelConfig extends UdtChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
UdtServerChannelConfig setAutoRead(boolean autoRead);
|
UdtServerChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
UdtServerChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
UdtServerChannelConfig setProtocolReceiveBufferSize(int size);
|
UdtServerChannelConfig setProtocolReceiveBufferSize(int size);
|
||||||
|
|
||||||
|
@ -638,9 +638,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
|
|||||||
doWrite(outboundBuffer);
|
doWrite(outboundBuffer);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
outboundBuffer.failFlushed(t);
|
outboundBuffer.failFlushed(t);
|
||||||
if (t instanceof IOException && config().isAutoClose()) {
|
|
||||||
close(voidPromise());
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
inFlush0 = false;
|
inFlush0 = false;
|
||||||
}
|
}
|
||||||
|
@ -188,18 +188,6 @@ public interface ChannelConfig {
|
|||||||
*/
|
*/
|
||||||
ChannelConfig setAutoRead(boolean autoRead);
|
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
|
* 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()}
|
* 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> ALLOW_HALF_CLOSURE = valueOf("ALLOW_HALF_CLOSURE");
|
||||||
public static final ChannelOption<Boolean> AUTO_READ = valueOf("AUTO_READ");
|
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_BROADCAST = valueOf("SO_BROADCAST");
|
||||||
public static final ChannelOption<Boolean> SO_KEEPALIVE = valueOf("SO_KEEPALIVE");
|
public static final ChannelOption<Boolean> SO_KEEPALIVE = valueOf("SO_KEEPALIVE");
|
||||||
public static final ChannelOption<Integer> SO_SNDBUF = valueOf("SO_SNDBUF");
|
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 maxMessagesPerRead;
|
||||||
private volatile int writeSpinCount = 16;
|
private volatile int writeSpinCount = 16;
|
||||||
private volatile boolean autoRead = true;
|
private volatile boolean autoRead = true;
|
||||||
private volatile boolean autoClose;
|
|
||||||
private volatile int writeBufferHighWaterMark = 64 * 1024;
|
private volatile int writeBufferHighWaterMark = 64 * 1024;
|
||||||
private volatile int writeBufferLowWaterMark = 32 * 1024;
|
private volatile int writeBufferLowWaterMark = 32 * 1024;
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ public class DefaultChannelConfig implements ChannelConfig {
|
|||||||
return getOptions(
|
return getOptions(
|
||||||
null,
|
null,
|
||||||
CONNECT_TIMEOUT_MILLIS, MAX_MESSAGES_PER_READ, WRITE_SPIN_COUNT,
|
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);
|
WRITE_BUFFER_LOW_WATER_MARK, MESSAGE_SIZE_ESTIMATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,9 +125,6 @@ public class DefaultChannelConfig implements ChannelConfig {
|
|||||||
if (option == AUTO_READ) {
|
if (option == AUTO_READ) {
|
||||||
return (T) Boolean.valueOf(isAutoRead());
|
return (T) Boolean.valueOf(isAutoRead());
|
||||||
}
|
}
|
||||||
if (option == AUTO_CLOSE) {
|
|
||||||
return (T) Boolean.valueOf(isAutoClose());
|
|
||||||
}
|
|
||||||
if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
|
if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
|
||||||
return (T) Integer.valueOf(getWriteBufferHighWaterMark());
|
return (T) Integer.valueOf(getWriteBufferHighWaterMark());
|
||||||
}
|
}
|
||||||
@ -157,8 +153,6 @@ public class DefaultChannelConfig implements ChannelConfig {
|
|||||||
setRecvByteBufAllocator((RecvByteBufAllocator) value);
|
setRecvByteBufAllocator((RecvByteBufAllocator) value);
|
||||||
} else if (option == AUTO_READ) {
|
} else if (option == AUTO_READ) {
|
||||||
setAutoRead((Boolean) value);
|
setAutoRead((Boolean) value);
|
||||||
} else if (option == AUTO_CLOSE) {
|
|
||||||
setAutoClose((Boolean) value);
|
|
||||||
} else if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
|
} else if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
|
||||||
setWriteBufferHighWaterMark((Integer) value);
|
setWriteBufferHighWaterMark((Integer) value);
|
||||||
} else if (option == WRITE_BUFFER_LOW_WATER_MARK) {
|
} else if (option == WRITE_BUFFER_LOW_WATER_MARK) {
|
||||||
@ -266,17 +260,6 @@ public class DefaultChannelConfig implements ChannelConfig {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAutoClose() {
|
|
||||||
return autoClose;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
this.autoClose = autoClose;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWriteBufferHighWaterMark() {
|
public int getWriteBufferHighWaterMark() {
|
||||||
return writeBufferHighWaterMark;
|
return writeBufferHighWaterMark;
|
||||||
|
@ -174,9 +174,6 @@ public interface DatagramChannelConfig extends ChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
DatagramChannelConfig setAutoRead(boolean autoRead);
|
DatagramChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
DatagramChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
DatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
DatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,7 @@ public class DefaultDatagramChannelConfig extends DefaultChannelConfig implement
|
|||||||
}
|
}
|
||||||
this.activeOnOpen = activeOnOpen;
|
this.activeOnOpen = activeOnOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBroadcast() {
|
public boolean isBroadcast() {
|
||||||
try {
|
try {
|
||||||
@ -395,12 +396,6 @@ public class DefaultDatagramChannelConfig extends DefaultChannelConfig implement
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatagramChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatagramChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
public DatagramChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||||
|
@ -315,12 +315,6 @@ public class DefaultSocketChannelConfig extends DefaultChannelConfig
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SocketChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
public SocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||||
|
@ -175,9 +175,6 @@ public interface SocketChannelConfig extends ChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
SocketChannelConfig setAutoRead(boolean autoRead);
|
SocketChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
SocketChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
SocketChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
SocketChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
||||||
}
|
}
|
||||||
|
@ -145,12 +145,6 @@ public class DefaultOioServerSocketChannelConfig extends DefaultServerSocketChan
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public OioServerSocketChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OioServerSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
public OioServerSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||||
|
@ -173,12 +173,6 @@ public class DefaultOioSocketChannelConfig extends DefaultSocketChannelConfig im
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public OioSocketChannelConfig setAutoClose(boolean autoClose) {
|
|
||||||
super.setAutoClose(autoClose);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OioSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
public OioSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||||
|
@ -81,9 +81,6 @@ public interface OioServerSocketChannelConfig extends ServerSocketChannelConfig
|
|||||||
@Override
|
@Override
|
||||||
OioServerSocketChannelConfig setAutoRead(boolean autoRead);
|
OioServerSocketChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
OioServerSocketChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
OioServerSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
OioServerSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||||
|
|
||||||
|
@ -96,9 +96,6 @@ public interface OioSocketChannelConfig extends SocketChannelConfig {
|
|||||||
@Override
|
@Override
|
||||||
OioSocketChannelConfig setAutoRead(boolean autoRead);
|
OioSocketChannelConfig setAutoRead(boolean autoRead);
|
||||||
|
|
||||||
@Override
|
|
||||||
OioSocketChannelConfig setAutoClose(boolean autoClose);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
OioSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
OioSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user