固定のスレッドプール サイズで singleton-ExecutorService を作成したいと考えています。別のスレッドがその ExecutorService に Callables をフィードし、実行が完了した直後に Callables の結果を (最適に) 解析したいと考えています。
これを適切に実装する方法が本当にわかりません。私の最初の考えは、「submit(callable)」を介して Callable を ExecutorService に追加し、結果の Future をシングルトン内の HashMap または ArrayList 内に格納する、シングルトン ES のメソッドでした。別のスレッドは、指定された間隔内の結果について Futures をチェックします。
しかし、どういうわけか、この解決策は「適切に感じられない」ものであり、このユースケースの解決策を他の場所で見つけられなかったので、後で後悔することをコーディングする前に皆さんに尋ねています。この問題にどのように取り組みますか?
私はあなたの応答を楽しみにしています!