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
-
Constructor Summary
ConstructorDescriptionAbstractConfigurationService
(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.long
Returns 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, wait
Methods 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:Service
Returns the service ID.
- Specified by:
getID
in interfaceService<A extends ServiceInstance,
B, C extends TrafficPolicy<A, B>> - Returns:
- the service ID
-
getTrafficPolicy
Description copied from interface:Service
Returns the traffic policy.
- Specified by:
getTrafficPolicy
in interfaceService<A extends ServiceInstance,
B, C extends TrafficPolicy<A, B>> - Returns:
- the traffic policy
-
refresh
Description copied from interface:Service
Refreshes 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
Mono
shall be returned.Whether a new instance is returned or not is implementation specific.
- Specified by:
refresh
in interfaceService<A extends ServiceInstance,
B, C extends TrafficPolicy<A, B>> - Parameters:
trafficPolicy
- a traffic policy- Returns:
- a
Mono
emitting a refreshed service or an emptyMono
if no service instance could be resolved
-
getLastRefreshed
public long getLastRefreshed()Description copied from interface:Service
Returns the refreshed time stamp.
- Specified by:
getLastRefreshed
in 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
Mono
emitting the service or an emptyMono
if no service instance could be found
-