Fix covariant return types in ChannelConfig interfaces for method chaining

- Does it really worth doing this? I'm tempted to remove support for method chaining for ChannelConfig.
This commit is contained in:
Trustin Lee 2013-02-11 15:08:51 +09:00
parent dea1fde604
commit 0e341c9d72
11 changed files with 353 additions and 81 deletions

View File

@ -138,6 +138,7 @@ public final class EmptyByteBuf implements ByteBuf {
} }
@Override @Override
@Deprecated
public boolean readable() { public boolean readable() {
return false; return false;
} }
@ -148,6 +149,7 @@ public final class EmptyByteBuf implements ByteBuf {
} }
@Override @Override
@Deprecated
public boolean writable() { public boolean writable() {
return false; return false;
} }
@ -199,6 +201,7 @@ public final class EmptyByteBuf implements ByteBuf {
} }
@Override @Override
@Deprecated
public ByteBuf ensureWritableBytes(int minWritableBytes) { public ByteBuf ensureWritableBytes(int minWritableBytes) {
return ensureWritable(minWritableBytes); return ensureWritable(minWritableBytes);
} }

View File

@ -18,6 +18,7 @@ package io.netty.channel.udt;
import com.barchart.udt.OptionUDT; import com.barchart.udt.OptionUDT;
import com.barchart.udt.SocketUDT; import com.barchart.udt.SocketUDT;
import com.barchart.udt.nio.ChannelUDT; import com.barchart.udt.nio.ChannelUDT;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.DefaultChannelConfig; import io.netty.channel.DefaultChannelConfig;
@ -230,4 +231,27 @@ public class DefaultUdtChannelConfig extends DefaultChannelConfig implements
return systemSendBuferSize; return systemSendBuferSize;
} }
@Override
public UdtChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
super.setConnectTimeoutMillis(connectTimeoutMillis);
return this;
}
@Override
public UdtChannelConfig setWriteSpinCount(int writeSpinCount) {
super.setWriteSpinCount(writeSpinCount);
return this;
}
@Override
public UdtChannelConfig setAllocator(ByteBufAllocator allocator) {
super.setAllocator(allocator);
return this;
}
@Override
public UdtChannelConfig setAutoRead(boolean autoRead) {
super.setAutoRead(autoRead);
return this;
}
} }

View File

@ -15,14 +15,14 @@
*/ */
package io.netty.channel.udt; package io.netty.channel.udt;
import static io.netty.channel.ChannelOption.*; import com.barchart.udt.nio.ChannelUDT;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import com.barchart.udt.SocketUDT; import static io.netty.channel.ChannelOption.*;
import com.barchart.udt.nio.ChannelUDT;
/** /**
* The default {@link UdtServerChannelConfig} implementation. * The default {@link UdtServerChannelConfig} implementation.
@ -32,9 +32,8 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
private volatile int backlog = 64; private volatile int backlog = 64;
public DefaultUdtServerChannelConfig(final UdtChannel channel, public DefaultUdtServerChannelConfig(
final ChannelUDT channelUDT, final boolean apply) final UdtChannel channel, final ChannelUDT channelUDT, final boolean apply) throws IOException {
throws IOException {
super(channel, channelUDT, apply); super(channel, channelUDT, apply);
if (apply) { if (apply) {
apply(channelUDT); apply(channelUDT);
@ -43,7 +42,6 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
@Override @Override
protected void apply(final ChannelUDT channelUDT) throws IOException { protected void apply(final ChannelUDT channelUDT) throws IOException {
final SocketUDT socketUDT = channelUDT.socketUDT();
// nothing to apply for now. // nothing to apply for now.
} }
@ -136,4 +134,27 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
return this; return this;
} }
@Override
public UdtServerChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
super.setConnectTimeoutMillis(connectTimeoutMillis);
return this;
}
@Override
public UdtServerChannelConfig setWriteSpinCount(int writeSpinCount) {
super.setWriteSpinCount(writeSpinCount);
return this;
}
@Override
public UdtServerChannelConfig setAllocator(ByteBufAllocator allocator) {
super.setAllocator(allocator);
return this;
}
@Override
public UdtServerChannelConfig setAutoRead(boolean autoRead) {
super.setAutoRead(autoRead);
return this;
}
} }

View File

@ -15,14 +15,13 @@
*/ */
package io.netty.channel.udt; package io.netty.channel.udt;
import com.barchart.udt.OptionUDT;
import com.barchart.udt.TypeUDT;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelException; import io.netty.channel.ChannelException;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import com.barchart.udt.OptionUDT;
import com.barchart.udt.TypeUDT;
import com.barchart.udt.nio.KindUDT;
/** /**
* A {@link ChannelConfig} for a {@link UdtChannel}. * A {@link ChannelConfig} for a {@link UdtChannel}.
* <p> * <p>
@ -35,30 +34,30 @@ import com.barchart.udt.nio.KindUDT;
* <th>Name</th> * <th>Name</th>
* <th>Associated setter method</th> * <th>Associated setter method</th>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_REUSEADDR}</td><td>{@link #setReuseAddress(boolean)}</td> * <td>{@link ChannelOption#SO_REUSEADDR}</td><td>{@link #setReuseAddress(boolean)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td> * <td>{@link ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td> * <td>{@link ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_REUSEADDR}</td><td>{@link #setReuseAddress(boolean)}</td> * <td>{@link ChannelOption#SO_REUSEADDR}</td><td>{@link #setReuseAddress(boolean)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_LINGER}</td><td>{@link #setSoLinger(int)}</td> * <td>{@link ChannelOption#SO_LINGER}</td><td>{@link #setSoLinger(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td> * <td>{@link ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td> * <td>{@link ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.udt.UdtChannelOption#PROTOCOL_RECEIVE_BUFFER_SIZE}</td> * <td>{@link UdtChannelOption#PROTOCOL_RECEIVE_BUFFER_SIZE}</td>
* <td>{@link #setProtocolReceiveBufferSize(int)}</td> * <td>{@link #setProtocolReceiveBufferSize(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.udt.UdtChannelOption#PROTOCOL_SEND_BUFFER_SIZE}</td> * <td>{@link UdtChannelOption#PROTOCOL_SEND_BUFFER_SIZE}</td>
* <td>{@link #setProtocolSendBufferSize(int)}</td> * <td>{@link #setProtocolSendBufferSize(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.udt.UdtChannelOption#SYSTEM_RECEIVE_BUFFER_SIZE}</td> * <td>{@link UdtChannelOption#SYSTEM_RECEIVE_BUFFER_SIZE}</td>
* <td>{@link #setSystemReceiveBufferSize(int)}</td> * <td>{@link #setSystemReceiveBufferSize(int)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.udt.UdtChannelOption#SYSTEM_SEND_BUFFER_SIZE}</td> * <td>{@link UdtChannelOption#SYSTEM_SEND_BUFFER_SIZE}</td>
* <td>{@link #setSystemSendBufferSize(int)}</td> * <td>{@link #setSystemSendBufferSize(int)}</td>
* </tr> * </tr>
@ -111,6 +110,18 @@ public interface UdtChannelConfig extends ChannelConfig {
*/ */
boolean isReuseAddress(); boolean isReuseAddress();
@Override
UdtChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
@Override
UdtChannelConfig setWriteSpinCount(int writeSpinCount);
@Override
UdtChannelConfig setAllocator(ByteBufAllocator allocator);
@Override
UdtChannelConfig setAutoRead(boolean autoRead);
/** /**
* Sets {@link OptionUDT#Protocol_Receive_Buffer_Size} * Sets {@link OptionUDT#Protocol_Receive_Buffer_Size}
*/ */

View File

@ -15,13 +15,13 @@
*/ */
package io.netty.channel.udt; package io.netty.channel.udt;
import com.barchart.udt.TypeUDT;
import com.barchart.udt.nio.KindUDT;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelException; import io.netty.channel.ChannelException;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import com.barchart.udt.TypeUDT;
import com.barchart.udt.nio.KindUDT;
/** /**
* A {@link ChannelConfig} for a {@link UdtServerChannel}. * A {@link ChannelConfig} for a {@link UdtServerChannel}.
* <p> * <p>
@ -44,6 +44,18 @@ public interface UdtServerChannelConfig extends UdtChannelConfig {
*/ */
UdtServerChannelConfig setBacklog(int backlog); UdtServerChannelConfig setBacklog(int backlog);
@Override
UdtServerChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
@Override
UdtServerChannelConfig setWriteSpinCount(int writeSpinCount);
@Override
UdtServerChannelConfig setAllocator(ByteBufAllocator allocator);
@Override
UdtServerChannelConfig setAutoRead(boolean autoRead);
@Override @Override
UdtServerChannelConfig setProtocolReceiveBufferSize(int size); UdtServerChannelConfig setProtocolReceiveBufferSize(int size);

View File

@ -35,8 +35,7 @@ import static io.netty.channel.ChannelOption.*;
/** /**
* The Async {@link ServerSocketChannelConfig} implementation. * The Async {@link ServerSocketChannelConfig} implementation.
*/ */
final class AioServerSocketChannelConfig extends DefaultChannelConfig final class AioServerSocketChannelConfig extends DefaultChannelConfig implements ServerSocketChannelConfig {
implements ServerSocketChannelConfig {
private final AtomicReference<AsynchronousServerSocketChannel> javaChannel private final AtomicReference<AsynchronousServerSocketChannel> javaChannel
= new AtomicReference<AsynchronousServerSocketChannel>(); = new AtomicReference<AsynchronousServerSocketChannel>();
@ -107,7 +106,7 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
} }
@Override @Override
public ServerSocketChannelConfig setReuseAddress(boolean reuseAddress) { public AioServerSocketChannelConfig setReuseAddress(boolean reuseAddress) {
setOption(StandardSocketOptions.SO_REUSEADDR, reuseAddress); setOption(StandardSocketOptions.SO_REUSEADDR, reuseAddress);
return this; return this;
} }
@ -118,13 +117,13 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
} }
@Override @Override
public ServerSocketChannelConfig setReceiveBufferSize(int receiveBufferSize) { public AioServerSocketChannelConfig setReceiveBufferSize(int receiveBufferSize) {
setOption(StandardSocketOptions.SO_RCVBUF, receiveBufferSize); setOption(StandardSocketOptions.SO_RCVBUF, receiveBufferSize);
return this; return this;
} }
@Override @Override
public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) { public AioServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -134,7 +133,7 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
} }
@Override @Override
public ServerSocketChannelConfig setBacklog(int backlog) { public AioServerSocketChannelConfig setBacklog(int backlog) {
if (backlog < 0) { if (backlog < 0) {
throw new IllegalArgumentException("backlog: " + backlog); throw new IllegalArgumentException("backlog: " + backlog);
} }
@ -202,22 +201,26 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
} }
@Override @Override
public ServerSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) { public AioServerSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
return (ServerSocketChannelConfig) super.setConnectTimeoutMillis(connectTimeoutMillis); super.setConnectTimeoutMillis(connectTimeoutMillis);
return this;
} }
@Override @Override
public ServerSocketChannelConfig setWriteSpinCount(int writeSpinCount) { public AioServerSocketChannelConfig setWriteSpinCount(int writeSpinCount) {
return (ServerSocketChannelConfig) super.setWriteSpinCount(writeSpinCount); super.setWriteSpinCount(writeSpinCount);
return this;
} }
@Override @Override
public ServerSocketChannelConfig setAllocator(ByteBufAllocator allocator) { public AioServerSocketChannelConfig setAllocator(ByteBufAllocator allocator) {
return (ServerSocketChannelConfig) super.setAllocator(allocator); super.setAllocator(allocator);
return this;
} }
@Override @Override
public ServerSocketChannelConfig setAutoRead(boolean autoRead) { public AioServerSocketChannelConfig setAutoRead(boolean autoRead) {
return (ServerSocketChannelConfig) super.setAutoRead(autoRead); super.setAutoRead(autoRead);
return this;
} }
} }

View File

@ -16,6 +16,7 @@
package io.netty.channel.socket.aio; package io.netty.channel.socket.aio;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelOption;
import io.netty.channel.socket.SocketChannelConfig; import io.netty.channel.socket.SocketChannelConfig;
import java.nio.channels.InterruptedByTimeoutException; import java.nio.channels.InterruptedByTimeoutException;
@ -32,13 +33,46 @@ import java.nio.channels.InterruptedByTimeoutException;
* <tr> * <tr>
* <th>Name</th><th>Associated setter method</th> * <th>Name</th><th>Associated setter method</th>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#AIO_READ_TIMEOUT}</td><td>{@link #setReadTimeout(long)}</td> * <td>{@link ChannelOption#AIO_READ_TIMEOUT}</td><td>{@link #setReadTimeout(long)}</td>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#AIO_WRITE_TIMEOUT}</td><td>{@link #setWriteTimeout(long)}</td> * <td>{@link ChannelOption#AIO_WRITE_TIMEOUT}</td><td>{@link #setWriteTimeout(long)}</td>
* </tr> * </tr>
* </table> * </table>
*/ */
public interface AioSocketChannelConfig extends SocketChannelConfig { public interface AioSocketChannelConfig extends SocketChannelConfig {
/**
* Return the read timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
* Once such an exception was detected it will get propagated to the handlers first. After that the channel
* will get closed as it may be in an unknown state.
*
* To disable it just use {@code 0}.
*/
AioSocketChannelConfig setReadTimeout(long readTimeoutInMillis);
/**
* Return the write timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
* Once such an exception was detected it will get propagated to the handlers first. After that the channel
* will get closed as it may be in an unknown state.
*
* To disable it just use {@code 0}.
*/
AioSocketChannelConfig setWriteTimeout(long writeTimeoutInMillis);
/**
* Return the read timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
*
* The default is {@code 0}
*/
long getReadTimeout();
/**
* Return the write timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
*
* The default is {@code 0}
*/
long getWriteTimeout();
@Override @Override
AioSocketChannelConfig setTcpNoDelay(boolean tcpNoDelay); AioSocketChannelConfig setTcpNoDelay(boolean tcpNoDelay);
@ -77,37 +111,4 @@ public interface AioSocketChannelConfig extends SocketChannelConfig {
@Override @Override
AioSocketChannelConfig setAutoRead(boolean autoRead); AioSocketChannelConfig setAutoRead(boolean autoRead);
/**
* Return the read timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
* Once such an exception was detected it will get propagated to the handlers first. After that the channel
* will get closed as it may be in an unknown state.
*
* To disable it just use {@code 0}.
*/
AioSocketChannelConfig setReadTimeout(long readTimeoutInMillis);
/**
* Return the write timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
* Once such an exception was detected it will get propagated to the handlers first. After that the channel
* will get closed as it may be in an unknown state.
*
* To disable it just use {@code 0}.
*/
AioSocketChannelConfig setWriteTimeout(long writeTimeoutInMillis);
/**
* Return the read timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
*
* The default is {@code 0}
*/
long getReadTimeout();
/**
* Return the write timeout in milliseconds after which a {@link InterruptedByTimeoutException} will get thrown.
*
* The default is {@code 0}
*/
long getWriteTimeout();
} }

View File

@ -15,6 +15,7 @@
*/ */
package io.netty.channel.socket.oio; package io.netty.channel.socket.oio;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelException; import io.netty.channel.ChannelException;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.socket.DefaultServerSocketChannelConfig; import io.netty.channel.socket.DefaultServerSocketChannelConfig;
@ -24,7 +25,7 @@ import java.io.IOException;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.util.Map; import java.util.Map;
import static io.netty.channel.ChannelOption.SO_TIMEOUT; import static io.netty.channel.ChannelOption.*;
/** /**
* Default {@link OioServerSocketChannelConfig} implementation * Default {@link OioServerSocketChannelConfig} implementation
@ -64,12 +65,13 @@ public class DefaultOioServerSocketChannelConfig extends DefaultServerSocketChan
} }
@Override @Override
public void setSoTimeout(int timeout) { public OioServerSocketChannelConfig setSoTimeout(int timeout) {
try { try {
javaSocket.setSoTimeout(timeout); javaSocket.setSoTimeout(timeout);
} catch (IOException e) { } catch (IOException e) {
throw new ChannelException(e); throw new ChannelException(e);
} }
return this;
} }
@Override @Override
@ -80,4 +82,52 @@ public class DefaultOioServerSocketChannelConfig extends DefaultServerSocketChan
throw new ChannelException(e); throw new ChannelException(e);
} }
} }
@Override
public OioServerSocketChannelConfig setBacklog(int backlog) {
super.setBacklog(backlog);
return this;
}
@Override
public OioServerSocketChannelConfig setReuseAddress(boolean reuseAddress) {
super.setReuseAddress(reuseAddress);
return this;
}
@Override
public OioServerSocketChannelConfig setReceiveBufferSize(int receiveBufferSize) {
super.setReceiveBufferSize(receiveBufferSize);
return this;
}
@Override
public OioServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
super.setPerformancePreferences(connectionTime, latency, bandwidth);
return this;
}
@Override
public OioServerSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
super.setConnectTimeoutMillis(connectTimeoutMillis);
return this;
}
@Override
public OioServerSocketChannelConfig setWriteSpinCount(int writeSpinCount) {
super.setWriteSpinCount(writeSpinCount);
return this;
}
@Override
public OioServerSocketChannelConfig setAllocator(ByteBufAllocator allocator) {
super.setAllocator(allocator);
return this;
}
@Override
public OioServerSocketChannelConfig setAutoRead(boolean autoRead) {
super.setAutoRead(autoRead);
return this;
}
} }

View File

@ -15,6 +15,7 @@
*/ */
package io.netty.channel.socket.oio; package io.netty.channel.socket.oio;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelException; import io.netty.channel.ChannelException;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.socket.DefaultSocketChannelConfig; import io.netty.channel.socket.DefaultSocketChannelConfig;
@ -62,12 +63,13 @@ public class DefaultOioSocketChannelConfig extends DefaultSocketChannelConfig im
} }
@Override @Override
public void setSoTimeout(int timeout) { public OioSocketChannelConfig setSoTimeout(int timeout) {
try { try {
javaSocket.setSoTimeout(timeout); javaSocket.setSoTimeout(timeout);
} catch (IOException e) { } catch (IOException e) {
throw new ChannelException(e); throw new ChannelException(e);
} }
return this;
} }
@Override @Override
@ -78,4 +80,82 @@ public class DefaultOioSocketChannelConfig extends DefaultSocketChannelConfig im
throw new ChannelException(e); throw new ChannelException(e);
} }
} }
@Override
public OioSocketChannelConfig setTcpNoDelay(boolean tcpNoDelay) {
super.setTcpNoDelay(tcpNoDelay);
return this;
}
@Override
public OioSocketChannelConfig setSoLinger(int soLinger) {
super.setSoLinger(soLinger);
return this;
}
@Override
public OioSocketChannelConfig setSendBufferSize(int sendBufferSize) {
super.setSendBufferSize(sendBufferSize);
return this;
}
@Override
public OioSocketChannelConfig setReceiveBufferSize(int receiveBufferSize) {
super.setReceiveBufferSize(receiveBufferSize);
return this;
}
@Override
public OioSocketChannelConfig setKeepAlive(boolean keepAlive) {
super.setKeepAlive(keepAlive);
return this;
}
@Override
public OioSocketChannelConfig setTrafficClass(int trafficClass) {
super.setTrafficClass(trafficClass);
return this;
}
@Override
public OioSocketChannelConfig setReuseAddress(boolean reuseAddress) {
super.setReuseAddress(reuseAddress);
return this;
}
@Override
public OioSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
super.setPerformancePreferences(connectionTime, latency, bandwidth);
return this;
}
@Override
public OioSocketChannelConfig setAllowHalfClosure(boolean allowHalfClosure) {
super.setAllowHalfClosure(true);
return this;
}
@Override
public OioSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
super.setConnectTimeoutMillis(connectTimeoutMillis);
return this;
}
@Override
public OioSocketChannelConfig setWriteSpinCount(int writeSpinCount) {
super.setWriteSpinCount(writeSpinCount);
return this;
}
@Override
public OioSocketChannelConfig setAllocator(ByteBufAllocator allocator) {
super.setAllocator(allocator);
return this;
}
@Override
public OioSocketChannelConfig setAutoRead(boolean autoRead) {
super.setAutoRead(autoRead);
return this;
}
} }

