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 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-liveIOException
public 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 messagesIOException
public 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 messagesIOException
public void close()
close
in interface AutoCloseable
public void send(UDPDiscoveryMessage message) throws IOException
message
- IOException
public void requestBroadcast() throws IOException
IOException
public void passiveBroadcast(String host, int port, ArrayList<String> cacheNames) throws IOException
It uses the vmid as the requesterDI
host
- port
- cacheNames
- IOException
protected void passiveBroadcast(String host, int port, ArrayList<String> cacheNames, long listenerId) throws IOException
host
- port
- cacheNames
- names of the cache regionslistenerId
- IOException
public 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–2023 The Apache Software Foundation. All rights reserved.