[jira] [Commented] (UIMA-2977) destroy method of shared resources never called
[ https://issues.apache.org/jira/browse/UIMA-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15586757#comment-15586757 ] Marshall Schor commented on UIMA-2977: -- Adding Burn's reply from the dev list, slightly edited: re: *The PEAR support version of this just forwards calls relating to external resources and cas pools to the parent.* My understanding is that the RM's used by pears are created by copying the 5 resource maps and the CasManager --- so destroying one pear's RM would destroy the resources shared by the others. (Marshall says: true. But remember, the framework never calls destroy on the Resource Manager; it is up to the overall application to decide if and when to do this.) We also have a use case where multiple pipelines need to share resources but can't share the CasManager as their typesystems are different, and may be created much later. We can use the 5-arg constructor to create a subclassed Resource Manager, but this has a problem in that it doesn't share the resources loaded by the original pipeline. UIMA-5146 will allow a better way to create the other Resource Manager such that it **does** share the resources loaded by the original pipeline. > destroy method of shared resources never called > --- > > Key: UIMA-2977 > URL: https://issues.apache.org/jira/browse/UIMA-2977 > Project: UIMA > Issue Type: Bug > Components: Core Java Framework >Reporter: Richard Eckart de Castilho >Assignee: Marshall Schor > Labels: Resources > Fix For: 3.0.0SDKexp > > > Apparently the ResourceManager and the resources created by the manager do > not participate in the usual component life cycle. On other components, such > as analysis engines or readers, the destroy() method is called when the > component is disposed of. External resources never get notified when they are > no longer needed. At least any resources derived from Resource (e.g. > DataResource and ParametrizedDataResource) should be notified. The > SharedResourceObject interface does not define any such life cycle callback. > As a side-note: An alternative to the rather heavy-weight Resource interface > of UIMA maybe be small life cycle interfaces such as the Spring > InitializingBean and DisposableBean interfaces, or Java annotations marking > initialization and destruction methods (e.g. @PostConstruct and @PreDestroy). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (UIMA-2977) destroy method of shared resources never called
[ https://issues.apache.org/jira/browse/UIMA-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15585507#comment-15585507 ] Marshall Schor commented on UIMA-2977: -- The PEAR support version of this just forwards calls relating to external resources and cas pools to the parent. I'm going to take Richard's suggestion and add a destroy() method to the ResourceManager and ResourceManager_impl and have it propagate this to the lists of External Resources it maintains, and also to the CAS Pool to do whatever cleanup might be possible there. A destroyed ResourceManager cannot be reused. This will be enforced by throwing a new exception if any use is attempted after it is destroyed. > destroy method of shared resources never called > --- > > Key: UIMA-2977 > URL: https://issues.apache.org/jira/browse/UIMA-2977 > Project: UIMA > Issue Type: Bug > Components: Core Java Framework >Reporter: Richard Eckart de Castilho > Labels: Resources > > Apparently the ResourceManager and the resources created by the manager do > not participate in the usual component life cycle. On other components, such > as analysis engines or readers, the destroy() method is called when the > component is disposed of. External resources never get notified when they are > no longer needed. At least any resources derived from Resource (e.g. > DataResource and ParametrizedDataResource) should be notified. The > SharedResourceObject interface does not define any such life cycle callback. > As a side-note: An alternative to the rather heavy-weight Resource interface > of UIMA maybe be small life cycle interfaces such as the Spring > InitializingBean and DisposableBean interfaces, or Java annotations marking > initialization and destruction methods (e.g. @PostConstruct and @PreDestroy). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (UIMA-2977) destroy method of shared resources never called
[ https://issues.apache.org/jira/browse/UIMA-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13708106#comment-13708106 ] Marshall Schor commented on UIMA-2977: -- Analysis Engine do not automatically have their destroy methods called for the event when the component is disposed of; UIMA doesn't have a formal concept of this event. For instance, one could do the following with the UIMA Application APIs: Read in a descriptor, create an analysis engine, send it some CASes and do something with the results, and then terminate. In this scenario, no destroy would be called; it's up to the surrounding application code to call (or not) the destroy() method. When the destroy method is called on an annotator, the framework does takes care of propagating this to its delegates. However it doesn't propagate to any shared resources that might have been loaded and set up; because they're shared, they conceivably could still be in use by other annotators which were not destroyed. If some piece of user application code had a reference to a resource (not an annotator, but an External Resource), then, that code *could* call the destroy method on that resource. In order to implement a fix for this Jira, one would need to define another layer of lifecycle management for UIMA, I think, in order to be able to reliably determine when a (shared) resource was no longer needed. A counter-example use case for doing, for instance, a reference-counting scheme for determining when to call destroy that relied on determining when *all* the annotators that had linked to it had been destroyed, could be: 1) The top application sets up some UIMA pipelines to act as services. Some of these load (via external resources), some large, slow-to-load resources, and share them. 2) The top application needs to remain responsive, but is able to shut down some of its loaded pipelines, in response to changing user requests (load). If at some point, it shutdown all of its pipelines, and then got some more user requests, it might want to quickly startup some pipelines, but avoid the load time of (some of) the external resources - so it might *choose* to keep these loaded. destroy method of shared resources never called --- Key: UIMA-2977 URL: https://issues.apache.org/jira/browse/UIMA-2977 Project: UIMA Issue Type: Bug Components: Core Java Framework Reporter: Richard Eckart de Castilho Apparently the ResourceManager and the resources created by the manager do not participate in the usual component life cycle. On other components, such as analysis engines or readers, the destroy() method is called when the component is disposed of. External resources never get notified when they are no longer needed. At least any resources derived from Resource (e.g. DataResource and ParametrizedDataResource) should be notified. The SharedResourceObject interface does not define any such life cycle callback. As a side-note: An alternative to the rather heavy-weight Resource interface of UIMA maybe be small life cycle interfaces such as the Spring InitializingBean and DisposableBean interfaces, or Java annotations marking initialization and destruction methods (e.g. @PostConstruct and @PreDestroy). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (UIMA-2977) destroy method of shared resources never called
[ https://issues.apache.org/jira/browse/UIMA-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13708108#comment-13708108 ] Richard Eckart de Castilho commented on UIMA-2977: -- A low-cost approach may be to add a destroy method to the resource manager. An application can externally provide a resource manager when creating the analysis engine(s), do processing and then destroy the resource manager, which would forward the destroy to all registered resources. That way, the framework would not need to determine the need for destruction itself. This would be left to the a runtime engine, such as CPE, uimaFIT SimplePipeline, etc. The contract would be: the creator of the ResourceManager destroys it - and it could be a best practice to do so. E.g. in a CPE when the engine shuts down, in SimplePipeline after the pipeline has processed all data, in UIMA-AS when the service shuts down. destroy method of shared resources never called --- Key: UIMA-2977 URL: https://issues.apache.org/jira/browse/UIMA-2977 Project: UIMA Issue Type: Bug Components: Core Java Framework Reporter: Richard Eckart de Castilho Apparently the ResourceManager and the resources created by the manager do not participate in the usual component life cycle. On other components, such as analysis engines or readers, the destroy() method is called when the component is disposed of. External resources never get notified when they are no longer needed. At least any resources derived from Resource (e.g. DataResource and ParametrizedDataResource) should be notified. The SharedResourceObject interface does not define any such life cycle callback. As a side-note: An alternative to the rather heavy-weight Resource interface of UIMA maybe be small life cycle interfaces such as the Spring InitializingBean and DisposableBean interfaces, or Java annotations marking initialization and destruction methods (e.g. @PostConstruct and @PreDestroy). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (UIMA-2977) destroy method of shared resources never called
[ https://issues.apache.org/jira/browse/UIMA-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13708148#comment-13708148 ] Marshall Schor commented on UIMA-2977: -- I like your suggestions. I think that some additional investigation into Resource Managers might be needed, to see if additional delegating is needed or other approaches. For instance, IIRC, a Pear Wrapper creates a (sub) resource manager in order to set up an isolated class loader for the Pear it is wrapping. There was some tweaking done in that (I don't recall the details) to allow some degree of sharing - this may have included external resources. destroy method of shared resources never called --- Key: UIMA-2977 URL: https://issues.apache.org/jira/browse/UIMA-2977 Project: UIMA Issue Type: Bug Components: Core Java Framework Reporter: Richard Eckart de Castilho Apparently the ResourceManager and the resources created by the manager do not participate in the usual component life cycle. On other components, such as analysis engines or readers, the destroy() method is called when the component is disposed of. External resources never get notified when they are no longer needed. At least any resources derived from Resource (e.g. DataResource and ParametrizedDataResource) should be notified. The SharedResourceObject interface does not define any such life cycle callback. As a side-note: An alternative to the rather heavy-weight Resource interface of UIMA maybe be small life cycle interfaces such as the Spring InitializingBean and DisposableBean interfaces, or Java annotations marking initialization and destruction methods (e.g. @PostConstruct and @PreDestroy). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (UIMA-2977) destroy method of shared resources never called
[ https://issues.apache.org/jira/browse/UIMA-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13682713#comment-13682713 ] Marshall Schor commented on UIMA-2977: -- The current implementation appears to divide Resources into two (or more) categories. I see, for instance, one split more or less along the lines - things like Annotators which can have External Resource bindings, and things like External Resources, which are in some respects more primitive, and do not really fully implement the Resource interface; I suspect there are other dimensions too. To proceed on this topic, I think we will need to categorize all the resources, characterize the (subset of) the Resource functionality each category supports, and then make reasoned arguments discussing the pros/cons for changing these. destroy method of shared resources never called --- Key: UIMA-2977 URL: https://issues.apache.org/jira/browse/UIMA-2977 Project: UIMA Issue Type: Bug Components: Core Java Framework Reporter: Richard Eckart de Castilho Apparently the ResourceManager and the resources created by the manager do not participate in the usual component life cycle. On other components, such as analysis engines or readers, the destroy() method is called when the component is disposed of. External resources never get notified when they are no longer needed. At least any resources derived from Resource (e.g. DataResource and ParametrizedDataResource) should be notified. The SharedResourceObject interface does not define any such life cycle callback. As a side-note: An alternative to the rather heavy-weight Resource interface of UIMA maybe be small life cycle interfaces such as the Spring InitializingBean and DisposableBean interfaces, or Java annotations marking initialization and destruction methods (e.g. @PostConstruct and @PreDestroy). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira