public class UDPDiscoveryService extends Object implements IShutdownObserver, IRequireScheduler
It also creates a sender that periodically broadcasts its availability.
The sender also broadcasts a request for other caches to broadcast their addresses.
| Constructor and Description |
|---|
UDPDiscoveryService(UDPDiscoveryAttributes attributes)
Deprecated.
Specify serializer implementation explicitly
|
UDPDiscoveryService(UDPDiscoveryAttributes attributes,
IElementSerializer serializer)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDiscoveryListener(IDiscoveryListener listener)
Adds a listener.
|
protected void |
addOrUpdateService(DiscoveredService discoveredService)
Add a service to the list.
|
void |
addParticipatingCacheName(String cacheName)
Adds a region to the list that is participating in discovery.
|
protected void |
cleanup()
This goes through the list of services and removes those that we haven't heard from in longer
than the max idle time.
|
protected ArrayList<String> |
getCacheNames()
Get all the cache names we have facades for.
|
Set<IDiscoveryListener> |
getCopyOfDiscoveryListeners() |
Set<DiscoveredService> |
getDiscoveredServices() |
IElementSerializer |
getSerializer()
Return the serializer implementation
|
UDPDiscoveryAttributes |
getUdpDiscoveryAttributes() |
void |
initiateBroadcast()
Initial request that the other caches let it know their addresses.
|
void |
removeDiscoveredService(DiscoveredService service)
Removes the discovered service from the list and calls the discovery listener.
|
boolean |
removeDiscoveryListener(IDiscoveryListener listener)
Removes a listener.
|
protected void |
serviceRequestBroadcast()
Send a passive broadcast in response to a request broadcast.
|
void |
setScheduledExecutorService(ScheduledExecutorService scheduledExecutor)
Inject an instance of a central ScheduledExecutorService
|
void |
setUdpDiscoveryAttributes(UDPDiscoveryAttributes attr) |
void |
shutdown()
Shuts down the receiver.
|
protected void |
shutdownBroadcast()
Issues a remove broadcast to the others.
|
void |
startup()
Start necessary receiver thread
|
@Deprecated public UDPDiscoveryService(UDPDiscoveryAttributes attributes)
attributes - settings of the servicepublic UDPDiscoveryService(UDPDiscoveryAttributes attributes, IElementSerializer serializer)
attributes - settings of serviceserializer - the serializer to use to send and receive messagespublic void setScheduledExecutorService(ScheduledExecutorService scheduledExecutor)
IRequireSchedulersetScheduledExecutorService in interface IRequireSchedulerIRequireScheduler.setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService)protected void cleanup()
public void initiateBroadcast()
protected void serviceRequestBroadcast()
protected void shutdownBroadcast()
public void addParticipatingCacheName(String cacheName)
cacheName - public void removeDiscoveredService(DiscoveredService service)
service - protected void addOrUpdateService(DiscoveredService discoveredService)
discoveredService - discovered serviceprotected ArrayList<String> getCacheNames()
public void setUdpDiscoveryAttributes(UDPDiscoveryAttributes attr)
attr - The UDPDiscoveryAttributes to set.public UDPDiscoveryAttributes getUdpDiscoveryAttributes()
public IElementSerializer getSerializer()
public void startup()
public void shutdown()
shutdown in interface IShutdownObserverpublic Set<DiscoveredService> getDiscoveredServices()
public Set<IDiscoveryListener> getCopyOfDiscoveryListeners()
public boolean addDiscoveryListener(IDiscoveryListener listener)
listener - public boolean removeDiscoveryListener(IDiscoveryListener listener)
listener - Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.