JavaDoc for channel.socket package
This commit is contained in:
parent
bb5c59e816
commit
54e81bde72
@ -26,6 +26,8 @@ import org.jboss.netty.channel.ChannelFactory;
|
|||||||
import org.jboss.netty.channel.ChannelPipeline;
|
import org.jboss.netty.channel.ChannelPipeline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A {@link ChannelFactory} which creates a client-side {@link SocketChannel}.
|
||||||
|
*
|
||||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
* @author Trustin Lee (tlee@redhat.com)
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
*
|
*
|
||||||
|
@ -31,12 +31,23 @@ import org.jboss.netty.channel.ChannelException;
|
|||||||
import org.jboss.netty.channel.ChannelPipelineFactory;
|
import org.jboss.netty.channel.ChannelPipelineFactory;
|
||||||
import org.jboss.netty.util.ConversionUtil;
|
import org.jboss.netty.util.ConversionUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default {@link ServerSocketChannelConfig} implementation.
|
||||||
|
*
|
||||||
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
|
*
|
||||||
|
* @version $Rev$, $Date$
|
||||||
|
*/
|
||||||
public class DefaultServerSocketChannelConfig implements ServerSocketChannelConfig {
|
public class DefaultServerSocketChannelConfig implements ServerSocketChannelConfig {
|
||||||
|
|
||||||
private final ServerSocket socket;
|
private final ServerSocket socket;
|
||||||
private volatile int backlog;
|
private volatile int backlog;
|
||||||
private volatile ChannelPipelineFactory pipelineFactory;
|
private volatile ChannelPipelineFactory pipelineFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance.
|
||||||
|
*/
|
||||||
public DefaultServerSocketChannelConfig(ServerSocket socket) {
|
public DefaultServerSocketChannelConfig(ServerSocket socket) {
|
||||||
if (socket == null) {
|
if (socket == null) {
|
||||||
throw new NullPointerException("socket");
|
throw new NullPointerException("socket");
|
||||||
@ -50,6 +61,10 @@ public class DefaultServerSocketChannelConfig implements ServerSocketChannelConf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an individual option. You can override this method to support
|
||||||
|
* additional configuration parameters.
|
||||||
|
*/
|
||||||
protected boolean setOption(String key, Object value) {
|
protected boolean setOption(String key, Object value) {
|
||||||
if (key.equals("receiveBufferSize")) {
|
if (key.equals("receiveBufferSize")) {
|
||||||
setReceiveBufferSize(ConversionUtil.toInt(value));
|
setReceiveBufferSize(ConversionUtil.toInt(value));
|
||||||
|
@ -31,11 +31,23 @@ import org.jboss.netty.channel.ChannelException;
|
|||||||
import org.jboss.netty.channel.ChannelPipelineFactory;
|
import org.jboss.netty.channel.ChannelPipelineFactory;
|
||||||
import org.jboss.netty.util.ConversionUtil;
|
import org.jboss.netty.util.ConversionUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default {@link SocketChannelConfig} implementation.
|
||||||
|
*
|
||||||
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
|
*
|
||||||
|
* @version $Rev$, $Date$
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class DefaultSocketChannelConfig implements SocketChannelConfig {
|
public class DefaultSocketChannelConfig implements SocketChannelConfig {
|
||||||
|
|
||||||
private final Socket socket;
|
private final Socket socket;
|
||||||
private volatile int connectTimeoutMillis = 10000; // 10 seconds
|
private volatile int connectTimeoutMillis = 10000; // 10 seconds
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance.
|
||||||
|
*/
|
||||||
public DefaultSocketChannelConfig(Socket socket) {
|
public DefaultSocketChannelConfig(Socket socket) {
|
||||||
if (socket == null) {
|
if (socket == null) {
|
||||||
throw new NullPointerException("socket");
|
throw new NullPointerException("socket");
|
||||||
@ -49,6 +61,10 @@ public class DefaultSocketChannelConfig implements SocketChannelConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an individual option. You can override this method to support
|
||||||
|
* additional configuration parameters.
|
||||||
|
*/
|
||||||
protected boolean setOption(String key, Object value) {
|
protected boolean setOption(String key, Object value) {
|
||||||
if (key.equals("receiveBufferSize")) {
|
if (key.equals("receiveBufferSize")) {
|
||||||
setReceiveBufferSize(ConversionUtil.toInt(value));
|
setReceiveBufferSize(ConversionUtil.toInt(value));
|
||||||
|
@ -27,6 +27,9 @@ import java.net.InetSocketAddress;
|
|||||||
import org.jboss.netty.channel.Channel;
|
import org.jboss.netty.channel.Channel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A server-side TCP/IP socket {@link Channel} which accepts incoming TCP/IP
|
||||||
|
* connections.
|
||||||
|
*
|
||||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
* @author Trustin Lee (tlee@redhat.com)
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
*
|
*
|
||||||
|
@ -22,14 +22,55 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.netty.channel.socket;
|
package org.jboss.netty.channel.socket;
|
||||||
|
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
|
||||||
import org.jboss.netty.channel.ChannelConfig;
|
import org.jboss.netty.channel.ChannelConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link ChannelConfig} for a {@link ServerSocketChannel}.
|
||||||
|
*
|
||||||
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
|
*
|
||||||
|
* @version $Rev$, $Date$
|
||||||
|
*/
|
||||||
public interface ServerSocketChannelConfig extends ChannelConfig {
|
public interface ServerSocketChannelConfig extends ChannelConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the backlog value to specify when the channel binds to a local
|
||||||
|
* address.
|
||||||
|
*/
|
||||||
int getBacklog();
|
int getBacklog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the backlog value to specify when the channel binds to a local
|
||||||
|
* address.
|
||||||
|
*/
|
||||||
void setBacklog(int backlog);
|
void setBacklog(int backlog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_REUSEADDR}</a> option.
|
||||||
|
*/
|
||||||
boolean isReuseAddress();
|
boolean isReuseAddress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_REUSEADDR}</a> option.
|
||||||
|
*/
|
||||||
void setReuseAddress(boolean reuseAddress);
|
void setReuseAddress(boolean reuseAddress);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_RCVBUF}</a> option.
|
||||||
|
*/
|
||||||
int getReceiveBufferSize();
|
int getReceiveBufferSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_RCVBUF}</a> option.
|
||||||
|
*/
|
||||||
void setReceiveBufferSize(int receiveBufferSize);
|
void setReceiveBufferSize(int receiveBufferSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the performance preferences as specified in
|
||||||
|
* {@link ServerSocket#setPerformancePreferences(int, int, int)}.
|
||||||
|
*/
|
||||||
void setPerformancePreferences(int connectionTime, int latency, int bandwidth);
|
void setPerformancePreferences(int connectionTime, int latency, int bandwidth);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ import org.jboss.netty.channel.ChannelFactory;
|
|||||||
import org.jboss.netty.channel.ChannelPipeline;
|
import org.jboss.netty.channel.ChannelPipeline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A {@link ChannelFactory} which creates a {@link ServerSocketChannel}.
|
||||||
|
*
|
||||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
* @author Trustin Lee (tlee@redhat.com)
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,9 @@ import java.net.InetSocketAddress;
|
|||||||
import org.jboss.netty.channel.Channel;
|
import org.jboss.netty.channel.Channel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A TCP/IP socket {@link Channel} which was either accepted by
|
||||||
|
* {@link ServerSocketChannel} or created by {@link ClientSocketChannelFactory}.
|
||||||
|
*
|
||||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
* @author Trustin Lee (tlee@redhat.com)
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
*
|
*
|
||||||
|
@ -22,23 +22,95 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.netty.channel.socket;
|
package org.jboss.netty.channel.socket;
|
||||||
|
|
||||||
|
import java.net.Socket;
|
||||||
|
|
||||||
import org.jboss.netty.channel.ChannelConfig;
|
import org.jboss.netty.channel.ChannelConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link ChannelConfig} for a {@link SocketChannel}.
|
||||||
|
*
|
||||||
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
|
*
|
||||||
|
* @version $Rev$, $Date$
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface SocketChannelConfig extends ChannelConfig {
|
public interface SocketChannelConfig extends ChannelConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_TCPNODELAY}</a> option.
|
||||||
|
*/
|
||||||
boolean isTcpNoDelay();
|
boolean isTcpNoDelay();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_TCPNODELAY}</a> option.
|
||||||
|
*/
|
||||||
void setTcpNoDelay(boolean tcpNoDelay);
|
void setTcpNoDelay(boolean tcpNoDelay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_LINGER}</a> option.
|
||||||
|
*/
|
||||||
int getSoLinger();
|
int getSoLinger();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_LINGER}</a> option.
|
||||||
|
*/
|
||||||
void setSoLinger(int soLinger);
|
void setSoLinger(int soLinger);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_SNDBUF}</a> option.
|
||||||
|
*/
|
||||||
int getSendBufferSize();
|
int getSendBufferSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_SNDBUF}</a> option.
|
||||||
|
*/
|
||||||
void setSendBufferSize(int sendBufferSize);
|
void setSendBufferSize(int sendBufferSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_RCVBUF}</a> option.
|
||||||
|
*/
|
||||||
int getReceiveBufferSize();
|
int getReceiveBufferSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_RCVBUF}</a> option.
|
||||||
|
*/
|
||||||
void setReceiveBufferSize(int receiveBufferSize);
|
void setReceiveBufferSize(int receiveBufferSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_KEEPALIVE}</a> option.
|
||||||
|
*/
|
||||||
boolean isKeepAlive();
|
boolean isKeepAlive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_KEEPALIVE}</a> option.
|
||||||
|
*/
|
||||||
void setKeepAlive(boolean keepAlive);
|
void setKeepAlive(boolean keepAlive);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the traffic class.
|
||||||
|
*/
|
||||||
int getTrafficClass();
|
int getTrafficClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the traffic class as specified in {@link Socket#setTrafficClass(int)}.
|
||||||
|
*/
|
||||||
void setTrafficClass(int trafficClass);
|
void setTrafficClass(int trafficClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_REUSEADDR}</a> option.
|
||||||
|
*/
|
||||||
boolean isReuseAddress();
|
boolean isReuseAddress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_REUSEADDR}</a> option.
|
||||||
|
*/
|
||||||
void setReuseAddress(boolean reuseAddress);
|
void setReuseAddress(boolean reuseAddress);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the performance preferences as specified in
|
||||||
|
* {@link Socket#setPerformancePreferences(int, int, int)}.
|
||||||
|
*/
|
||||||
void setPerformancePreferences(
|
void setPerformancePreferences(
|
||||||
int connectionTime, int latency, int bandwidth);
|
int connectionTime, int latency, int bandwidth);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user