--- old/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java 2020-01-14 19:13:49.000000000 +0000 +++ new/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java 2020-01-14 19:13:49.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -1585,6 +1585,22 @@ } /** + * Finds an existing membership of a multicast group. Returns null if this + * channel's socket is not a member of the group. + * + * @apiNote This method is for use by the socket adaptor + */ + MembershipKey findMembership(InetAddress group, NetworkInterface interf) { + synchronized (stateLock) { + if (registry != null) { + return registry.checkMembership(group, interf, null); + } else { + return null; + } + } + } + + /** * Block datagrams from the given source. */ void block(MembershipKeyImpl key, InetAddress source)