jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
castor
  • castor
  • CASTOR-2940 Replace Hashtable and synchronized Ha...
  • CASTOR-3155

Improve synchronization/locking at TimeLimited cache

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.3.2
  • Fix Version/s: 1.3.3rc1
  • Component/s: JDO
  • Labels:
    None
  • Number of attachments :
    3
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    patch-C3155-20110724.txt
    23/Jul/11 10:26 PM
    9 kB
    Wensheng Dou
  2. Text File
    patch-C3155-20110725.txt
    25/Jul/11 12:39 PM
    10 kB
    Ralf Joachim
  3. Text File
    patch-C3155-20110727.txt
    27/Jul/11 4:46 AM
    9 kB
    Ralf Joachim

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Wensheng Dou added a comment - 23/Jul/11 10:26 PM

In this patch, use ConcurrentHashMap to improve the performance.

Show
Wensheng Dou added a comment - 23/Jul/11 10:26 PM In this patch, use ConcurrentHashMap to improve the performance.
Hide
Permalink
Ralf Joachim added a comment - 25/Jul/11 12:39 PM

Slightly improved patch.

At TimeLimited.put() the internal map has been accessed twice. This prevented some construction of QueueItem instances and therefore reduced garbage collection. While this was good idea when put method has been synchronized it could have produced unpredictable results without the synchronization. At least its difficult to understand what may happen.

This change also allowed some other improvements to QueueItemand tick() method.

What's your opinion on these changes?

Show
Ralf Joachim added a comment - 25/Jul/11 12:39 PM Slightly improved patch. At TimeLimited.put() the internal map has been accessed twice. This prevented some construction of QueueItem instances and therefore reduced garbage collection. While this was good idea when put method has been synchronized it could have produced unpredictable results without the synchronization. At least its difficult to understand what may happen. This change also allowed some other improvements to QueueItemand tick() method. What's your opinion on these changes?
Hide
Permalink
Wensheng Dou added a comment - 25/Jul/11 9:45 PM

Yes, very good improvement, thanks.
My patch made the code more difficult to understand, especially for the twice access and volitable value. Your improvement simplifies the code, and make it more understandable.

Show
Wensheng Dou added a comment - 25/Jul/11 9:45 PM Yes, very good improvement, thanks. My patch made the code more difficult to understand, especially for the twice access and volitable value. Your improvement simplifies the code, and make it more understandable.
Hide
Permalink
Ralf Joachim added a comment - 27/Jul/11 4:46 AM

Last patch has some problems if put() gets called during tick() method. New patch should solve this problem.

Show
Ralf Joachim added a comment - 27/Jul/11 4:46 AM Last patch has some problems if put() gets called during tick() method. New patch should solve this problem.
Hide
Permalink
Wensheng Dou added a comment - 27/Jul/11 4:57 AM

Yes, the new patch will work well. And the usage of putIfAbsent is very clever Thanks.

Show
Wensheng Dou added a comment - 27/Jul/11 4:57 AM Yes, the new patch will work well. And the usage of putIfAbsent is very clever Thanks.

People

  • Assignee:
    Wensheng Dou
    Reporter:
    Ralf Joachim
Vote (0)
Watch (0)

Dates

  • Created:
    22/Jul/11 4:52 AM
    Updated:
    27/Jul/11 5:00 AM
    Resolved:
    27/Jul/11 5:00 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.