Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-866

Request-scoped service should be told when the request is starting and stopping.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: core-1.6.0
    • Fix Version/s: core-1.7.0
    • Component/s: Core
    • Labels:
      None

      Description

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

      ... a bit of research shows that the JEE way of doing this is to call methods annotated @PostConstruct and @PreDestroy. So that's what we should do too.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: