Module io.inverno.mod.discovery
Package io.inverno.mod.discovery
Class AbstractConfigurationService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>,D>
java.lang.Object
io.inverno.mod.discovery.AbstractConfigurationService<A,B,C,D>
- Type Parameters:
A- the type of service instanceB- the type of service requestC- the type of traffic policyD- the service descriptor type
- All Implemented Interfaces:
Service<A,B, C>
public abstract class AbstractConfigurationService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>,D>
extends Object
implements Service<A,B,C>
A service resolved by configuration.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractConfigurationService(ServiceID serviceId, Mono<D> serviceMetadata) Creates a configuration service. -
Method Summary
Modifier and TypeMethodDescriptionReturns the service refreshed with the specified metadata and traffic policy.getID()Returns the service ID.longReturns the refreshed time stamp.Returns the traffic policy.Refreshes the service using the specified traffic policy.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.discovery.Service
getInstance, refresh, shutdown, shutdownGracefully
-
Field Details
-
serviceId
The service ID. -
trafficPolicy
The traffic policy.
-
-
Constructor Details
-
AbstractConfigurationService
Creates a configuration service.
- Parameters:
serviceId- the service IDserviceMetadata- the service metadata
-
-
Method Details
-
getID
Description copied from interface:ServiceReturns the service ID.
- Specified by:
getIDin interfaceService<A extends ServiceInstance,B, C extends TrafficPolicy<A, B>> - Returns:
- the service ID
-
getTrafficPolicy
Description copied from interface:ServiceReturns the traffic policy.
- Specified by:
getTrafficPolicyin interfaceService<A extends ServiceInstance,B, C extends TrafficPolicy<A, B>> - Returns:
- the traffic policy
-
refresh
Description copied from interface:ServiceRefreshes the service using the specified traffic policy.
This basically refreshes the list of service instances using the specified traffic policy. When no service instance could be resolved, the service is assumed to be gone and an empty
Monoshall be returned.Whether a new instance is returned or not is implementation specific.
- Specified by:
refreshin interfaceService<A extends ServiceInstance,B, C extends TrafficPolicy<A, B>> - Parameters:
trafficPolicy- a traffic policy- Returns:
- a
Monoemitting a refreshed service or an emptyMonoif no service instance could be resolved
-
getLastRefreshed
public long getLastRefreshed()Description copied from interface:ServiceReturns the refreshed time stamp.
- Specified by:
getLastRefreshedin interfaceService<A extends ServiceInstance,B, C extends TrafficPolicy<A, B>> - Returns:
- an epoch time in milliseconds
-
doRefresh
Returns the service refreshed with the specified metadata and traffic policy.
- Parameters:
trafficPolicy- a traffic policyserviceMetadata- the service metadata- Returns:
- a
Monoemitting the service or an emptyMonoif no service instance could be found
-