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

Поиск
Список
Период
Сортировка
От Matthew Wakeling
Тема Re: How would you store read/unread topic status?
Дата
Msg-id alpine.DEB.2.00.0906231515580.4337@aragorn.flymine.org
обсуждение исходный текст
Ответ на Re: How would you store read/unread topic status?  (Nikolas Everett <nik9000@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Nikolas Everett
Дата:
Сообщение: Re: How would you store read/unread topic status?
Следующее
От: Mathieu Nebra
Дата:
Сообщение: Re: How would you store read/unread topic status?