JEP 125: Network Interface Aliases, Events, and Defaults
|Discussion||net dash dev at openjdk dot java dot net|
Extend the existing network-interface APIs to support interface aliases, up/down transition events, and default interface preferences.
These enhancements will allow Java SE to work well in devices with multiple network interface types (e.g., both wifi and cellular) whose status varies over time depending upon the networks available.
Define aliasing support so that network interfaces can be referred to by well-known names such as “cellular” rather than hardware platform-specific OS device names.
Provide the ability to listen for network interface up/down transitions.
Provide an API to list one or more default network interfaces that will be used when sockets are created if the socket being created is not bound to a specific local address (and hence network interface). This needs to be done in such a way that socket creation performed by library code on behalf of the application will be affected as well. In other words, if an application is using, say, the JAX-RS client API, the socket(s) created by the JAX-RS implementation should be affected by this API. If a list of more than one interfaces is provided, it should be treated as an ordered preference list. Ideally it should be possible to provide this API in such a way as to allow different applications running within the same VM to have different default network interface settings.
Solving this problem may depend on some higher level abstraction of an application being defined in Java SE 8. Otherwise, it would depend on some existing entity like class loaders.
- Portability: It is not clear at this stage how easy this will be to implement and how reliant it will be on services available on particular operating systems.