Interface NetworkAddressChangeListener


  • @NonNullByDefault
    public interface NetworkAddressChangeListener
    This is an interface for listeners who wants to be notified for the change of network address. There are only network address adds, and removes; it makes no effort to correlate which existing network is changed. Listeners should register themselves at the NetworkAddressService.
    Author:
    Gary Tse - Initial contribution, Tim Roberts - Added primary address change
    See Also:
    NetUtil
    • Method Detail

      • onChanged

        void onChanged​(List<CidrAddress> added,
                       List<CidrAddress> removed)
        When network address is changed, listeners will be notified by this method. When a network interface changes from "up" to "down", it is considered as "removed". When a "loopback" or "down" interface is added, the listeners are not notified.
        Parameters:
        added - Unmodifiable list of recently added network addresses
        removed - Unmodifiable list of recently removed network addresses
      • onPrimaryAddressChanged

        default void onPrimaryAddressChanged​(@Nullable String oldPrimaryAddress,
                                             @Nullable String newPrimaryAddress)
        When the primary address is changed, listeners will be notified by this method. The primary address will be in the form of a subnet ("xxx.xxx.xxx.xxx/yyy").
        Parameters:
        oldPrimaryAddress - The old primary address (may be null if none specified)
        newPrimaryAddress - The new primary address (may be null if none specified)