You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2014/09/25 15:35:34 UTC
[jira] [Commented] (ISIS-866) Request-scoped service should be told
when the request is starting and stopping.
[ https://issues.apache.org/jira/browse/ISIS-866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14147738#comment-14147738 ]
ASF subversion and git services commented on ISIS-866:
------------------------------------------------------
Commit ad79a943c51473f81b33bc0f84b17fc2819d0ea6 in isis's branch refs/heads/master from [~danhaywood]
[ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=ad79a94 ]
ISIS-866: @PostConstruct and @PreDestroy now honoured for request-scope services.
> 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...
> ... 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)