cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Schneider (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (DOSGI-171) service objects are never released (using ungetService)
Date Wed, 14 Sep 2016 11:48:21 GMT

     [ https://issues.apache.org/jira/browse/DOSGI-171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Christian Schneider resolved DOSGI-171.
---------------------------------------
       Resolution: Fixed
         Assignee: Christian Schneider
    Fix Version/s: 2.0.0

I just checked the current code and did not find any missing ungetService anymore. 

I did not check all of Aries RSA though so. If you find any occurence there please open a
ticket at Aries.

> service objects are never released (using ungetService)
> -------------------------------------------------------
>
>                 Key: DOSGI-171
>                 URL: https://issues.apache.org/jira/browse/DOSGI-171
>             Project: CXF Distributed OSGi
>          Issue Type: Bug
>    Affects Versions: 1.4.0, 1.5.0
>            Reporter: Amichai Rothman
>            Assignee: Christian Schneider
>             Fix For: 2.0.0
>
>
> The BundleContext.getService() spec/API states that for every time this method returns
a service object, it must later be released using BundleContext.ungetService(). Further, after
ungetService is called, all references to the service object should be removed (set to null)
so that it can be properly released.
> Currently, there are many usages of getService in the code, but none of them release
the reference as required.
> The recommendation seems to be to use service trackers where possible instead of directly
accessing the getService/ungetService APIs, since the ServiceTracker was created for this
exact purpose - to properly handle all the bookkeeping for service references. Alternatively,
in places in which a ServiceTracker is not appropriate and the services are used locally,
the getService call should be followed by a try-finally block which always ungets the service
when done as is standard practice with resource management. Finally, in places in which the
service access is not contained in a local method, and is stored in a field or passed around,
proper resource release should be performed (ungetService called and references nulled afterwards)
in an appropriate way for those cases (when closing or releasing the containing class instance,
etc.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message