Skip to content

Commit

Permalink
Merge pull request belaban#846 from snyderra/master
Browse files Browse the repository at this point in the history
add set cache method in Util
  • Loading branch information
belaban authored Oct 17, 2024
2 parents 4948b3a + 7bb58c8 commit 0424b0b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/org/jgroups/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -4742,6 +4742,14 @@ public static void resetCacheAddresses(boolean reset_interfaces, boolean reset_a
CACHED_ADDRESSES=null;
}

/** This is a workaround for use within android. Sometimes the standard java methods do not return all the addresses.
* This will allow for setting in android via the conectivity manager without needing to pass in the context.
* Also will allow android to update as connectivity changes.
*/
public static void setCacheAddresses(List<NetworkInterface> interfaces, List<InetAddress> addresses) {
CACHED_INTERFACES=interfaces;
CACHED_ADDRESSES=addresses;
}
/** Returns all addresses of all interfaces (that are up) that satisfy a given filter (ignored if null) */
public static Collection<InetAddress> getAllAvailableAddresses(Predicate<InetAddress> filter) {
Collection<InetAddress> cached_addresses=getAllAvailableAddresses();
Expand Down

0 comments on commit 0424b0b

Please sign in to comment.