[ https://issues.apache.org/jira/browse/TUSCANY-2215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604979#action_12604979 ]
Jean-Sebastien Delfino commented on TUSCANY-2215: ------------------------------------------------- The problem is that the runtime currently does not track the lifecycle of requests and therefore has no way to detect the end of a request. I think that the following needs to be done: - Define a proper eventing mechanism (at the moment the stuff in org.apache.tuscany.sca.core.event is not used) to signal lifecycle events on composite, conversation, request and stateless scopes - Use this mechanism consistently in to track the state of these scopes (the different scope containers seem to be using different mechanisms at the moment, for example ConversationalScopeContainer has introduced a set of specific eventing methods, which the other scopes do not use). - Make sure that entry / exit points (e.g binding providers) send the right begin/end scope events, this is not in place at all at the moment, except for conversation events in some specific cases. I recommend a serious cleanup of the whole event mechanism (which could potentially be rewritten as it's not used and mostly dead code anyway), the scope management mechanism, and a pass through all binding providers and component implementation providers to ensure that they generate or react to scope events correctly. As a starting point, the Event and Scope interfaces are SPIs, they should be in a different package, in a different module: core-spi. > Destory method is not called if scope type is request > ----------------------------------------------------- > > Key: TUSCANY-2215 > URL: https://issues.apache.org/jira/browse/TUSCANY-2215 > Project: Tuscany > Issue Type: Bug > Components: Java SCA Core Runtime > Affects Versions: Java-SCA-Next > Reporter: Gilbert Kwan > Fix For: Java-SCA-Next > > > Destroy method was not called for @Scope("REQUEST"). > Service Definition: > ============= > @Scope("REQUEST") > public class AServiceImpl implements AService { > @Init > public void init() { > System.out.println("init()"); > } > @Destroy > public void destroy() { > System.out.println("destroy()"); > } > public void xxx() { > System.out.println("xxx()"); } > } > Client called: > ========= > System.out.println("Setting up"); > domain = SCADomain.newInstance(compositeName); > aService = domain.getService(AService.class, "AService"); > aService.xxx(); > System.out.println("Cleaning up"); > if (domain != null) > domain.close(); > Output: > ====== > Setting up > init() > xxx() > Cleaning up > When changed to other scope type, the destroy method could be called. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.