eGospodarka.pl
eGospodarka.pl poleca

eGospodarka.plGrupypl.comp.programmingOpowiadanie o GC › Re: Opowiadanie o GC
  • Path: news-archive.icm.edu.pl!news.rmf.pl!nf1.ipartners.pl!ipartners.pl!plix.pl!newsf
    eed1.plix.pl!newsfeed00.sul.t-online.de!t-online.de!border2.nntp.dca.giganews.c
    om!nntp.giganews.com!postnews.google.com!s31g2000yqs.googlegroups.com!not-for-m
    ail
    From: Piotr Lipski <l...@g...com>
    Newsgroups: pl.comp.programming
    Subject: Re: Opowiadanie o GC
    Date: Tue, 4 Aug 2009 14:01:38 -0700 (PDT)
    Organization: http://groups.google.com
    Lines: 54
    Message-ID: <9...@s...googlegroups.com>
    References: <t...@4...com>
    <1...@2...googlegroups.com>
    <h4s021$8ca$1@mx1.internetia.pl>
    <n...@4...com>
    <h4s5hh$h68$1@mx1.internetia.pl>
    <b...@4...com>
    <h4saip$1bg$1@mx1.internetia.pl>
    <1...@4...com>
    <8...@o...googlegroups.com>
    <l...@4...com>
    <7...@n...googlegroups.com>
    <3...@k...googlegroups.com>
    <6...@r...googlegroups.com>
    <1...@k...googlegroups.com>
    <b...@s...googlegroups.com>
    NNTP-Posting-Host: 83.25.205.126
    Mime-Version: 1.0
    Content-Type: text/plain; charset=ISO-8859-2
    Content-Transfer-Encoding: quoted-printable
    X-Trace: posting.google.com 1249419698 12825 127.0.0.1 (4 Aug 2009 21:01:38 GMT)
    X-Complaints-To: g...@g...com
    NNTP-Posting-Date: Tue, 4 Aug 2009 21:01:38 +0000 (UTC)
    Complaints-To: g...@g...com
    Injection-Info: s31g2000yqs.googlegroups.com; posting-host=83.25.205.126;
    posting-account=3TlxoAoAAABULs0oP0Nw6j6Ph_3b_y9Z
    User-Agent: G2/1.0
    X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5
    (KHTML, like Gecko) Chrome/2.0.172.37
    Safari/530.5,gzip(gfe),gzip(gfe)
    Xref: news-archive.icm.edu.pl pl.comp.programming:183009
    [ ukryj nagłówki ]

    > > To czy get jest operacją modyfikującą jest szczegółem implementacji.
    >
    > To nie jest szczegół implementacji, bo od tego zależy, czy wolno robić
    > wiele get równolegle.

    Jest szczegółem - dokumentacja wyraźnie mówi:

    "Because the garbage collector may discard keys at any time, a
    WeakHashMap may behave as though an unknown thread is silently
    removing entries. In particular, even if you synchronize on a
    WeakHashMap instance and invoke none of its mutator methods, it is
    possible for the size method to return smaller values over time, for
    the isEmpty method to return false and then true, for the containsKey
    method to return true and later false for a given key, for the get
    method to return a value for a given key but later return null, for
    the put method to return null and the remove method to return false
    for a key that previously appeared to be in the map, and for
    successive examinations of the key set, the value collection, and the
    entry set to yield successively smaller numbers of elements."

    > > Istotne jest, że w pewnym momencie jakiś obiekt zawarty w WeakHashMap
    > > jest "weakly reachable". Można więc "go" usunąć z mapy.
    > > Skąd wiadomo, że jest "weakly reachable"? - zaglądamy do dokumentacji
    > > WeakReference:
    >
    > *To* jest właśnie szczegół implementacji. Specyfikacja WeakHashMap nie
    > mówi nic o tym, że używa WeakReference.

    "Each key object in a WeakHashMap is stored indirectly as the referent
    of a weak reference. Therefore a key will automatically be removed
    only after the weak references to it, both inside and outside of the
    map, have been cleared by the garbage collector."

    Jak wół: weak reference.

    > Żeby się dowiedzieć, czy wolno robić wiele get równolegle, nie powinno
    > być konieczności zastanawiania się, jak WeakHashMap może być
    > zaimplementowane. To powinno wynikać ze specyfikacji.

    Jest *to* wyraźnie napisane.

    > > Dokumentacja jest super. Ty jej nie doczytałeś ;-)
    >
    > Nie jest.

    Dokumentacja jest super. Ty jej nie doczytałeś ;-)

    PL

Podziel się

Poleć ten post znajomemu poleć

Wydrukuj ten post drukuj


Następne wpisy z tego wątku

Najnowsze wątki z tej grupy


Najnowsze wątki

Szukaj w grupach

Eksperci egospodarka.pl

1 1 1

Wpisz nazwę miasta, dla którego chcesz znaleźć jednostkę ZUS.

Wzory dokumentów

Bezpłatne wzory dokumentów i formularzy.
Wyszukaj i pobierz za darmo: