-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- Enclosing interface:
- MulticastMessageChannel
public static interface MulticastMessageChannel.Key extends java.io.Closeable
A registration key for a multicast group.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MulticastMessageChannel.Key
block(java.net.InetAddress source)
Block multicast packets from the given source address.MulticastMessageChannel
getChannel()
Return the channel associated with this key.java.net.InetAddress
getGroup()
Return the multicast group for which this key was created.java.net.NetworkInterface
getNetworkInterface()
Return the network interface for which this key was created.java.net.InetAddress
getSourceAddress()
Return the source address if this membership key is source specific, ornull
if this membership is not source specific.boolean
isOpen()
Determine if this membership is active.MulticastMessageChannel.Key
unblock(java.net.InetAddress source)
Unblock multicast packets from the given source address that was previously blocked using theblock(InetAddress)
method.
-
-
-
Method Detail
-
block
MulticastMessageChannel.Key block(java.net.InetAddress source) throws java.io.IOException, java.lang.UnsupportedOperationException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
Block multicast packets from the given source address. If this membership key is not source-specific, and the implementation supports source filtering, then this method blocks multicast packets from the given source addresses. After a source address is blocked it may still be possible to receive datagrams from that source. This can arise when datagrams are waiting to be received in the socket's receive buffer.- Parameters:
source
- the source address to block- Returns:
- this key
- Throws:
java.io.IOException
- if an I/O error occursjava.lang.UnsupportedOperationException
- if the implementation does not support source filteringjava.lang.IllegalStateException
- if this key is source-specific or is no longer validjava.lang.IllegalArgumentException
- if thesource
parameter is not a unicast address or is not the same address type as the multicast group
-
unblock
MulticastMessageChannel.Key unblock(java.net.InetAddress source) throws java.io.IOException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException
Unblock multicast packets from the given source address that was previously blocked using theblock(InetAddress)
method.- Parameters:
source
- the source address to unblock- Returns:
- this key
- Throws:
java.io.IOException
- if an I/O error occursjava.lang.IllegalStateException
- if the given source address is not currently blocked or the key is no longer validjava.lang.UnsupportedOperationException
- if the implementation does not support source filtering
-
getChannel
MulticastMessageChannel getChannel()
Return the channel associated with this key. This method will return the channel even after the membership is dropped.- Returns:
- the channel
-
getGroup
java.net.InetAddress getGroup()
Return the multicast group for which this key was created. This method will continue to return the group even after the membership is dropped.- Returns:
- the multicast group
-
getNetworkInterface
java.net.NetworkInterface getNetworkInterface()
Return the network interface for which this key was created. This method will continue to return the network interface even after the membership is dropped or the channel is closed.- Returns:
- the network interface
-
getSourceAddress
java.net.InetAddress getSourceAddress()
Return the source address if this membership key is source specific, ornull
if this membership is not source specific.- Returns:
- the source address
-
isOpen
boolean isOpen()
Determine if this membership is active.- Returns:
true
if the membership is still active
-
-