Re: How would you store read/unread topic status?

From: Matthew Wakeling <matthew(at)flymine(dot)org>
To: Nikolas Everett <nik9000(at)gmail(dot)com>
Cc: Alexander Staubo <alex(at)bengler(dot)no>, Mathieu Nebra <mateo21(at)siteduzero(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: How would you store read/unread topic status?
Date: 2009-06-23 14:20:19
Message-ID: alpine.DEB.2.00.0906231515580.4337@aragorn.flymine.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Mathieu Nebra 2009-06-23 14:54:00 Re: How would you store read/unread topic status?
Previous Message Nikolas Everett 2009-06-23 14:11:33 Re: How would you store read/unread topic status?