View File

@ -15,6 +15,8 @@
*/ */
package io.netty.channel.socket.oio; package io.netty.channel.socket.oio;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelOption;
import io.netty.channel.socket.ServerSocketChannelConfig; import io.netty.channel.socket.ServerSocketChannelConfig;
@ -31,7 +33,7 @@ import io.netty.channel.socket.ServerSocketChannelConfig;
* <tr> * <tr>
* <th>Name</th><th>Associated setter method</th> * <th>Name</th><th>Associated setter method</th>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_TIMEOUT}</td><td>{@link #setSoTimeout(int)}</td> * <td>{@link ChannelOption#SO_TIMEOUT}</td><td>{@link #setSoTimeout(int)}</td>
* </tr> * </tr>
* </table> * </table>
*/ */
@ -40,10 +42,34 @@ public interface OioServerSocketChannelConfig extends ServerSocketChannelConfig
/** /**
* Sets the maximal time a operation on the underlying socket may block. * Sets the maximal time a operation on the underlying socket may block.
*/ */
void setSoTimeout(int timeout); OioServerSocketChannelConfig setSoTimeout(int timeout);
/** /**
* Returns the maximal time a operation on the underlying socket may block. * Returns the maximal time a operation on the underlying socket may block.
*/ */
int getSoTimeout(); int getSoTimeout();
@Override
OioServerSocketChannelConfig setBacklog(int backlog);
@Override
OioServerSocketChannelConfig setReuseAddress(boolean reuseAddress);
@Override
OioServerSocketChannelConfig setReceiveBufferSize(int receiveBufferSize);
@Override
OioServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth);
@Override
OioServerSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
@Override
OioServerSocketChannelConfig setWriteSpinCount(int writeSpinCount);
@Override
OioServerSocketChannelConfig setAllocator(ByteBufAllocator allocator);
@Override
OioServerSocketChannelConfig setAutoRead(boolean autoRead);
} }

