<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>iRSS</author_name>
  <author_url>https://blog.hatena.ne.jp/iRSS/</author_url>
  <blog_title>iRSSの日記</blog_title>
  <blog_url>https://irss.hatenablog.com/</blog_url>
  <categories>
    <anon>Android</anon>
  </categories>
  <description>ローカル変数以外は複数のスレッドから共有され得る Javaの変数は，ローカル変数だけがスレッドセーフ（複数のスレッドが同時に動作しても異常をきたさないこと）である。その理由は，ローカル変数はスレッドごとに割り振られる「Javaスタック」と呼ぶメモリー領域に格納されるからだ。これに対して共有メモリーである「ヒープ領域」に格納されるインスタンス変数やクラス変数は，複数のスレッドが共有する可能性があり，スレッドセーフではない。そのため，参照または更新するときにはロック（更新メソッドにsynchronizedキーワードを指定する）などを検討しなければならない 画像キャッシュを、クラス変数に入れているの…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Firss.hatenablog.com%2Fentry%2F20100118%2F1263782098&quot; title=&quot;クラス変数はスレッドセーフにしないといけなさそう - iRSSの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-01-18 11:34:58</published>
  <title>クラス変数はスレッドセーフにしないといけなさそう</title>
  <type>rich</type>
  <url>https://irss.hatenablog.com/entry/20100118/1263782098</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
