Class GrizzlyService

  • All Implemented Interfaces:
    fish.payara.monitoring.collect.MonitoringDataSource, RequestDispatcher, EventListener, FutureProvider<Result<Thread>>, org.glassfish.hk2.api.PostConstruct, org.glassfish.hk2.api.PreDestroy

    @Service
    @RunLevel(10)
    @Rank(50)
    public class GrizzlyService
    extends Object
    implements RequestDispatcher, org.glassfish.hk2.api.PostConstruct, org.glassfish.hk2.api.PreDestroy, EventListener, FutureProvider<Result<Thread>>, fish.payara.monitoring.collect.MonitoringDataSource
    The Network Service is responsible for starting grizzly and register the top level proxy. It is also providing a runtime service where other services (like admin for instance) can register endpoints proxy to particular context root.
    Author:
    Jerome Dochez
    • Constructor Detail

      • GrizzlyService

        public GrizzlyService()
    • Method Detail

      • collect

        public void collect​(fish.payara.monitoring.collect.MonitoringDataCollector collector)
        Specified by:
        collect in interface fish.payara.monitoring.collect.MonitoringDataSource
      • addNetworkProxy

        public void addNetworkProxy​(NetworkProxy proxy)
        Add the new proxy to our list of proxies.
        Parameters:
        proxy - new proxy to be added
      • removeNetworkProxy

        public boolean removeNetworkProxy​(NetworkListener listener)
        Remove the proxy from our list of proxies by listener.
        Parameters:
        listener - removes the proxy associated with the specified listener
        Returns:
        true, if proxy removed, false if no proxy was associated with the specified listener.
      • removeNetworkProxy

        public boolean removeNetworkProxy​(String id)
        Remove the proxy from our list of proxies by id.
        Returns:
        true, if proxy on specified port was removed, false if no proxy was associated with the port.
      • closeNetworkProxy

        public boolean closeNetworkProxy​(NetworkProxy proxy)
      • removeNetworkProxy

        public boolean removeNetworkProxy​(NetworkProxy proxy)
        Remove the proxy from our list of proxies.
        Returns:
        true, if proxy on specified port was removed, false otherwise.
      • restartNetworkListener

        public void restartNetworkListener​(String networkListenerName,
                                           long timeout,
                                           TimeUnit timeUnit)
                                    throws IOException,
                                           TimeoutException
        Parameters:
        networkListenerName -
        timeout - restart timeout, if timeout value is negative - then no timeout will be applied.
        timeUnit - restart timeout unit
        Throws:
        TimeoutException - thrown if timeout had expired before server succeeded to restart
        IOException
      • hasMapperUpdateListener

        public boolean hasMapperUpdateListener()
        Is there any MapperUpdateListener registered?
      • addMapperUpdateListener

        public boolean addMapperUpdateListener​(MapperUpdateListener listener)
        Adds MapperUpdateListener to listeners queue.
        Parameters:
        listener - the listener to be added.
        Returns:
        true, if listener was successfully added, or false otherwise.
      • removeMapperUpdateListener

        public boolean removeMapperUpdateListener​(MapperUpdateListener listener)
        Removes MapperUpdateListener to listeners queue.
        Parameters:
        listener - the listener to be removed.
        Returns:
        true, if listener was successfully removed, or false otherwise.
      • notifyMapperUpdateListeners

        public void notifyMapperUpdateListeners​(NetworkListener networkListener,
                                                org.glassfish.grizzly.http.server.util.Mapper mapper)
        Notify all MapperUpdateListeners about update happened.
        Parameters:
        networkListener - NetworkListener, which Mapper got changed
        mapper - new Mapper value
      • obtainMapperLock

        public ReentrantReadWriteLock obtainMapperLock()
        Returns HTTP Mapper lock to prevent concurrent access to a Mapper object.
      • getLogger

        public Logger getLogger()
        Gets the logger.
        Returns:
        the logger
      • getHabitat

        public org.glassfish.hk2.api.ServiceLocator getHabitat()
        Gets the habitat.
        Returns:
        the habitat
      • postConstruct

        public void postConstruct()
        The component has been injected with any dependency and will be placed into commission by the subsystem.
        Specified by:
        postConstruct in interface org.glassfish.hk2.api.PostConstruct
      • preDestroy

        public void preDestroy()
        The component is about to be removed from commission
        Specified by:
        preDestroy in interface org.glassfish.hk2.api.PreDestroy
      • registerMonitoringStatsProviders

        protected void registerMonitoringStatsProviders()
      • unregisterMonitoringStatsProviders

        protected void unregisterMonitoringStatsProviders()