Re: How would you store read/unread topic status? - Mailing list pgsql-performance

From Matthew Wakeling
Subject Re: How would you store read/unread topic status?
Date
Msg-id alpine.DEB.2.00.0906231515580.4337@aragorn.flymine.org
Whole thread Raw
In response to Re: How would you store read/unread topic status?  (Nikolas Everett <nik9000@gmail.com>)
List pgsql-performance
On Tue, 23 Jun 2009, Nikolas Everett wrote:
> If you happen to be using Java, HashMap and TreeMap are perfect for this
> because they are reentrant so you don't have to worry about
> synchronizing your sweeper with your web page activities.

See the note in http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html

> "Note that this implementation is not synchronized."

If you have multiple threads accessing a TreeMap or HashMap, then they
must be synchronised to ensure that only one thread at a time is accessing
it. Otherwise, you may suffer severe data loss and possibly even JVM
crashes. Perhaps you meant java.util.concurrent.ConcurrentHashMap?

Be very careful.

Matthew

--
 Now, you would have thought these coefficients would be integers, given that
 we're working out integer results. Using a fraction would seem really
 stupid. Well, I'm quite willing to be stupid here - in fact, I'm going to
 use complex numbers.                    -- Computer Science Lecturer

pgsql-performance by date:

Previous
From: Nikolas Everett
Date:
Subject: Re: How would you store read/unread topic status?
Next
From: Mathieu Nebra
Date:
Subject: Re: How would you store read/unread topic status?