You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
以前、このような記事を書きました。 Concurrency Utilitiesを使った並列処理・マルチスレッドのおさらい (2013-12-26) 前回の内容は、Concurrency UtilitiesだけでなくJavaのマルチスレッドの話も一部含んでいましたが、今回は、Concurrency Utilitiesだけにフォーカスして、全体が分かるように整理してまとめ直しました。 目次 概要 準備 タスク・フレームワーク (Executor) 同期キュー シンクロナイザー 並行処理コレクション 時間単位 アトミック値型とアトミック操作 ロック・フレームワーク 概要 今回は、Concurrency UtilitiesのAPIをいくつかのグループに分類し、それぞれのグループの主要な機能を「広く浅く」紹介する、という形式でまとめています。 パッケージ単位で分け、それからjava.util.con
一ヶ月ほどまえに Java 8 がリリースされました。ラムダも入ったことだし、お試しがてらゴールデンウィーク中に asterisque* の Scala コードの一部を Java で書き換える作業などを行っております。 ただまぁ asterisque* は非同期 RPC フレームワークですので、ラムダだけでなく Scala の Promise, Future もあちこちで使っています。うーんこいつらの互換性どうしようかなーと悩んでいたところ Java 8 に CompletableFuture というクラスが追加されいるのに気づきました。ざっと API リファレンスを読む限り以下のような特徴があります。 Scala の Future と同様に非同期処理間で成功 (計算結果) または失敗 (例外) を渡すことが出来る。 複数の処理スレッドで共有することも想定していて、早い者勝ちで結果を出すよ
この他にも "サービスを受けるのを待つ人が,キューの中に立っている平均時間はどれくらいか?" といったような疑問に,Littleの法則で答をだすといった内容のゲームは,他にもたくさんあります。 図1. Littleの法則 同じようにLittleの法則は,スレッドプールサイズの決定にも使うことができます。私たちがしなければならないのは,リクエストの到着率と,サービスに必要な平均時間を測定することです。そうすれば,これらの値をLittleの法則に挿入して,システムの平均要求数が計算されます。その数値がスレッドプールのサイズよりも小さければ,その結果に従ってプールのサイズを小さくすることが可能なのです。逆に計算結果がスレッドプールのサイズよりも大きい時には,問題はもう少し複雑になります。 実行中のリクエストより待ち状態のリクエストの数が多い場合,まず最初に判断しなければならないのは,もっと大きな
ThreadとHashMapに潜む無限回廊は実に面白い?:現場から学ぶWebアプリ開発のトラブルハック(10)(1/3 ページ) 本連載は、現場でのエンジニアの経験から得られた、APサーバをベースとしたWebアプリ開発における注意点やノウハウについて解説するハック集である。現在起きているトラブルの解決や、今後の開発の参考として大いに活用していただきたい。(編集部) マルチスレッドのトラブルハックはさっぱり分からない… 対処が難しいトラブルといえば、GC(ガベージ・コレクション)とマルチスレッド処理に起因することが多い。 前々回(「肥え続けるTomcatと胃を痛めるトラブルハッカー 」)と前回(「JavaのGC頻度に惑わされた年末年始の苦いメモリ」)の2回にわたってGC、特にメモリ周りのトラブルを取り上げた。そこで今回は、マルチスレッド処理のトラブルの1つ、「レースコンディション(競合状態)
はじめに Java SE 6時点では、マルチスレッドプログラミングを行う素材として、当初から持つThreadクラスと、Java 5で追加されたjava.util.concurrentパッケージがあります。また、Swing GUI上でスレッドを扱うjavax.swing.SwingWorkerクラスもJava SE 6から追加されています。 Java SE 6におけるスレッドの生成方法 java.lang.Threadクラスのインスタンスをnewで生成し、start()メソッドを呼ぶ java.util.concurrent.Executorインタフェースを実装するクラスのインスタンスを取得し、execute()などの別スレッドで実行を依頼するメソッドを呼ぶ javax.swing.SwingWorkerクラスのサブクラスを定義し、そのインスタンスをnewで生成し、Swingスレッド(Eve
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く