Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
8244582: Remove terminally deprecated Solaris-specific SO_FLOW_SLA so…
Browse files Browse the repository at this point in the history
…cket option

This patch removes ExtendedSocketOptions.SO_FLOW_SLA, SocketFlow and SocketFlow.Status which were terminally deprecated in JDK 14 in preparation for the removal of the Solaris port.

Reviewed-by: alanb, dfuchs, chegar, vtewari
  • Loading branch information
pconcannon committed Jun 5, 2020
1 parent 4d75aef commit d071ed0
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 657 deletions.
72 changes: 2 additions & 70 deletions src/jdk.net/share/classes/jdk/net/ExtendedSocketOptions.java
Expand Up @@ -59,19 +59,6 @@ private static class ExtSocketOption<T> implements SocketOption<T> {

private ExtendedSocketOptions() { }

/**
* Service level properties. When a security manager is installed,
* setting or getting this option requires a {@link NetworkPermission}
* {@code ("setOption.SO_FLOW_SLA")} or {@code "getOption.SO_FLOW_SLA"}
* respectively.
* @deprecated This is supported only on Solaris. Due to deprecation
* of Solaris port, this option is also deprecated.
*/
@Deprecated(since="14", forRemoval=true)
@SuppressWarnings("removal")
public static final SocketOption<SocketFlow> SO_FLOW_SLA = new
ExtSocketOption<SocketFlow>("SO_FLOW_SLA", SocketFlow.class);

/**
* Disable Delayed Acknowledgements.
*
Expand Down Expand Up @@ -196,8 +183,6 @@ private ExtendedSocketOptions() { }
private static final PlatformSocketOptions platformSocketOptions =
PlatformSocketOptions.get();

private static final boolean flowSupported =
platformSocketOptions.flowSupported();
private static final boolean quickAckSupported =
platformSocketOptions.quickAckSupported();
private static final boolean keepAliveOptSupported =
Expand All @@ -208,9 +193,6 @@ private ExtendedSocketOptions() { }

static Set<SocketOption<?>> options() {
Set<SocketOption<?>> options = new HashSet<>();
if (flowSupported) {
options.add(SO_FLOW_SLA);
}
if (quickAckSupported) {
options.add(TCP_QUICKACK);
}
Expand Down Expand Up @@ -242,11 +224,7 @@ public void setOption(FileDescriptor fd,
if (fd == null || !fd.valid())
throw new SocketException("socket closed");

if (option == SO_FLOW_SLA) {
assert flowSupported;
SocketFlow flow = checkValueType(value, SocketFlow.class);
setFlowOption(fd, flow);
} else if (option == TCP_QUICKACK) {
if (option == TCP_QUICKACK) {
setQuickAckOption(fd, (boolean) value);
} else if (option == TCP_KEEPCOUNT) {
setTcpkeepAliveProbes(fd, (Integer) value);
Expand Down Expand Up @@ -277,12 +255,7 @@ public Object getOption(FileDescriptor fd,
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 if (option == TCP_QUICKACK) {
if (option == TCP_QUICKACK) {
return getQuickAckOption(fd);
} else if (option == TCP_KEEPCOUNT) {
return getTcpkeepAliveProbes(fd);
Expand All @@ -299,35 +272,9 @@ public Object getOption(FileDescriptor fd,
});
}

@SuppressWarnings("unchecked")
private static <T> T checkValueType(Object value, Class<T> type) {
if (!type.isAssignableFrom(value.getClass())) {
String s = "Found: " + value.getClass() + ", Expected: " + type;
throw new IllegalArgumentException(s);
}
return (T) value;
}

private static final JavaIOFileDescriptorAccess fdAccess =
SharedSecrets.getJavaIOFileDescriptorAccess();

@SuppressWarnings("removal")
private static void setFlowOption(FileDescriptor fd, SocketFlow f)
throws SocketException
{
int status = platformSocketOptions.setFlowOption(fdAccess.get(fd),
f.priority(),
f.bandwidth());
f.status(status); // augment the given flow with the status
}

@SuppressWarnings("removal")
private static void getFlowOption(FileDescriptor fd, SocketFlow f)
throws SocketException {
int status = platformSocketOptions.getFlowOption(fdAccess.get(fd), f);
f.status(status); // augment the given flow with the status
}

private static void setQuickAckOption(FileDescriptor fd, boolean enable)
throws SocketException {
platformSocketOptions.setQuickAck(fdAccess.get(fd), enable);
Expand Down Expand Up @@ -406,21 +353,6 @@ static PlatformSocketOptions get() {
return instance;
}

int setFlowOption(int fd, int priority, long bandwidth)
throws SocketException
{
throw new UnsupportedOperationException("unsupported socket option");
}

@SuppressWarnings("removal")
int getFlowOption(int fd, SocketFlow f) throws SocketException {
throw new UnsupportedOperationException("unsupported socket option");
}

boolean flowSupported() {
return false;
}

void setQuickAck(int fd, boolean on) throws SocketException {
throw new UnsupportedOperationException("unsupported TCP_QUICKACK option");
}
Expand Down
32 changes: 1 addition & 31 deletions src/jdk.net/share/classes/jdk/net/NetworkPermission.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -31,36 +31,6 @@
* Represents permission to access the extended networking capabilities
* defined in the jdk.net package. These permissions contain a target
* name, but no actions list. Callers either possess the permission or not.
* <p>
* The following targets are defined:
*
* <table class="striped"><caption style="display:none">permission target name,
* what the target allows,and associated risks</caption>
* <thead>
* <tr>
* <th scope="col">Permission Target Name</th>
* <th scope="col">What the Permission Allows</th>
* <th scope="col">Risks of Allowing this Permission</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <th scope="row">setOption.SO_FLOW_SLA</th>
* <td>set the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} option
* on any socket that supports it</td>
* <td>allows caller to set a higher priority or bandwidth allocation
* to sockets it creates, than they might otherwise be allowed.
* This permission is deprecated.</td>
* </tr>
* <tr>
* <th scope="row">getOption.SO_FLOW_SLA</th>
* <td>retrieve the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA}
* setting from any socket that supports the option</td>
* <td>allows caller access to SLA information that it might not
* otherwise have. This permission is deprecated.</td>
* </tr>
* </tbody>
* </table>
*
* @see jdk.net.ExtendedSocketOptions
*
Expand Down
208 changes: 0 additions & 208 deletions src/jdk.net/share/classes/jdk/net/SocketFlow.java

This file was deleted.

0 comments on commit d071ed0

Please sign in to comment.