Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1091423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:31:31+00:00 2026-05-16T23:31:31+00:00

I’m trying to extend the Clojure language to extend ACI-guaranteed refs to ACID-guaranteed drefs

  • 0

I’m trying to extend the Clojure language to extend ACI-guaranteed refs to ACID-guaranteed drefs (durable refs). The API is to simply to call (dref key value), where key is a String of the key to be used in the underlying data store (BDB JE in my current implementation), and value is the Object that the dref should be initialized to. If key already exists in the DB, the stored value is used instead.

Multiple drefs can be created with the same key, and they need to be synchronized, i.e. if one dref with key “A” participates in a transaction where it is written or read with an (ensure), all other drefs with key “A” must be transactionally synchronized: read-locks and write-locks must be used to impose ordering on transactions involving those drefs. In a larger sense, although there may be more than one in-memory dref with the same key, all of those drefs with that key are a single logical object.

For obvious reasons, it’s much easier to simply ensure that this single logical dref is implemented with a single concrete in-memory dref. That way there’s nothing to synchronize. How do I do this?

The obvious answer is to use an object pool keyed on key. Then Clojure will call the static getInstance(key,value) method to retrieve from the pool if it exists, and create it and populate the pool if not. The problem with this approach is that there’s no easy way to get Clojure to release the object when it’s done. Memory-leak city. I have to ensure that any object with strong references to it will not be collected, and that they exist in the pool. It would be disastrous if the pool loses references to logical drefs that are still in use, since another process could create a new dref with the same key, and it wouldn’t be transactionally safe with the other dref with the same key.

So I need some version of the WeakHashMap or something using not-strong references (I would prefer SoftReferences for a little more reluctance by the GC). So:

  1. If I use a HashMap<String,SoftReference<DRef>>, how do I ensure that the map will evict entries if the value of the entry (SoftReference) is collected? Some sort of daemon thread?
  2. How do I make the pool thread-safe for the GC? Or do I not have to worry about that since the GC is operating at the SoftReference level and my daemon thread would be the one operating at the Map level?
  3. On a related note, how do I make sure that the daemon thread is running? Is there any way that it can stop without throwing an exception that will crash the entire JVM if uncaught? If so, how do I monitor and start a new one if needed?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:31:32+00:00Added an answer on May 16, 2026 at 11:31 pm

    Have you try google-collections?

    They have a MapMaker that gives variations of concurrent hash maps with soft/weak keys and values.
    One problem is that equality for Weak/Soft key is identity, which is annoying but maybe not too much if the key is a String.

    Other libraries does that I believe (org.apache.commons.collections but I never used them).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.