Dan Haywood created ISIS-866:
--------------------------------

             Summary: Request-scoped service should be told when the request is 
starting and stopping.
                 Key: ISIS-866
                 URL: https://issues.apache.org/jira/browse/ISIS-866
             Project: Isis
          Issue Type: Improvement
          Components: Core
    Affects Versions: core-1.6.0
            Reporter: Dan Haywood
            Assignee: Dan Haywood
            Priority: Minor
             Fix For: core-1.7.0


For @RequestScoped services, Isis creates a proxy that implements the 
RequestScopedService interface (in Isis core-runtime), which defines 
__isis_startRequest and __isis_stopRequest.  These methods are then called when 
the Isis session (=request scope) is created so that the proxy can instantiate 
a service for the duration of the request, bound to the thread-local.

HOWEVER...

The underlying service doesn't actually know it has been created/a request is 
started.  It isn't possible to put logic in the constructor, because that stuff 
is also called by the proxy wrapper.

SO...

Define a new interface (in applib) that can be optionally implemented by 
@RequestScoped services (or might even be an equivalent facet); if the service 
implements, then have the proxy wrapper call it.  eg:

public interface RequestScoped {
    public void startRequest();
    public void endRequest();
}




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to