<< Back to previous view

[CLJ-416] improvments on agent Created: 30/Jul/10  Updated: 01/Mar/13  Resolved: 27/Nov/12

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: None
Fix Version/s: Backlog

Type: Enhancement
Reporter: Anonymous Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

hi,i have some ideas to improve the agent system:
1.Agent's thread pool must use a custom ThreadFactory to new threads.Set new thread a system name and set it to be daemon.Thread's name would be used for debug or monitor.And set thread to be daemon asking user to shutdown agents explicitly.

2.Beacause agent's thread is daemon,so if a application doesn't use any agents,the thread pool must not started.I think the agent's thread pools should be lazy initialized.

3.I think agent must allow use to define a agent-own thread pool.That thread pool is only used by a agent,not global.just like:
(define a (agent :executor (java.util.concurrent.Executors/newFixedThreadPool 2)))
or
(set-executor! a (java.util.concurrent.Executors/newFixedThreadPool 2))
And then,a new function to shutdown agent's custom thread pool:
(shutdown-agent a)

Why do we need a custom thread pool?
First, the default thread pool is global, send use the thread pool
is a fixed size cpus +2, is likely to become the system bottleneck
sometime. Although you can use the send-off, use the cache thread
pool, but in a real world application, I can not use the cache thread
pool, which will introduce the risk of OutOfMemoryError, normally I
like to use a fixed-size thread pool.

Second, the actions which global thread pool execute are from a
variety of agents, the actions are not homogeneous, and can not
maximize the efficient use of the thread pool.

These are my suggestions on agent,thanks for this great language,i enjoy it.



 Comments   
Comment by Assembla Importer [ 24/Aug/10 6:42 PM ]

Converted from http://www.assembla.com/spaces/clojure/tickets/416

Comment by Timothy Baldridge [ 27/Nov/12 2:18 PM ]

Closing as "completed" as most of these requests are handled in 1.5 via the new send-via, and set executor functions.

Generated at Tue Sep 02 07:28:51 CDT 2014 using JIRA 4.4#649-r158309.