有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

JavaErlang线程池

使用Erlang,如何实现java线程池

与JavaAPI一样,ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)

我可以定义核心线程终止线程的时间,并定义策略以放弃/拒绝任务

我使用这个池向其他服务发送http请求。如果远程服务器关闭,Java系统仍将保持稳定

我尝试了ErlangGen_server和用户gen_server:cast来处理请求

gen_server

  it will control the process and make the system stable.

问题是

   1.  how to kill the process if it take too long?
   2.  how define policy to discard/reject request?
   3.  is that possible to limit the total process?

共 (1) 个答案

  1. # 1 楼答案

    我建议您查看Github上为erlang标记的worker-pool{a1}。我觉得worker_pool可能适合你。它有一个(见溢出)和三个(见大小)需求