commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Vandahl (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (JCS-115) JDBCDiskCachePoolAccessManager is thread hostile
Date Sun, 11 May 2014 16:22:15 GMT

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

Thomas Vandahl resolved JCS-115.
--------------------------------

       Resolution: Fixed
    Fix Version/s: jcs-2.0.0
         Assignee: Thomas Vandahl

Fixed in SVN

> JDBCDiskCachePoolAccessManager is thread hostile
> ------------------------------------------------
>
>                 Key: JCS-115
>                 URL: https://issues.apache.org/jira/browse/JCS-115
>             Project: Commons JCS
>          Issue Type: Bug
>            Reporter: Sebb
>            Assignee: Thomas Vandahl
>            Priority: Critical
>             Fix For: jcs-2.0.0
>
>
> JDBCDiskCachePoolAccessManager is currently designed as a singleton.
> However, it contains a mutable field, props, with a protected setter.
> This just does not work in a multi-threaded environment.
> It looks like the reason for the singleton is to share a the HashMap of JDBCDiskCachePoolAccess
instances.
> So one possible fix would be to make the HashMap static instead of using a singleton,
replace getInstance with a public constructor.
> AFAICT this won't affect garbage collection of the pool as there is no way to clear the
singleton reference. 
> Another would be to eliminate the props field, adding it as a parameter to methods that
need it.
> It looks as though the props field is only used when creating the entry for the map,
so it should be supplied at the same time as the pool name. It does not appear to be possible
to delete a pool entry once created, so a given set of props can only be used once to create
a pool of a given name.
> In any case, the setter for props should be removed and the field should be made final
(if it is kept).
> Note: this was found when investigating JCS-114 - one of the tests fails to invoke JDBCDiskCachePoolAccessManager.setProps



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message