com.sun.enterprise.v3.services.impl
Class GrizzlyService

java.lang.Object
  extended by com.sun.enterprise.v3.services.impl.GrizzlyService
All Implemented Interfaces:
RequestDispatcher, FutureProvider<Result<Thread>>, Startup, org.glassfish.hk2.PostConstruct, org.glassfish.hk2.PreDestroy

@Service
@Scoped(value=org.jvnet.hk2.component.Singleton.class)
public class GrizzlyService
extends Object
implements Startup, RequestDispatcher, org.jvnet.hk2.component.PostConstruct, org.jvnet.hk2.component.PreDestroy, FutureProvider<Result<Thread>>

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

Nested Class Summary
static class GrizzlyService.NoopInvocationHandler
          Probe provider that implements each probe provider method as a no-op.
 
Nested classes/interfaces inherited from interface org.glassfish.api.Startup
Startup.Lifecycle
 
Constructor Summary
GrizzlyService()
           
 
Method Summary
 boolean addMapperUpdateListener(MapperUpdateListener listener)
          Adds MapperUpdateListener to listeners queue.
 void addNetworkProxy(NetworkProxy proxy)
          Add the new proxy to our list of proxies.
 Future<Result<Thread>> createNetworkProxy(org.glassfish.grizzly.config.dom.NetworkListener listener)
           
 List<Future<Result<Thread>>> getFutures()
           
 org.jvnet.hk2.component.Habitat getHabitat()
          Gets the habitat.
 Startup.Lifecycle getLifecycle()
          Returns the life expectency of the service
 Logger getLogger()
          Gets the logger.
 GrizzlyMonitoring getMonitoring()
           
 boolean hasMapperUpdateListener()
          Is there any MapperUpdateListener registered?
 NetworkProxy lookupNetworkProxy(org.glassfish.grizzly.config.dom.NetworkListener listener)
          Lookup GrizzlyProxy, which corresponds to the NetworkListener.
 void notifyMapperUpdateListeners(org.glassfish.grizzly.config.dom.NetworkListener networkListener, org.glassfish.grizzly.http.server.util.Mapper mapper)
          Notify all MapperUpdateListeners about update happened.
 void postConstruct()
          The component has been injected with any dependency and will be placed into commission by the subsystem.
 void preDestroy()
          The component is about to be removed from commission
 void registerEndpoint(Endpoint endpoint)
          Registers a new endpoint for the given context root at the given port number.
 void registerEndpoint(String contextRoot, Collection<String> vsServers, org.glassfish.grizzly.http.server.HttpHandler endpointAdapter, ApplicationContainer container)
           
 void registerEndpoint(String contextRoot, org.glassfish.grizzly.http.server.HttpHandler endpointAdapter, ApplicationContainer container)
           
 void registerEndpoint(String contextRoot, org.glassfish.grizzly.http.server.HttpHandler endpointAdapter, ApplicationContainer container, String virtualServers)
           
 void registerEndpoint(String contextRoot, InetAddress address, int port, Collection<String> vsServers, org.glassfish.grizzly.http.server.HttpHandler endpointAdapter, ApplicationContainer container)
          Registers a new endpoint for the given context root at the given port number.
protected  void registerMonitoringStatsProviders()
           
 void registerNetworkProxy()
           
 boolean removeMapperUpdateListener(MapperUpdateListener listener)
          Removes MapperUpdateListener to listeners queue.
 boolean removeNetworkProxy(org.glassfish.grizzly.config.dom.NetworkListener listener)
          Remove the proxy from our list of proxies by listener.
 boolean removeNetworkProxy(NetworkProxy proxy)
          Remove the proxy from our list of proxies.
 boolean removeNetworkProxy(String id)
          Remove the proxy from our list of proxies by id.
 void unregisterEndpoint(String contextRoot)
          Removes the context-root from our list of endpoints.
 void unregisterEndpoint(String contextRoot, ApplicationContainer app)
          Removes the context-root from our list of endpoints.
protected  void unregisterMonitoringStatsProviders()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrizzlyService

public GrizzlyService()
Method Detail

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(org.glassfish.grizzly.config.dom.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.

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.

lookupNetworkProxy

public NetworkProxy lookupNetworkProxy(org.glassfish.grizzly.config.dom.NetworkListener listener)
Lookup GrizzlyProxy, which corresponds to the NetworkListener.

Parameters:
listener - NetworkListener.
Returns:
GrizzlyProxy, or null, if correspondent GrizzlyProxy wasn't found.

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(org.glassfish.grizzly.config.dom.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

getLogger

public Logger getLogger()
Gets the logger.

Returns:
the logger

getHabitat

public org.jvnet.hk2.component.Habitat getHabitat()
Gets the habitat.

Returns:
the habitat

getMonitoring

public GrizzlyMonitoring getMonitoring()

getLifecycle

public Startup.Lifecycle getLifecycle()
Returns the life expectency of the service

Specified by:
getLifecycle in interface Startup
Returns:
the life expectency.

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.PostConstruct

getFutures

public List<Future<Result<Thread>>> getFutures()
Specified by:
getFutures in interface FutureProvider<Result<Thread>>

createNetworkProxy

public Future<Result<Thread>> createNetworkProxy(org.glassfish.grizzly.config.dom.NetworkListener listener)

registerNetworkProxy

public void registerNetworkProxy()

preDestroy

public void preDestroy()
The component is about to be removed from commission

Specified by:
preDestroy in interface org.glassfish.hk2.PreDestroy

registerEndpoint

public void registerEndpoint(String contextRoot,
                             org.glassfish.grizzly.http.server.HttpHandler endpointAdapter,
                             ApplicationContainer container)
                      throws EndpointRegistrationException
Specified by:
registerEndpoint in interface RequestDispatcher
Throws:
EndpointRegistrationException

registerEndpoint

public void registerEndpoint(String contextRoot,
                             org.glassfish.grizzly.http.server.HttpHandler endpointAdapter,
                             ApplicationContainer container,
                             String virtualServers)
                      throws EndpointRegistrationException
Specified by:
registerEndpoint in interface RequestDispatcher
Throws:
EndpointRegistrationException

registerEndpoint

public void registerEndpoint(String contextRoot,
                             Collection<String> vsServers,
                             org.glassfish.grizzly.http.server.HttpHandler endpointAdapter,
                             ApplicationContainer container)
                      throws EndpointRegistrationException
Specified by:
registerEndpoint in interface RequestDispatcher
Throws:
EndpointRegistrationException

registerEndpoint

public void registerEndpoint(String contextRoot,
                             InetAddress address,
                             int port,
                             Collection<String> vsServers,
                             org.glassfish.grizzly.http.server.HttpHandler endpointAdapter,
                             ApplicationContainer container)
                      throws EndpointRegistrationException
Registers a new endpoint for the given context root at the given port number.

Specified by:
registerEndpoint in interface RequestDispatcher
Throws:
EndpointRegistrationException

registerEndpoint

public void registerEndpoint(Endpoint endpoint)
                      throws EndpointRegistrationException
Registers a new endpoint for the given context root at the given port number.

Throws:
EndpointRegistrationException

unregisterEndpoint

public void unregisterEndpoint(String contextRoot)
                        throws EndpointRegistrationException
Removes the context-root from our list of endpoints.

Specified by:
unregisterEndpoint in interface RequestDispatcher
Throws:
EndpointRegistrationException

unregisterEndpoint

public void unregisterEndpoint(String contextRoot,
                               ApplicationContainer app)
                        throws EndpointRegistrationException
Removes the context-root from our list of endpoints.

Specified by:
unregisterEndpoint in interface RequestDispatcher
Throws:
EndpointRegistrationException

registerMonitoringStatsProviders

protected void registerMonitoringStatsProviders()

unregisterMonitoringStatsProviders

protected void unregisterMonitoringStatsProviders()


Copyright © 2012. All Rights Reserved.