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:
parent
dea1fde604
commit
0e341c9d72
|
@ -138,6 +138,7 @@ public final class EmptyByteBuf implements ByteBuf {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean readable() {
|
||||
return false;
|
||||
}
|
||||
|
@ -148,6 +149,7 @@ public final class EmptyByteBuf implements ByteBuf {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean writable() {
|
||||
return false;
|
||||
}
|
||||
|
@ -199,6 +201,7 @@ public final class EmptyByteBuf implements ByteBuf {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ByteBuf ensureWritableBytes(int minWritableBytes) {
|
||||
return ensureWritable(minWritableBytes);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package io.netty.channel.udt;
|
|||
import com.barchart.udt.OptionUDT;
|
||||
import com.barchart.udt.SocketUDT;
|
||||
import com.barchart.udt.nio.ChannelUDT;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.DefaultChannelConfig;
|
||||
|
||||
|
@ -230,4 +231,27 @@ public class DefaultUdtChannelConfig extends DefaultChannelConfig implements
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
*/
|
||||
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 java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import com.barchart.udt.SocketUDT;
|
||||
import com.barchart.udt.nio.ChannelUDT;
|
||||
import static io.netty.channel.ChannelOption.*;
|
||||
|
||||
/**
|
||||
* The default {@link UdtServerChannelConfig} implementation.
|
||||
|
@ -32,9 +32,8 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
|
|||
|
||||
private volatile int backlog = 64;
|
||||
|
||||
public DefaultUdtServerChannelConfig(final UdtChannel channel,
|
||||
final ChannelUDT channelUDT, final boolean apply)
|
||||
throws IOException {
|
||||
public DefaultUdtServerChannelConfig(
|
||||
final UdtChannel channel, final ChannelUDT channelUDT, final boolean apply) throws IOException {
|
||||
super(channel, channelUDT, apply);
|
||||
if (apply) {
|
||||
apply(channelUDT);
|
||||
|
@ -43,7 +42,6 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
|
|||
|
||||
@Override
|
||||
protected void apply(final ChannelUDT channelUDT) throws IOException {
|
||||
final SocketUDT socketUDT = channelUDT.socketUDT();
|
||||
// nothing to apply for now.
|
||||
}
|
||||
|
||||
|
@ -136,4 +134,27 @@ public class DefaultUdtServerChannelConfig extends DefaultUdtChannelConfig
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,13 @@
|
|||
*/
|
||||
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.ChannelException;
|
||||
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}.
|
||||
* <p>
|
||||
|
@ -35,30 +34,30 @@ import com.barchart.udt.nio.KindUDT;
|
|||
* <th>Name</th>
|
||||
* <th>Associated setter method</th>
|
||||
* </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>
|
||||
* <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>
|
||||
* <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>
|
||||
* <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>
|
||||
* <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>
|
||||
* <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>
|
||||
* <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>
|
||||
* <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>
|
||||
* </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>
|
||||
* </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>
|
||||
* </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>
|
||||
|
||||
* </tr>
|
||||
|
@ -111,6 +110,18 @@ public interface UdtChannelConfig extends ChannelConfig {
|
|||
*/
|
||||
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}
|
||||
*/
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
*/
|
||||
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.ChannelException;
|
||||
import io.netty.channel.ChannelOption;
|
||||
|
||||
import com.barchart.udt.TypeUDT;
|
||||
import com.barchart.udt.nio.KindUDT;
|
||||
|
||||
/**
|
||||
* A {@link ChannelConfig} for a {@link UdtServerChannel}.
|
||||
* <p>
|
||||
|
@ -44,6 +44,18 @@ public interface UdtServerChannelConfig extends UdtChannelConfig {
|
|||
*/
|
||||
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
|
||||
UdtServerChannelConfig setProtocolReceiveBufferSize(int size);
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ import static io.netty.channel.ChannelOption.*;
|
|||
/**
|
||||
* The Async {@link ServerSocketChannelConfig} implementation.
|
||||
*/
|
||||
final class AioServerSocketChannelConfig extends DefaultChannelConfig
|
||||
implements ServerSocketChannelConfig {
|
||||
final class AioServerSocketChannelConfig extends DefaultChannelConfig implements ServerSocketChannelConfig {
|
||||
|
||||
private final AtomicReference<AsynchronousServerSocketChannel> javaChannel
|
||||
= new AtomicReference<AsynchronousServerSocketChannel>();
|
||||
|
@ -107,7 +106,7 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setReuseAddress(boolean reuseAddress) {
|
||||
public AioServerSocketChannelConfig setReuseAddress(boolean reuseAddress) {
|
||||
setOption(StandardSocketOptions.SO_REUSEADDR, reuseAddress);
|
||||
return this;
|
||||
}
|
||||
|
@ -118,13 +117,13 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setReceiveBufferSize(int receiveBufferSize) {
|
||||
public AioServerSocketChannelConfig setReceiveBufferSize(int receiveBufferSize) {
|
||||
setOption(StandardSocketOptions.SO_RCVBUF, receiveBufferSize);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
|
||||
public AioServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -134,7 +133,7 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setBacklog(int backlog) {
|
||||
public AioServerSocketChannelConfig setBacklog(int backlog) {
|
||||
if (backlog < 0) {
|
||||
throw new IllegalArgumentException("backlog: " + backlog);
|
||||
}
|
||||
|
@ -202,22 +201,26 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
|
||||
return (ServerSocketChannelConfig) super.setConnectTimeoutMillis(connectTimeoutMillis);
|
||||
public AioServerSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
|
||||
super.setConnectTimeoutMillis(connectTimeoutMillis);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setWriteSpinCount(int writeSpinCount) {
|
||||
return (ServerSocketChannelConfig) super.setWriteSpinCount(writeSpinCount);
|
||||
public AioServerSocketChannelConfig setWriteSpinCount(int writeSpinCount) {
|
||||
super.setWriteSpinCount(writeSpinCount);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setAllocator(ByteBufAllocator allocator) {
|
||||
return (ServerSocketChannelConfig) super.setAllocator(allocator);
|
||||
public AioServerSocketChannelConfig setAllocator(ByteBufAllocator allocator) {
|
||||
super.setAllocator(allocator);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannelConfig setAutoRead(boolean autoRead) {
|
||||
return (ServerSocketChannelConfig) super.setAutoRead(autoRead);
|
||||
public AioServerSocketChannelConfig setAutoRead(boolean autoRead) {
|
||||
super.setAutoRead(autoRead);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package io.netty.channel.socket.aio;
|
||||
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.socket.SocketChannelConfig;
|
||||
|
||||
import java.nio.channels.InterruptedByTimeoutException;
|
||||
|
@ -32,13 +33,46 @@ import java.nio.channels.InterruptedByTimeoutException;
|
|||
* <tr>
|
||||
* <th>Name</th><th>Associated setter method</th>
|
||||
* </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>
|
||||
* <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>
|
||||
* </table>
|
||||
*/
|
||||
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
|
||||
AioSocketChannelConfig setTcpNoDelay(boolean tcpNoDelay);
|
||||
|
||||
|
@ -77,37 +111,4 @@ public interface AioSocketChannelConfig extends SocketChannelConfig {
|
|||
|
||||
@Override
|
||||
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();
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.socket.DefaultServerSocketChannelConfig;
|
||||
|
@ -24,7 +25,7 @@ import java.io.IOException;
|
|||
import java.net.ServerSocket;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.netty.channel.ChannelOption.SO_TIMEOUT;
|
||||
import static io.netty.channel.ChannelOption.*;
|
||||
|
||||
/**
|
||||
* Default {@link OioServerSocketChannelConfig} implementation
|
||||
|
@ -64,12 +65,13 @@ public class DefaultOioServerSocketChannelConfig extends DefaultServerSocketChan
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setSoTimeout(int timeout) {
|
||||
public OioServerSocketChannelConfig setSoTimeout(int timeout) {
|
||||
try {
|
||||
javaSocket.setSoTimeout(timeout);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,4 +82,52 @@ public class DefaultOioServerSocketChannelConfig extends DefaultServerSocketChan
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.socket.DefaultSocketChannelConfig;
|
||||
|
@ -62,12 +63,13 @@ public class DefaultOioSocketChannelConfig extends DefaultSocketChannelConfig im
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setSoTimeout(int timeout) {
|
||||
public OioSocketChannelConfig setSoTimeout(int timeout) {
|
||||
try {
|
||||
javaSocket.setSoTimeout(timeout);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,4 +80,82 @@ public class DefaultOioSocketChannelConfig extends DefaultSocketChannelConfig im
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.socket.ServerSocketChannelConfig;
|
||||
|
||||
|
||||
|
@ -31,7 +33,7 @@ import io.netty.channel.socket.ServerSocketChannelConfig;
|
|||
* <tr>
|
||||
* <th>Name</th><th>Associated setter method</th>
|
||||
* </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>
|
||||
* </table>
|
||||
*/
|
||||
|
@ -40,10 +42,34 @@ public interface OioServerSocketChannelConfig extends ServerSocketChannelConfig
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelConfig;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.socket.SocketChannelConfig;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +33,7 @@ import io.netty.channel.socket.SocketChannelConfig;
|
|||
* <tr>
|
||||
* <th>Name</th><th>Associated setter method</th>
|
||||
* </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>
|
||||
* </table>
|
||||
*/
|
||||
|
@ -40,10 +42,49 @@ public interface OioSocketChannelConfig extends SocketChannelConfig {
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user