@Singleton @ServiceStrategy public class DefaultServiceSynchronizationStrategy extends Object implements IServiceSynchronizationStrategy
| Modifier and Type | Field and Description |
|---|---|
protected static long |
HEARTBEAT_REGISTRY_PERIOD |
| Modifier | Constructor and Description |
|---|---|
protected |
DefaultServiceSynchronizationStrategy()
Constructor.
|
protected |
DefaultServiceSynchronizationStrategy(RegistryCache registryCache,
MulticastRegistryDiscoverer registryDiscoverer)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addService(ServiceDescriptor serviceDescriptor) |
protected Long |
callHeartbeat(String host,
int port,
boolean useSSL,
WebCall heartbeatUri)
Calls the heatbeat method of the registry to determine whether its
responding and if so, the latency.
|
void |
close() |
static DefaultServiceSynchronizationStrategy |
create()
Creates a new
DefaultServiceSynchronizationStrategy. |
protected IMarshaller |
determineCommonMimeType(RegistryDescriptor registryDescriptor)
Determine which mime-type and corresponding marshaller is mutually
supported by this lookup and the registry-server.
|
RegistryCache |
getRegistryCache() |
protected Timer |
getTimer()
Gets the timer for the heartbeat calls.
|
void |
initialize() |
void |
removeService(ServiceDescriptor serviceDescriptor) |
void |
removeServices(List<ServiceDescriptor> serviceDescriptors) |
void |
requestAllRegistries() |
protected static final long HEARTBEAT_REGISTRY_PERIOD
protected DefaultServiceSynchronizationStrategy()
protected DefaultServiceSynchronizationStrategy(RegistryCache registryCache, MulticastRegistryDiscoverer registryDiscoverer)
public static DefaultServiceSynchronizationStrategy create() throws ServiceException
DefaultServiceSynchronizationStrategy.ServiceException@PostConstruct public void initialize()
protected Long callHeartbeat(String host, int port, boolean useSSL, WebCall heartbeatUri)
host - port - useSSL - heartbeatUri - public void addService(ServiceDescriptor serviceDescriptor) throws ServiceException
addService in interface IServiceSynchronizationStrategyServiceExceptionpublic void removeService(ServiceDescriptor serviceDescriptor) throws ServiceException
removeService in interface IServiceSynchronizationStrategyServiceExceptionpublic void removeServices(List<ServiceDescriptor> serviceDescriptors) throws ServiceException
removeServices in interface IServiceSynchronizationStrategyServiceExceptionpublic void requestAllRegistries()
throws ServiceException
requestAllRegistries in interface IServiceSynchronizationStrategyServiceExceptionprotected IMarshaller determineCommonMimeType(RegistryDescriptor registryDescriptor) throws ServiceException
registryDescriptor - the RegistryDescriptorIMarshaller or nullServiceExceptionpublic RegistryCache getRegistryCache()
public void close()
close in interface IServiceSynchronizationStrategyclose in interface Closeableclose in interface AutoCloseableCopyright © 2016. All rights reserved.