public class UDPDiscoverySender extends Object implements AutoCloseable
| Constructor and Description |
|---|
UDPDiscoverySender(String host,
int port,
int udpTTL)
Deprecated.
Specify serializer implementation explicitly
|
UDPDiscoverySender(String mcastInterface,
String host,
int port,
int udpTTL,
IElementSerializer serializer)
Constructor for the UDPDiscoverySender object
This sender can be used to send multiple messages.
|
UDPDiscoverySender(UDPDiscoveryAttributes udpDiscoveryAttributes,
IElementSerializer serializer)
Constructor for the UDPDiscoverySender object
This sender can be used to send multiple messages.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the socket connection.
|
void |
passiveBroadcast(String host,
int port,
ArrayList<String> cacheNames)
This sends a message broadcasting out that the host and port is available for connections.
|
protected void |
passiveBroadcast(String host,
int port,
ArrayList<String> cacheNames,
long listenerId)
This allows you to set the sender id.
|
void |
removeBroadcast(String host,
int port,
ArrayList<String> cacheNames)
This sends a message broadcasting our that the host and port is no longer available.
|
protected void |
removeBroadcast(String host,
int port,
ArrayList<String> cacheNames,
long listenerId)
This allows you to set the sender id.
|
void |
requestBroadcast()
Ask other to broadcast their info the the multicast address.
|
void |
send(UDPDiscoveryMessage message)
Send messages.
|
@Deprecated public UDPDiscoverySender(String host, int port, int udpTTL) throws IOException
This sender can be used to send multiple messages.
When you are done sending, you should destroy the socket sender.
host - port - udpTTL - the Datagram packet time-to-liveIOExceptionpublic UDPDiscoverySender(UDPDiscoveryAttributes udpDiscoveryAttributes, IElementSerializer serializer) throws IOException
This sender can be used to send multiple messages.
When you are done sending, you should destroy the socket sender.
udpDiscoveryAttributes - configuration objectserializer - the Serializer to use when sending messagesIOExceptionpublic UDPDiscoverySender(String mcastInterface, String host, int port, int udpTTL, IElementSerializer serializer) throws IOException
This sender can be used to send multiple messages.
When you are done sending, you should destroy the socket sender.
mcastInterface - the Multicast interface name to use, if null, try to autodetecthost - port - udpTTL - the Datagram packet time-to-liveserializer - the Serializer to use when sending messagesIOExceptionpublic void close()
close in interface AutoCloseablepublic void send(UDPDiscoveryMessage message) throws IOException
message - IOExceptionpublic void requestBroadcast()
throws IOException
IOExceptionpublic void passiveBroadcast(String host, int port, ArrayList<String> cacheNames) throws IOException
It uses the vmid as the requesterDI
host - port - cacheNames - IOExceptionprotected void passiveBroadcast(String host, int port, ArrayList<String> cacheNames, long listenerId) throws IOException
host - port - cacheNames - names of the cache regionslistenerId - IOExceptionpublic void removeBroadcast(String host, int port, ArrayList<String> cacheNames) throws IOException
It uses the vmid as the requesterID
host - hostport - portcacheNames - names of the cache regionsIOException - on errorprotected void removeBroadcast(String host, int port, ArrayList<String> cacheNames, long listenerId) throws IOException
host - hostport - portcacheNames - names of the cache regionslistenerId - listener IDIOException - on errorCopyright © 2002–2022 The Apache Software Foundation. All rights reserved.