Java ConcurrentWeakHashMap

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Java ConcurrentWeakHashMap

i hack
I can't find one in the JDK.
Guava has one similar but it uses identity, I need it with equality.


I came across these on the mailing list (from 3 1/2 yrs ago...):

But don't know what is the best option, if there is one, as of today, to use a ConcurrentWeakHashMap, without rolling my own.

Thanks,
IDC 

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Java ConcurrentWeakHashMap

Shevek
It may be a bit heavier than you require, but CacheBuilder can use
weakKeys and is concurrent.

S.

On 08/01/2016 12:30 PM, i hack wrote:

> I can't find one in the JDK.
> Guava has one similar but it uses identity, I need it with equality.
>
> http://stackoverflow.com/questions/2255950/is-there-java-concurrent-util-or-equivalent-for-weakhashmap
> http://stackoverflow.com/questions/31875264/is-there-a-non-jdk-implementation-for-a-concurrent-weak-hash-map
>
> I came across these on the mailing list (from 3 1/2 yrs ago...):
> http://concurrency.markmail.org/search/?q=weakconcurrenthashmap#query:weakconcurrenthashmap%20order%3Arelevance+page:1+mid:swesuutrmb44jt2y+state:results
> http://gee.cs.oswego.edu/dl/jsr166/dist/extra166ydocs/
>
> But don't know what is the best option, if there is one, as of today, to
> use a ConcurrentWeakHashMap, without rolling my own.
>
> Thanks,
> IDC
>
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Java ConcurrentWeakHashMap

Benjamin Manes
In reply to this post by i hack
Guava's internally has a pluggable equality mechanism, but only exposes identity as the most applicable in the observed use-cases. See Interners#newWeakInterner() where equality is leveraged. It was difficult to find other use-cases where equality was the correct choice, so to reduce maintenance burden and user error the capability wasn't externalized.

There are a lot of other implementations though, e.g. search for ConcurrentReferenceHashMap.

On Mon, Aug 1, 2016 at 12:30 PM, i hack <[hidden email]> wrote:
I can't find one in the JDK.
Guava has one similar but it uses identity, I need it with equality.


I came across these on the mailing list (from 3 1/2 yrs ago...):

But don't know what is the best option, if there is one, as of today, to use a ConcurrentWeakHashMap, without rolling my own.

Thanks,
IDC 

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest



_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Java ConcurrentWeakHashMap

Peter
In reply to this post by i hack
 
Hmm,

Would a non blocking concurrent decorator, that lets you choose identity or equality, with any ConcurrentMap implementation of your choice suffice?

Separation of concerns.

You can also choose weak, soft, timed or strong references for keys, values or entry's in any Java Collections implementation.

It can be dependency injected so your object thinks it's using a ConcurrentMap, or any other Java Collections interface for that matter.  And you can change the decorated underlying implementation to which ever one works best for you.

Regards,

Peter.

Sent from my Samsung device.
 
---- Original message ----
From: Shevek <[hidden email]>
Sent: 02/08/2016 05:53:58 am
To: [hidden email]
Subject: Re: [concurrency-interest] Java ConcurrentWeakHashMap

It may be a bit heavier than you require, but CacheBuilder can use 
weakKeys and is concurrent.

S.

On 08/01/2016 12:30 PM, i hack wrote:

> I can't find one in the JDK.
> Guava has one similar but it uses identity, I need it with equality.
>
> http://stackoverflow.com/questions/2255950/is-there-java-concurrent-util-or-equivalent-for-weakhashmap
> http://stackoverflow.com/questions/31875264/is-there-a-non-jdk-implementation-for-a-concurrent-weak-hash-map
>
> I came across these on the mailing list (from 3 1/2 yrs ago...):
> http://concurrency.markmail.org/search/?q=weakconcurrenthashmap#query:weakconcurrenthashmap%20order%3Arelevance+page:1+mid:swesuutrmb44jt2y+state:results
> http://gee.cs.oswego.edu/dl/jsr166/dist/extra166ydocs/
>
> But don't know what is the best option, if there is one, as of today, to
> use a ConcurrentWeakHashMap, without rolling my own.
>
> Thanks,
> IDC
>
>
> _______________________________________________
> Concurrency-interest mailing list
[hidden email]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest



_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest