For that, look up Executors in Java. They'll have exactly what you are
looking for. Create a new fixed sized executor:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Executors.html

They expect Runnable objects, but clojure Fns implement Runnable, so you
can simply pass the executor a (fn []) that wraps up all the data needed
for the task.

Timothy


On Mon, Feb 11, 2013 at 2:48 PM, Ari <ari.brandeis.k...@gmail.com> wrote:

> From what I understand, futures would work. But is there a way to limit
> thread creation to a predetermined pool size? I'm concerned as more files
> are uploaded the continual future calls would soon overwhelm the system.
>
> -Ari
>
>
> On Monday, February 11, 2013 11:54:19 AM UTC-5, Zack Maril wrote:
>>
>> Is there any reason why a future wouldn't work?
>> http://clojuredocs.org/**clojure_core/clojure.core/**future<http://clojuredocs.org/clojure_core/clojure.core/future>
>> -Zack
>>
>> On Monday, February 11, 2013 8:50:03 PM UTC+4, Ari wrote:
>>>
>>> Hi,
>>>
>>> I'd like my web application to process uploaded text files in the
>>> background; in which ways can I accomplish this? I thought of using a
>>> message queue like 0mq to push jobs to workers within the web app itself.
>>> While relatively straight forward this option seems a bit involved.
>>> Suggestions/recommendations appreciated.
>>>
>>> Best,
>>> Ari
>>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to