問題タブ [threadpoolexecutor]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - スレッドプールを使用した Java NIO Http クライアント要求
Thread Pool Executor は、Future Task に多数のスレッドを使用します。run() または call() が戻るまで、少なくとも 1 つのスレッドを割り当てます。
そのため、JAVA NIO HTTP リクエストにスレッド プールを使用する方法について混乱しています。
1) イベントループを実行するスレッド
2) スレッドは IO でブロックされないため、run/call メソッドを終了します。次に、ハンドラーの呼び出しを担当するのは誰ですか。
私の質問は、Java NIO ベースの HTTP POST クライアント リクエストをスレッド プールで使用する方法です (作成する必要がある HTTP リクエストの数が多いため)。スレッドは決してスリープしません (ブロックするものがないため、常に実行されます)
java - Testing PriorityBlockingQueue in ThreadPoolExecutor
I realized my ThreadPoolExecutor with PriorityBlockingQueue like in this example: https://stackoverflow.com/a/12722648/2206775
and wrote a test:
But in the end, I don't get 1 2 3 4 5, I get a random order of those numbers. Is there a problem with the test, or something else? And if first, how can it be tested correctly?