Issue Details (XML | Word | Printable)

Key: NUCCORE-502
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Erik Bengtson
Reporter: Yang ZHONG
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

JDOClassLoaderResolver#getResources shouldn't have cached Enumeration

Created: 01/Apr/10 07:16 PM   Updated: 04/Oct/12 05:02 PM   Resolved: 01/Apr/10 10:33 PM
Component/s: Persistence
Affects Version/s: 2.0.0.release, 2.0.1, 2.0.2, 2.0.3
Fix Version/s: 2.0.4, 2.1.0.m1

File Attachments: 1. Java Source File core502.java (0.8 kB)


Forum Thread URL: HTTP://WWW.DataNucleus.org/servlet/forum/viewthread_thread,6036
Severity: Production


 Description  « Hide
JDOClassLoaderResolver has a cache:
Map<String, Enumeration> multiResources

1st issue with the cache:

Enumeration#nextElement() will change the state.

Supposing 1st JDOClassLoaderResolver#getResources returning 2 element, 2 Enumeration#nextElement() will empty out.

All following JDOClassLoaderResolver#getResources returns the very same Enumeration which is empty now, because of the cache.

2nd issue with the cache:

if the ClassLoaderResolver cache resources, runtime classloader changes are not going to be effective in datanucleus.

let caching and performance improvements to the underlying classloaders


Erik Bengtson made changes - 01/Apr/10 07:40 PM
Field Original Value New Value
Fix Version/s 2.0.4 [ 10921 ]
Fix Version/s 2.1.0.m2 [ 10901 ]
Affects Version/s 2.0.3 [ 10907 ]
Affects Version/s 2.0.1 [ 10835 ]
Affects Version/s 2.0.0.release [ 10703 ]
Yang ZHONG added a comment - 01/Apr/10 07:45 PM
Test Case is attached.

Yang ZHONG made changes - 01/Apr/10 07:45 PM
Attachment core502.java [ 11120 ]
Erik Bengtson made changes - 01/Apr/10 10:19 PM
Fix Version/s 2.1.0.m1 [ 10900 ]
Fix Version/s 2.1.0.m2 [ 10901 ]
Description JDOClassLoaderResolver has a cache:
Map<String, Enumeration> multiResources

Enumeration#nextElement() will change the state, Erik doesn't think we should cache Enumeration.

Supposing 1st JDOClassLoaderResolver#getResources returning 2 element, 2 Enumeration#nextElement() will empty out.

All following JDOClassLoaderResolver#getResources returns the very same Enumeration which is empty now, because of the cache.
JDOClassLoaderResolver has a cache:
Map<String, Enumeration> multiResources

1st issue with the cache:

Enumeration#nextElement() will change the state.

Supposing 1st JDOClassLoaderResolver#getResources returning 2 element, 2 Enumeration#nextElement() will empty out.

All following JDOClassLoaderResolver#getResources returns the very same Enumeration which is empty now, because of the cache.

2nd issue with the cache:

if the ClassLoaderResolver cache resources, runtime classloader changes are not going to be effective in datanucleus.

let caching and performance improvements to the underlying classloaders
Erik Bengtson added a comment - 01/Apr/10 10:33 PM
caching of resources removed

Erik Bengtson made changes - 01/Apr/10 10:33 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Erik Bengtson made changes - 01/Apr/10 10:33 PM
Assignee Erik Bengtson [ erik ]
Andy Jefferson made changes - 26/Apr/10 03:37 PM
Status Resolved [ 5 ] Closed [ 6 ]
Andy Jefferson made changes - 04/Oct/12 05:02 PM
Component/s Persistence [ 10200 ]
Component/s JDO [ 10201 ]