Class UDPDiscoverySender
java.lang.Object
org.apache.commons.jcs3.utils.discovery.UDPDiscoverySender
- All Implemented Interfaces:
- AutoCloseable
This is a generic sender for the UDPDiscovery process.
- 
Constructor SummaryConstructorsConstructorDescriptionUDPDiscoverySender(String host, int port, int udpTTL) Deprecated.Specify serializer implementation explicitlyUDPDiscoverySender(String mcastInterface, String host, int port, int udpTTL, IElementSerializer serializer) Constructor for the UDPDiscoverySender objectUDPDiscoverySender(UDPDiscoveryAttributes udpDiscoveryAttributes, IElementSerializer serializer) Constructor for the UDPDiscoverySender object
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes the socket connection.voidpassiveBroadcast(String host, int port, ArrayList<String> cacheNames) This sends a message broadcasting out that the host and port is available for connections.protected voidpassiveBroadcast(String host, int port, ArrayList<String> cacheNames, long listenerId) This allows you to set the sender id.voidremoveBroadcast(String host, int port, ArrayList<String> cacheNames) This sends a message broadcasting our that the host and port is no longer available.protected voidremoveBroadcast(String host, int port, ArrayList<String> cacheNames, long listenerId) This allows you to set the sender id.voidAsk other to broadcast their info the multicast address.voidsend(UDPDiscoveryMessage message) Send messages.
- 
Constructor Details- 
UDPDiscoverySenderDeprecated.Specify serializer implementation explicitlyConstructor for the UDPDiscoverySender objectThis sender can be used to send multiple messages. When you are done sending, you should destroy the socket sender. - Parameters:
- host-
- port-
- udpTTL- the Datagram packet time-to-live
- Throws:
- IOException
 
- 
UDPDiscoverySenderpublic UDPDiscoverySender(UDPDiscoveryAttributes udpDiscoveryAttributes, IElementSerializer serializer) throws IOException Constructor for the UDPDiscoverySender objectThis sender can be used to send multiple messages. When you are done sending, you should destroy the socket sender. - Parameters:
- udpDiscoveryAttributes- configuration object
- serializer- the Serializer to use when sending messages
- Throws:
- IOException
- Since:
- 3.1
 
- 
UDPDiscoverySenderpublic UDPDiscoverySender(String mcastInterface, String host, int port, int udpTTL, IElementSerializer serializer) throws IOException Constructor for the UDPDiscoverySender objectThis sender can be used to send multiple messages. When you are done sending, you should destroy the socket sender. - Parameters:
- mcastInterface- the Multicast interface name to use, if null, try to autodetect
- host-
- port-
- udpTTL- the Datagram packet time-to-live
- serializer- the Serializer to use when sending messages
- Throws:
- IOException
- Since:
- 3.1
 
 
- 
- 
Method Details- 
closeCloses the socket connection.- Specified by:
- closein interface- AutoCloseable
 
- 
sendSend messages.- Parameters:
- message-
- Throws:
- IOException
 
- 
requestBroadcastAsk other to broadcast their info the multicast address. If a lateral is non receiving it can use this. This is also called on startup so we can get info.- Throws:
- IOException
 
- 
passiveBroadcastpublic void passiveBroadcast(String host, int port, ArrayList<String> cacheNames) throws IOException This sends a message broadcasting out that the host and port is available for connections.It uses the vmid as the requesterDI - Parameters:
- host-
- port-
- cacheNames-
- Throws:
- IOException
 
- 
passiveBroadcastprotected void passiveBroadcast(String host, int port, ArrayList<String> cacheNames, long listenerId) throws IOException This allows you to set the sender id. This is mainly for testing.- Parameters:
- host-
- port-
- cacheNames- names of the cache regions
- listenerId-
- Throws:
- IOException
 
- 
removeBroadcastThis sends a message broadcasting our that the host and port is no longer available.It uses the vmid as the requesterID - Parameters:
- host- host
- port- port
- cacheNames- names of the cache regions
- Throws:
- IOException- on error
 
- 
removeBroadcastprotected void removeBroadcast(String host, int port, ArrayList<String> cacheNames, long listenerId) throws IOException This allows you to set the sender id. This is mainly for testing.- Parameters:
- host- host
- port- port
- cacheNames- names of the cache regions
- listenerId- listener ID
- Throws:
- IOException- on error
 
 
-