- java.lang.Object
-
- jdk.net.SocketFlow
-
public class SocketFlow extends Object
Represents the service level properties for the platform specific socket optionExtendedSocketOptions.SO_FLOW_SLA
.The priority and bandwidth parameters must be set before setting the socket option.
When the
SO_FLOW_SLA
option is set then it may not take effect immediately. If the value of the socket option is obtained withgetOption()
then the status may be returned asINPROGRESS
until it takes effect. The priority and bandwidth values are only valid when the status is returned as OK.When a security manager is installed, a
NetworkPermission
is required to set or get this option.- Since:
- 1.8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SocketFlow.Status
Enumeration of the return values from the SO_FLOW_SLA socket option.
-
Field Summary
Fields Modifier and Type Field Description static int
HIGH_PRIORITY
static int
NORMAL_PRIORITY
static int
UNSET
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
bandwidth()
Returns this SocketFlow's bandwidth.SocketFlow
bandwidth(long bandwidth)
Sets this SocketFlow's bandwidth.static SocketFlow
create()
Creates a new SocketFlow that can be used to set the SO_FLOW_SLA socket option and create a socket flow.int
priority()
Returns this SocketFlow's priority.SocketFlow
priority(int priority)
Sets this SocketFlow's priority.SocketFlow.Status
status()
Returns the Status value of this SocketFlow.String
toString()
Returns a string representation of the object.
-
-
-
Field Detail
-
UNSET
@Native public static final int UNSET
- See Also:
- Constant Field Values
-
NORMAL_PRIORITY
@Native public static final int NORMAL_PRIORITY
- See Also:
- Constant Field Values
-
HIGH_PRIORITY
@Native public static final int HIGH_PRIORITY
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static SocketFlow create()
Creates a new SocketFlow that can be used to set the SO_FLOW_SLA socket option and create a socket flow.
-
priority
public SocketFlow priority(int priority)
Sets this SocketFlow's priority. Must be either NORMAL_PRIORITY HIGH_PRIORITY. If not set, a flow's priority is normal.- Throws:
IllegalArgumentException
- if priority is not NORMAL_PRIORITY or HIGH_PRIORITY.
-
bandwidth
public SocketFlow bandwidth(long bandwidth)
Sets this SocketFlow's bandwidth. Must be greater than or equal to zero. A value of zero drops all packets for the socket.- Throws:
IllegalArgumentException
- if bandwidth is less than zero.
-
priority
public int priority()
Returns this SocketFlow's priority.
-
bandwidth
public long bandwidth()
Returns this SocketFlow's bandwidth.- Returns:
- this SocketFlow's bandwidth, or
-1
if status is not OK.
-
status
public SocketFlow.Status status()
Returns the Status value of this SocketFlow. NO_STATUS is returned if the object was not used in a call to set or get the option.
-
toString
public String toString()
Description copied from class:Object
Returns a string representation of the object. In general, thetoString
method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.The
toString
method for classObject
returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@
', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:getClass().getName() + '@' + Integer.toHexString(hashCode())
-
-