Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 694 invoked from network); 3 Nov 2004 06:17:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 3 Nov 2004 06:17:33 -0000 Received: (qmail 15533 invoked by uid 500); 3 Nov 2004 06:17:27 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 15490 invoked by uid 500); 3 Nov 2004 06:17:27 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 15477 invoked by uid 99); 3 Nov 2004 06:17:26 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from [62.2.95.247] (HELO smtp.hispeed.ch) (62.2.95.247) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 02 Nov 2004 22:17:25 -0800 Received: from simba. (80-219-17-85.dclient.hispeed.ch [80.219.17.85]) by smtp.hispeed.ch (8.12.6/8.12.6/tornado-1.0) with ESMTP id iA36HMAX002853 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 3 Nov 2004 07:17:22 +0100 Received: (qmail 23234 invoked from network); 3 Nov 2004 07:17:22 +0100 Received: from unknown (HELO localhost) (10.20.30.219) by simba.pati.ch with SMTP; 3 Nov 2004 07:17:22 +0100 Date: Wed, 3 Nov 2004 07:17:20 +0100 (CET) From: Giacomo Pati X-X-Sender: giacomo@lapgp.otego.com To: dev@cocoon.apache.org Subject: Re: Implementation of the Continuations checker In-Reply-To: <418849B4.6050900@reverycodes.com> Message-ID: References: <4183C582.5010004@dslextreme.com> <3AC7F738-2A9D-11D9-AD9E-000D93C1F3E2@hippo.nl> <8D3AA844-2AB4-11D9-AD9E-000D93C1F3E2@hippo.nl> <418849B4.6050900@reverycodes.com> X-GPG-FINGRPRINT: D216 25E0 084A 9090 9BF4 1EC0 3710 05D8 BA4A 9F94 X-GPG-PUBLIC_KEY: http://pks.gpg.cz:11371/pks/lookup?op=get&search=0x371005D8BA4A9F94 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Tue, 2 Nov 2004, Vadim Gritsenko wrote: > Giacomo Pati wrote: >> >> Ok, guys, lets see if we can find a consensus for this issue. >> >> The issues have been: >> >> - Excalibur Event package is deprecated. We need a replacement of those >> functionalities we are in need for the core (scheduling Runnables once, >> with delays, periodically) >> - Some stated that the cron block seems too heavy for that (I take that >> as >> a veto :-) >> - I'd like to have Thread spawning in one single component so that users >> of "sophisticated" EAS can write their own implementation of the >> following proposed interfaces. >> >> A BackgroundManager/AsyncManager (name it as you like) manages >> ThreadPools (named and anonymous ones) and executions of Runnables using >> them: >> >> interface ThreadPool { >> void execute( Runnable command ); >> TYPE getPROPERTY(); // what ever values should be exposed >> } >> >> interface BackgroundManager { >> void execute( Runnable command ); *1 *a >> void execute( Runnable command, >> long delay ); *1 *b >> void execute( Runnable command, >> long delay, >> long period ); *1 *c >> void execute( String threadPoolName, >> Runnable command ); *2 *a >> void execute( String threadPoolName, >> Runnable command, >> long delay ); *2 *b >> void execute( String threadPoolName, >> Runnable command, >> long delay, >> long period ); *2 *c >> ThreadPool createPool( String name, ... ) *3 >> ThreadPool createPool( ... ) *4 >> } >> >> *1 runs a Runnable in the default ThreadPool >> *2 runs a Runnable in a named ThreadPool >> *3 creates a named ThreadPool (shared usage of ThreadPools) >> *4 creates a anonymous ThreadPool (private usage by some client) >> *a runs command once >> *b runs command after a delay >> *c runs command periodically after a delay >> >> A DefaultBackgroundManager implementation will create ThreadPools based >> on one of concurrent-utils Executors depending on the configuration (this >> is ready to use code from the cron block). >> >> The settings of the default ThreadPool will be based on the current >> CommandManager configuration. The configuration of the default ThreadPool >> can be overwritten using normal configuration methods (see >> src/blocks/cron/conf/cron.xconf adding a name attribute). Named >> ThreadPools can be created at strartup by configuration. >> >> What do you think about this as a replacement for the Event package? > > Looks good to me (disclaimer: I've not examined event pacjage). One question: > why multiple thread pools? Have you looked at the thread pool in the cron block? A thread pool consists of: - max. # of threads that run simultaneously - a possible queue to stack up ready to run Runnables If you have a lot of short living Runnables at low priority (logically) you'd prefere to have a thread pool with only a few threads ready but a large queue. If you have some long running jobs to be done you'd like to have a pool of many threads. Thread pools is the way to balance "work to be done" with "resources needed for". -- Giacomo Pati Otego AG, Switzerland - http://www.otego.com Orixo, the XML business alliance - http://www.orixo.com