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 instance
B - the type of service request
C - the type of traffic policy
D - 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 Details

    • serviceId

      protected final ServiceID serviceId
      The service ID.
    • trafficPolicy

      protected volatile C extends TrafficPolicy<A,B> trafficPolicy
      The traffic policy.
  • Constructor Details

    • AbstractConfigurationService

      public AbstractConfigurationService(ServiceID serviceId, Mono<D> serviceMetadata)

      Creates a configuration service.

      Parameters:
      serviceId - the service ID
      serviceMetadata - the service metadata
  • Method Details

    • getID

      public ServiceID getID()
      Description copied from interface: Service

      Returns the service ID.

      Specified by:
      getID in interface Service<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>
      Returns:
      the service ID
    • getTrafficPolicy

      public C getTrafficPolicy()
      Description copied from interface: Service

      Returns the traffic policy.

      Specified by:
      getTrafficPolicy in interface Service<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>
      Returns:
      the traffic policy
    • refresh

      public final Mono<? extends Service<A,B,C>> refresh(C trafficPolicy)
      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 interface Service<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>
      Parameters:
      trafficPolicy - a traffic policy
      Returns:
      a Mono emitting a refreshed service or an empty Mono 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 interface Service<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>
      Returns:
      an epoch time in milliseconds
    • doRefresh

      protected abstract Mono<? extends Service<A,B,C>> doRefresh(C trafficPolicy, D serviceMetadata)

      Returns the service refreshed with the specified metadata and traffic policy.

      Parameters:
      trafficPolicy - a traffic policy
      serviceMetadata - the service metadata
      Returns:
      a Mono emitting the service or an empty Mono if no service instance could be found