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)
Список: pgsql-performance

Скрыть дерево обсуждения

How would you store read/unread topic status?  (Mathieu Nebra, )
 Re: How would you store read/unread topic status?  (Andres Freund, )
  Re: How would you store read/unread topic status?  (Mathieu Nebra, )
   Re: How would you store read/unread topic status?  (Robert Haas, )
    Re: How would you store read/unread topic status?  (Mathieu Nebra, )
     Re: How would you store read/unread topic status?  (Robert Haas, )
     Re: How would you store read/unread topic status?  (Mike, )
     Re: How would you store read/unread topic status?  (Mike, )
   Re: How would you store read/unread topic status?  (Andres Freund, )
    Re: How would you store read/unread topic status?  (Robert Haas, )
   Re: How would you store read/unread topic status?  (Scott Carey, )
    Re: How would you store read/unread topic status?  (Greg Stark, )
     Re: How would you store read/unread topic status?  (Mathieu Nebra, )
      Re: How would you store read/unread topic status?  (Craig James, )
       Re: How would you store read/unread topic status?  (Mathieu Nebra, )
      Re: How would you store read/unread topic status?  (Greg Stark, )
 Re: How would you store read/unread topic status?  (Alexander Staubo, )
  Re: How would you store read/unread topic status?  (Andres Freund, )
  Re: How would you store read/unread topic status?  (Nikolas Everett, )
   Re: How would you store read/unread topic status?  (Matthew Wakeling, )
  Re: How would you store read/unread topic status?  (Mathieu Nebra, )
   Re: How would you store read/unread topic status?  (Guillaume Cottenceau, )
   Re: How would you store read/unread topic status?  (Chris St Denis, )
    Re: How would you store read/unread topic status?  (Mathieu Nebra, )
 Re: How would you store read/unread topic status?  (justin, )
 Re: How would you store read/unread topic status?  (Grzegorz Jaśkiewicz, )
 Re: How would you store read/unread topic status?  (Scott Carey, )
 Re: How would you store read/unread topic status?  (Alexander Staubo, )

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 по дате сообщения:

От: Alexander Staubo
Дата:
Сообщение: Re: How would you store read/unread topic status?
От: Alan McKay
Дата:
Сообщение: Re: processor running queue - general rule of thumb?