Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 83931 invoked by uid 500); 19 Nov 2001 14:17:41 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 83920 invoked from network); 19 Nov 2001 14:17:40 -0000 Message-ID: <3BF914E3.8010009@apache.org> Date: Mon, 19 Nov 2001 09:19:15 -0500 From: Berin Loritsch User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.5) Gecko/20011011 X-Accept-Language: en-us MIME-Version: 1.0 To: cocoon-dev@xml.apache.org Subject: Re: StoreJanitorImpl runs forever? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Gerhard Froehlich wrote: > Hi, > >>>Hi >>>I have a question regarding StoreJanitorImpl. >>>As I see in the source StoreJanitorImpl implements only >>>Runnable. >>>As I was using org.apache.cocoon.Main it seems that >>>after all work is done StoreJanitorImpl stays running, >>>this prevents org.apache.cocoon.Main to terminate even >>>after the Cocoon.dispose() call. >>> >> >>If this is the case, then we need to do one of two things: >> >>1) Have StoreJanitor implement Startable (allowing it to >> be explicitly started and stopped, safely) >>2) Call thread.setDaemon(true) if no cleanup is necessary. >> > #1 I will take a look. But I need some re-read of the avalon > dev docs. > #2 is already set RE #2: JVM issues? RE #1: The way I typically do this is a case like this: class StartableDemo implements Startable, Runnable { private static boolean m_continue = true; public void start() { new Thread(this).start(); } public void run() { while (m_continue) { // do important stuff } } public void stop() { m_continue = false; } } In this case, MRUStore will start this up like: initialize() { this.janitor = new StartableDemo(); this.janitor.start(); } dispose() { this.janitor.stop(); this.janitor = null; // remove reference so it can be garbage collected } -- "Those who would trade liberty for temporary security deserve neither" - Benjamin Franklin --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org