2011-10-24 38 views
2

我在Heroku上運行compojure。它們每個進程有100個線程的限制。所以當我超過這個限制時,我得到:java.lang.OutOfMemoryError:無法創建新的本地線程。 Compojure正在使用碼頭環適配器。有沒有配置服務器一次只接受一百個線程到servlet?限制Compojure產生的線程數

回答

3

解決方案來自Chris Perkins在compojure google group

(run-jetty app {:configurator #(.setThreadPool % (QueuedThreadPool. 5))}) 

這會在啓動之前將一個QueuedThreadPool(具有五個線程的併發限制)初始化爲碼頭實例。