View File

@ -15,7 +15,9 @@
*/ */
package io.netty.channel.socket.oio; package io.netty.channel.socket.oio;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelOption;
import io.netty.channel.socket.SocketChannelConfig; import io.netty.channel.socket.SocketChannelConfig;
/** /**
@ -31,7 +33,7 @@ import io.netty.channel.socket.SocketChannelConfig;
* <tr> * <tr>
* <th>Name</th><th>Associated setter method</th> * <th>Name</th><th>Associated setter method</th>
* </tr><tr> * </tr><tr>
* <td>{@link io.netty.channel.ChannelOption#SO_TIMEOUT}</td><td>{@link #setSoTimeout(int)}</td> * <td>{@link ChannelOption#SO_TIMEOUT}</td><td>{@link #setSoTimeout(int)}</td>
* </tr> * </tr>
* </table> * </table>
*/ */
@ -40,10 +42,49 @@ public interface OioSocketChannelConfig extends SocketChannelConfig {
/** /**
* Sets the maximal time a operation on the underlying socket may block. * Sets the maximal time a operation on the underlying socket may block.
*/ */
void setSoTimeout(int timeout); OioSocketChannelConfig setSoTimeout(int timeout);
/** /**
* Returns the maximal time a operation on the underlying socket may block. * Returns the maximal time a operation on the underlying socket may block.
*/ */
int getSoTimeout(); int getSoTimeout();
@Override
OioSocketChannelConfig setTcpNoDelay(boolean tcpNoDelay);
@Override
OioSocketChannelConfig setSoLinger(int soLinger);
@Override
OioSocketChannelConfig setSendBufferSize(int sendBufferSize);
@Override
OioSocketChannelConfig setReceiveBufferSize(int receiveBufferSize);
@Override
OioSocketChannelConfig setKeepAlive(boolean keepAlive);
@Override
OioSocketChannelConfig setTrafficClass(int trafficClass);
@Override
OioSocketChannelConfig setReuseAddress(boolean reuseAddress);
@Override
OioSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth);
@Override
OioSocketChannelConfig setAllowHalfClosure(boolean allowHalfClosure);
@Override
OioSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
@Override
OioSocketChannelConfig setWriteSpinCount(int writeSpinCount);
@Override
OioSocketChannelConfig setAllocator(ByteBufAllocator allocator);
@Override
OioSocketChannelConfig setAutoRead(boolean autoRead);
} }