You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2011/02/15 15:01:57 UTC
[jira] Resolved: (DERBY-4723) Using an instance lock to protect
static shared data in EmbedPooledConnection
[ https://issues.apache.org/jira/browse/DERBY-4723?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden resolved DERBY-4723.
-----------------------------------
Resolution: Fixed
Fix Version/s: 10.6.2.3
10.5.3.2
Assignee: Kristian Waagan (was: Kathey Marsden)
> Using an instance lock to protect static shared data in EmbedPooledConnection
> -----------------------------------------------------------------------------
>
> Key: DERBY-4723
> URL: https://issues.apache.org/jira/browse/DERBY-4723
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.5.1.1
> Reporter: Wendy Feng
> Assignee: Kristian Waagan
> Priority: Minor
> Fix For: 10.5.3.2, 10.6.2.3, 10.7.1.1
>
> Attachments: derby-4723-1a-remove_code.diff
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> EmbedPooledConnection has the unsafe synchronization as follow.
>
> private static int idCounter = 0;
> private synchronized int nextId()
> {
> return idCounter++;
> }
> idCounter is a static shared data, and it is not proper to use a instance lock to protect it, especially when two instance of the class are created.
> it would be more safer to write this instead:
> private static synchronized int nextId()
> {
> return idCounter++;
> }
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira