public class UDPDiscoverySender extends Object
Constructor and Description |
---|
UDPDiscoverySender(String host,
int port)
Constructor for the UDPDiscoverySender object
This sender can be used to send multiple messages.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Closes the socket connection.
|
protected void |
finalize()
Just being careful about closing the socket.
|
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.
|
public UDPDiscoverySender(String host, int port) throws IOException
This sender can be used to send multiple messages.
When you are done sending, you should destroy the socket sender.
host
- port
- IOException
public void destroy()
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–2018 The Apache Software Foundation. All rights reserved.