[
https://issues.apache.org/jira/browse/UIMA-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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