org.glassfish.internal.grizzly
Interface LazyServiceInitializer


@Contract
public interface LazyServiceInitializer

This interface is meant for all services that wish to be initialized lazily. Such services are expected to implement this interface and those implementatons should be available to HK2 for lookup.

Author:
Vijay Ramachandran

Method Summary
 String getServiceName()
          Returns the string associated with 'name' attribute of corresponding element in domain.xml.
 void handleRequest(SelectableChannel channel)
          Upon successful ACCEPT of every request on this port, the service is called upon to handle the request.
 boolean initializeService()
          Upon accepting the first request on the port (to which this listener is bound), the listener will select the appropriate provider and call this method to let the actual service initialize itself.
 

Method Detail

getServiceName

String getServiceName()
Returns the string associated with 'name' attribute of corresponding element in domain.xml. The service initializer uses this return value to select the proper service provider from the list of service providers that implement this interface. For GFv3, however, since IIOP and MQ service will not able to move element, the implementations of this interface for IIOP/JMS service will return String "iiop-service"/"mq-service"

Returns:
The value of the 'name' attribute in the corresponding element for this service

initializeService

boolean initializeService()
Upon accepting the first request on the port (to which this listener is bound), the listener will select the appropriate provider and call this method to let the actual service initialize itself. All further accept requests on this port will wait while the service is initialized. Upon successful completion of service initialization, all pending requests are passed to the service using the handleRequest method

Returns:
Return true if service initialization went through fine; false otherwise

handleRequest

void handleRequest(SelectableChannel channel)
Upon successful ACCEPT of every request on this port, the service is called upon to handle the request. The service is provided the channel itself. The service can setup connection, its characteristics, decide on blocking/non-blocking modes etc. The service is expected to return control back to the listener ASAP without consuming this thread for processing the requst completely.

Parameters:
channel - where the incoming request was accepted.


Copyright © 2012 GlassFish Community. All Rights Reserved.