@Override
public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
java类java.net.SocketOption的实例源码
AsynchronousServerSocketChannelImpl.java 文件源码
项目:OpenJSharp
阅读 17
收藏 0
点赞 0
评论 0
AsynchronousServerSocketChannelImpl.java 文件源码
项目:OpenJSharp
阅读 26
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:OpenJSharp
阅读 27
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (writeShutdown)
throw new IOException("Connection has been shutdown for writing");
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:OpenJSharp
阅读 18
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:jdk8u-jdk
阅读 21
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:jdk8u-jdk
阅读 20
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:jdk8u-jdk
阅读 17
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (writeShutdown)
throw new IOException("Connection has been shutdown for writing");
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:jdk8u-jdk
阅读 19
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:openjdk-jdk10
阅读 15
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (writeShutdown)
throw new IOException("Connection has been shutdown for writing");
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:openjdk-jdk10
阅读 17
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
ExtendedSocketOptions.java 文件源码
项目:openjdk-jdk10
阅读 14
收藏 0
点赞 0
评论 0
@Override
public void setOption(FileDescriptor fd,
SocketOption<?> option,
Object value)
throws SocketException
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new NetworkPermission("setOption." + option.name()));
if (fd == null || !fd.valid())
throw new SocketException("socket closed");
if (option == SO_FLOW_SLA) {
assert flowSupported;
SocketFlow flow = checkValueType(value, option.type());
setFlowOption(fd, flow);
} else {
throw new InternalError("Unexpected option " + option);
}
}
ExtendedSocketOptions.java 文件源码
项目:openjdk-jdk10
阅读 15
收藏 0
点赞 0
评论 0
@Override
public Object getOption(FileDescriptor fd,
SocketOption<?> option)
throws SocketException
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new NetworkPermission("getOption." + option.name()));
if (fd == null || !fd.valid())
throw new SocketException("socket closed");
if (option == SO_FLOW_SLA) {
assert flowSupported;
SocketFlow flow = SocketFlow.create();
getFlowOption(fd, flow);
return flow;
} else {
throw new InternalError("Unexpected option " + option);
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:openjdk9
阅读 18
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:openjdk9
阅读 20
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:openjdk9
阅读 21
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (writeShutdown)
throw new IOException("Connection has been shutdown for writing");
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:openjdk9
阅读 18
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
ExtendedSocketOptions.java 文件源码
项目:openjdk9
阅读 14
收藏 0
点赞 0
评论 0
@Override
public void setOption(FileDescriptor fd,
SocketOption<?> option,
Object value)
throws SocketException
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new NetworkPermission("setOption." + option.name()));
if (fd == null || !fd.valid())
throw new SocketException("socket closed");
if (option == SO_FLOW_SLA) {
assert flowSupported;
SocketFlow flow = checkValueType(value, option.type());
setFlowOption(fd, flow);
} else {
throw new InternalError("Unexpected option " + option);
}
}
ExtendedSocketOptions.java 文件源码
项目:openjdk9
阅读 15
收藏 0
点赞 0
评论 0
@Override
public Object getOption(FileDescriptor fd,
SocketOption<?> option)
throws SocketException
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new NetworkPermission("getOption." + option.name()));
if (fd == null || !fd.valid())
throw new SocketException("socket closed");
if (option == SO_FLOW_SLA) {
assert flowSupported;
SocketFlow flow = SocketFlow.create();
getFlowOption(fd, flow);
return flow;
} else {
throw new InternalError("Unexpected option " + option);
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:jdk8u_jdk
阅读 21
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:jdk8u_jdk
阅读 19
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:jdk8u_jdk
阅读 23
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (writeShutdown)
throw new IOException("Connection has been shutdown for writing");
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:jdk8u_jdk
阅读 18
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 21
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousServerSocketChannelImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 19
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 22
收藏 0
点赞 0
评论 0
@Override
public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value)
throws IOException
{
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (writeShutdown)
throw new IOException("Connection has been shutdown for writing");
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = (Boolean)value;
} else {
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
return this;
} finally {
end();
}
}
AsynchronousSocketChannelImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 20
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public final <T> T getOption(SocketOption<T> name) throws IOException {
if (name == null)
throw new NullPointerException();
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
try {
begin();
if (name == StandardSocketOptions.SO_REUSEADDR &&
Net.useExclusiveBind())
{
// SO_REUSEADDR emulated when using exclusive bind
return (T)Boolean.valueOf(isReuseAddress);
}
return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
} finally {
end();
}
}
NioUtils.java 文件源码
项目:j2objc
阅读 16
收藏 0
点赞 0
评论 0
/**
* Sets the supplied option on the channel to have the value if option is a member of
* allowedOptions.
*
* @throws IOException
* if the value could not be set due to IO errors.
* @throws IllegalArgumentException
* if the socket option or the value is invalid.
* @throws UnsupportedOperationException
* if the option is not a member of allowedOptions.
* @throws ClosedChannelException
* if the channel is closed
*/
public static <T> void setSocketOption(
FileDescriptorChannel channel, Set<SocketOption<?>> allowedOptions,
SocketOption<T> option, T value)
throws IOException {
if (!(option instanceof StandardSocketOptions.SocketOptionImpl)) {
throw new IllegalArgumentException("SocketOption must come from StandardSocketOptions");
}
if (!allowedOptions.contains(option)) {
throw new UnsupportedOperationException(
option + " is not supported for this type of socket");
}
if (!channel.getFD().valid()) {
throw new ClosedChannelException();
}
((StandardSocketOptions.SocketOptionImpl<T>) option).setValue(channel.getFD(), value);
}
NioUtils.java 文件源码
项目:j2objc
阅读 14
收藏 0
点赞 0
评论 0
/**
* Gets the supplied option from the channel if option is a member of allowedOptions.
*
* @throws IOException
* if the value could not be read due to IO errors.
* @throws IllegalArgumentException
* if the socket option is invalid.
* @throws UnsupportedOperationException
* if the option is not a member of allowedOptions.
* @throws ClosedChannelException
* if the channel is closed
*/
public static <T> T getSocketOption(
FileDescriptorChannel channel, Set<SocketOption<?>> allowedOptions,
SocketOption<T> option)
throws IOException {
if (!(option instanceof StandardSocketOptions.SocketOptionImpl)) {
throw new IllegalArgumentException("SocketOption must come from StandardSocketOptions");
}
if (!allowedOptions.contains(option)) {
throw new UnsupportedOperationException(
option + " is not supported for this type of socket");
}
if (!channel.getFD().valid()) {
throw new ClosedChannelException();
}
return ((StandardSocketOptions.SocketOptionImpl<T>) option).getValue(channel.getFD());
}