Class UDPDiscoveryService
java.lang.Object
org.apache.commons.jcs3.utils.discovery.UDPDiscoveryService
- All Implemented Interfaces:
- IRequireScheduler,- IShutdownObserver
This service creates a listener that can create lateral caches and add them to the no wait list.
 
It also creates a sender that periodically broadcasts its availability.
The sender also broadcasts a request for other caches to broadcast their addresses.
- 
Constructor SummaryConstructorsConstructorDescriptionUDPDiscoveryService(UDPDiscoveryAttributes attributes) Deprecated.Specify serializer implementation explicitlyUDPDiscoveryService(UDPDiscoveryAttributes attributes, IElementSerializer serializer) Constructor
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaddDiscoveryListener(IDiscoveryListener listener) Adds a listener.protected voidaddOrUpdateService(DiscoveredService discoveredService) Add a service to the list.voidaddParticipatingCacheName(String cacheName) Adds a region to the list that is participating in discovery.protected voidcleanup()This goes through the list of services and removes those that we haven't heard from in longer than the max idle time.Get all the cache names we have facades for.Return the serializer implementationvoidInitial request that the other caches let it know their addresses.voidremoveDiscoveredService(DiscoveredService service) Removes the discovered service from the list and calls the discovery listener.booleanremoveDiscoveryListener(IDiscoveryListener listener) Removes a listener.protected voidSend a passive broadcast in response to a request broadcast.voidsetScheduledExecutorService(ScheduledExecutorService scheduledExecutor) Inject an instance of a central ScheduledExecutorServicevoidvoidshutdown()Shuts down the receiver.protected voidIssues a remove broadcast to the others.voidstartup()Start necessary receiver thread
- 
Constructor Details- 
UDPDiscoveryServiceDeprecated.Specify serializer implementation explicitlyConstructor- Parameters:
- attributes- settings of the service
 
- 
UDPDiscoveryServiceConstructor- Parameters:
- attributes- settings of service
- serializer- the serializer to use to send and receive messages
- Since:
- 3.1
 
 
- 
- 
Method Details- 
setScheduledExecutorServiceDescription copied from interface:IRequireSchedulerInject an instance of a central ScheduledExecutorService- Specified by:
- setScheduledExecutorServicein interface- IRequireScheduler
- See Also:
 
- 
cleanupThis goes through the list of services and removes those that we haven't heard from in longer than the max idle time.- Since:
- 3.1
 
- 
initiateBroadcastInitial request that the other caches let it know their addresses.- Since:
- 3.1
 
- 
serviceRequestBroadcastSend a passive broadcast in response to a request broadcast. Never send a request for a request. We can respond to our own requests, since a request broadcast is not intended as a connection request. We might want to only send messages, so we would send a request, but never a passive broadcast.
- 
shutdownBroadcastIssues a remove broadcast to the others.- Since:
- 3.1
 
- 
addParticipatingCacheNameAdds a region to the list that is participating in discovery.- Parameters:
- cacheName-
 
- 
removeDiscoveredServiceRemoves the discovered service from the list and calls the discovery listener.- Parameters:
- service-
 
- 
addOrUpdateServiceAdd a service to the list. Update the held copy if we already know about it.- Parameters:
- discoveredService- discovered service
 
- 
getCacheNamesGet all the cache names we have facades for.- Returns:
- ArrayList
 
- 
setUdpDiscoveryAttributes- Parameters:
- attr- The UDPDiscoveryAttributes to set.
 
- 
getUdpDiscoveryAttributes- Returns:
- Returns the lca.
 
- 
getSerializerReturn the serializer implementation- Returns:
- the serializer
- Since:
- 3.1
 
- 
startupStart necessary receiver thread
- 
shutdownShuts down the receiver.- Specified by:
- shutdownin interface- IShutdownObserver
 
- 
getDiscoveredServices- Returns:
- Returns the discoveredServices.
 
- 
getCopyOfDiscoveryListeners- Returns:
- the discoveryListeners
 
- 
addDiscoveryListenerAdds a listener.- Parameters:
- listener-
- Returns:
- true if it wasn't already in the set
 
- 
removeDiscoveryListenerRemoves a listener.- Parameters:
- listener-
- Returns:
- true if it was in the set
 
 
-