Package 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
Modifier and TypeMethodDescriptionvoidhandleRequest(SelectableChannel channel) Upon successful ACCEPT of every request on this port, the service is called upon to handle the request.booleanUpon 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 Details
-
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
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.
-