Enable AUTO_CLOSE opton by default for backward compatibility / Deprecare AUTO_CLOSE option because it's gone in 5.0.

- Related #1952
This commit is contained in:
Trustin Lee 2013-11-05 17:40:23 +09:00
parent c7b66545b4
commit d2032254b7
3 changed files with 13 additions and 2 deletions

View File

@ -189,15 +189,21 @@ public interface ChannelConfig {
ChannelConfig setAutoRead(boolean autoRead);
/**
* @deprecated From version 5.0, {@link Channel} will not be closed on write failure.
*
* Returns {@code true} if and only if the {@link Channel} will be closed automatically and immediately on
* write failure. The default is {@code false}.
*/
@Deprecated
boolean isAutoClose();
/**
* @deprecated From version 5.0, {@link Channel} will not be closed on write failure.
*
* Sets whether the {@link Channel} should be closed automatically and immediately on write faillure.
* The default is {@code false}.
*/
@Deprecated
ChannelConfig setAutoClose(boolean autoClose);
/**

View File

@ -50,9 +50,12 @@ public class ChannelOption<T> extends UniqueName {
public static final ChannelOption<Boolean> AUTO_READ = valueOf("AUTO_READ");
/**
* @deprecated From version 5.0, {@link Channel} will not be closed on write failure.
*
* {@code true} if and only if the {@link Channel} is closed automatically and immediately on write failure.
* The default is {@code false}.
*/
@Deprecated
public static final ChannelOption<Boolean> AUTO_CLOSE = valueOf("AUTO_CLOSE");
public static final ChannelOption<Boolean> SO_BROADCAST = valueOf("SO_BROADCAST");

View File

@ -46,7 +46,7 @@ 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 boolean autoClose = true;
private volatile int writeBufferHighWaterMark = 64 * 1024;
private volatile int writeBufferLowWaterMark = 32 * 1024;
@ -65,6 +65,7 @@ public class DefaultChannelConfig implements ChannelConfig {
}
@Override
@SuppressWarnings("deprecation")
public Map<ChannelOption<?>, Object> getOptions() {
return getOptions(
null,
@ -102,7 +103,7 @@ public class DefaultChannelConfig implements ChannelConfig {
}
@Override
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "deprecation" })
public <T> T getOption(ChannelOption<T> option) {
if (option == null) {
throw new NullPointerException("option");
@ -142,6 +143,7 @@ public class DefaultChannelConfig implements ChannelConfig {
}
@Override
@SuppressWarnings("deprecation")
public <T> boolean setOption(ChannelOption<T> option, T value) {
validate(option, value);