You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2009/03/13 20:16:54 UTC

[jira] Created: (DBCP-285) BasicDataSource is thread-safe, but allows sub-classes to violate that

BasicDataSource is thread-safe, but allows sub-classes to violate that
----------------------------------------------------------------------

                 Key: DBCP-285
                 URL: https://issues.apache.org/jira/browse/DBCP-285
             Project: Commons Dbcp
          Issue Type: Bug
            Reporter: Sebb


BasicDataSource is thread-safe, because all variables are read/written via synchronised methods.

However, since almost all the variables are protected, sub-classes can ignore the synchronisation and compromise thread safety.

Not sure I see the point of allowing a sub-class to do this; the variables ought to be private.

If this cannot be done, then I suggest updating the Javadoc to warn classes not to use the instance variables directly.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DBCP-285) BasicDataSource is thread-safe, but allows sub-classes to violate that

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBCP-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz closed DBCP-285.
----------------------------


> BasicDataSource is thread-safe, but allows sub-classes to violate that
> ----------------------------------------------------------------------
>
>                 Key: DBCP-285
>                 URL: https://issues.apache.org/jira/browse/DBCP-285
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>
> BasicDataSource is thread-safe, because all variables are read/written via synchronised methods.
> However, since almost all the variables are protected, sub-classes can ignore the synchronisation and compromise thread safety.
> Not sure I see the point of allowing a sub-class to do this; the variables ought to be private.
> If this cannot be done, then I suggest updating the Javadoc to warn classes not to use the instance variables directly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DBCP-285) BasicDataSource is thread-safe, but allows sub-classes to violate that

Posted by "Mark Thomas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBCP-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved DBCP-285.
------------------------------

    Resolution: Fixed

Making fields private, whilst the technically correct option, would break compatibility and backwards compatibility takes priority.

The suggested warning has been added.

> BasicDataSource is thread-safe, but allows sub-classes to violate that
> ----------------------------------------------------------------------
>
>                 Key: DBCP-285
>                 URL: https://issues.apache.org/jira/browse/DBCP-285
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>
> BasicDataSource is thread-safe, because all variables are read/written via synchronised methods.
> However, since almost all the variables are protected, sub-classes can ignore the synchronisation and compromise thread safety.
> Not sure I see the point of allowing a sub-class to do this; the variables ought to be private.
> If this cannot be done, then I suggest updating the Javadoc to warn classes not to use the instance variables directly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.