Tracker: Patches

5 Reduce locking on the class cache - ID: 3514821
Last Update: Comment added ( ddekany )

Same goal as https://github.com/freemarker/freemarker/pull/2 however it would be nice if this were part of 2.3.x. Please find attached patch.


Johno Crawford ( jokerrrr ) - 2012-04-04 02:28:02 PDT

5

Open

None

Nobody/Anonymous

None

None

Public


Comments ( 5 )

Date: 2013-04-07 18:33:31 PDT
Sender: ddekanyProject Admin

To be clear, actually I haven't used this patch, as I did other
refactorings too. But it uses ConcurrentHashMap when available, so it's
similar in that respect.


Date: 2013-04-07 18:31:16 PDT
Sender: ddekanyProject Admin

This is now fixed in the 2.3.x head. However, 2.3.20 is only expected on
the end of May. But until that, I think it's already safe to use.


Date: 2013-02-11 12:55:58 PST
Sender: ddekanyProject Admin

I believe it's not safe to call those methods outside synchronization,
because the new items are added to the map concurrently. Or is there
something in the API that says otherwise?

But anyway, decreasing locking on the class cache is hight priority TODO,
so whenever 2..3.20 is released it will be almost surely part of it. (The
problem that will addressed there is that the map remains locked during
introspection. After all, doing a Map.get inside sync. block is not a big
deal, until the instrospection starts blocking gets. Using
ConcurrentHashMap on Java 1.5+ was also considered, but I'm nor sure what
was the result... maybe that it's overhead killed its advantage if there's
was no long locking anyway.)


Date: 2012-04-26 02:02:40 PDT
Sender: ddekanyProject Admin

I have just attached your patch (sent to me in e-mail) that should be
backward compatible...


Date: 2012-04-05 02:47:58 PDT
Sender: ddekanyProject Admin

It imports imports java.util.concurrent.ConcurrentHashMap... that's there
only since J2SE 1.5. 2.3.x only requires 1.2.


Attached Files ( 3 )

Filename Description Download
0001-Reduce-locking-on-the-class-cache.patch Reduce locking on the class cache Download
Patch_for_reducing_locking_on_the_class_cache_BC.patch Johno Crawford's 2nd bacward-compatible patch Download
Backwards_compat_patch_for_reducing_locking_on_the_class_cache.patch Moved ConcurrentMapFactory to utility package Download

Changes ( 5 )

Field Old Value Date By
File Added 442931: Backwards_compat_patch_for_reducing_locking_on_the_class_cache.patch 2012-05-07 16:14:34 PDT jokerrrr
File Deleted 442930: 2012-05-07 16:12:25 PDT jokerrrr
File Added 442930: Backwards_compat_patch_for_reducing_locking_on_the_class_cache.patch 2012-05-07 15:57:29 PDT jokerrrr
File Added 442137: Patch_for_reducing_locking_on_the_class_cache_BC.patch 2012-04-26 02:01:26 PDT ddekany
File Added 440248: 0001-Reduce-locking-on-the-class-cache.patch 2012-04-04 02:28:08 PDT jokerrrr