Class RessorServiceImpl<T,​D>

  • All Implemented Interfaces:
    RessorService<T>

    public class RessorServiceImpl<T,​D>
    extends java.lang.Object
    implements RessorService<T>
    • Constructor Detail

      • RessorServiceImpl

        public RessorServiceImpl​(java.lang.Class<? extends T> type,
                                 java.util.function.Function<D,​? extends T> factory,
                                 Translator<java.io.InputStream,​D> translator,
                                 ErrorHandler errorHandler,
                                 T initialInstance,
                                 ResourceId resourceId)
    • Method Detail

      • underlyingType

        public java.lang.Class<? extends T> underlyingType()
        Description copied from interface: RessorService
        Returns the underlying type of the user service.
        Specified by:
        underlyingType in interface RessorService<T>
      • instance

        public T instance()
        Description copied from interface: RessorService
        Latest non-proxied instance of the user service. Throws IllegalStateException if there is no underlying instance. Important! This method is used implicitly by ServiceProxyBuilder while building service proxy instance.
        Specified by:
        instance in interface RessorService<T>
      • latestVersion

        public SourceVersion latestVersion()
        Description copied from interface: RessorService
        Returns the latest resource version which this service is aware of and is switching to. It's guaranteed that instance() and latestVersion() will be *eventually in sync* with each other at some point of time.
        Specified by:
        latestVersion in interface RessorService<T>
      • reload

        public boolean reload​(LoadedResource resource,
                              boolean force)
        Description copied from interface: RessorService
        Attempts to reload the service with the given resource. If the service is already reloading from another thread, will return false. In case of any error will throw appropriate exception.
        Specified by:
        reload in interface RessorService<T>
        Parameters:
        resource - the new version of the resource
        force - whether to force the reload, blocking until concurrent reloads completed
        Returns:
        true if the resource was reloaded, unless false
      • state

        public <K,​V> V state​(K key)
      • state

        public RessorServiceImpl<T,​D> state​(java.lang.Object key,
                                                  java.lang.Object value)