equal
deleted
inserted
replaced
1023 * @since 9 |
1023 * @since 9 |
1024 */ |
1024 */ |
1025 public <T> ServerSocket setOption(SocketOption<T> name, T value) |
1025 public <T> ServerSocket setOption(SocketOption<T> name, T value) |
1026 throws IOException |
1026 throws IOException |
1027 { |
1027 { |
|
1028 Objects.requireNonNull(name); |
|
1029 if (isClosed()) |
|
1030 throw new SocketException("Socket is closed"); |
1028 getImpl().setOption(name, value); |
1031 getImpl().setOption(name, value); |
1029 return this; |
1032 return this; |
1030 } |
1033 } |
1031 |
1034 |
1032 /** |
1035 /** |
1051 * do not require any security permission. |
1054 * do not require any security permission. |
1052 * |
1055 * |
1053 * @since 9 |
1056 * @since 9 |
1054 */ |
1057 */ |
1055 public <T> T getOption(SocketOption<T> name) throws IOException { |
1058 public <T> T getOption(SocketOption<T> name) throws IOException { |
|
1059 Objects.requireNonNull(name); |
|
1060 if (isClosed()) |
|
1061 throw new SocketException("Socket is closed"); |
1056 return getImpl().getOption(name); |
1062 return getImpl().getOption(name); |
1057 } |
1063 } |
1058 |
1064 |
1059 // cache of unmodifiable impl options. Possibly set racy, in impl we trust |
1065 // cache of unmodifiable impl options. Possibly set racy, in impl we trust |
1060 private volatile Set<SocketOption<?>> options; |
1066 private volatile Set<SocketOption<?>> options; |