Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 10933 invoked from network); 1 Jun 2007 15:53:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jun 2007 15:53:50 -0000 Received: (qmail 80922 invoked by uid 500); 1 Jun 2007 15:53:48 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 80872 invoked by uid 500); 1 Jun 2007 15:53:48 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 80855 invoked by uid 99); 1 Jun 2007 15:53:48 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jun 2007 08:53:48 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of yoavshapira@gmail.com designates 72.14.204.227 as permitted sender) Received: from [72.14.204.227] (HELO qb-out-0506.google.com) (72.14.204.227) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jun 2007 08:53:42 -0700 Received: by qb-out-0506.google.com with SMTP id c7so298004qbc for ; Fri, 01 Jun 2007 08:53:21 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=sBCLxtU4G/JXqsLEslP8CDZVpBM5W/Oh5CCM9i/nRQmvRw70hqYKY3ONP/W3T4/zfvmQZzCzThPYv8wxbvqxJgT+z0lmEYKz3gdYF4+LiJvSBhI5NAPgJBITdoVOEMGN8+KLOJmpeCkEu4s8AGewwzo1XBu0UneVExTPW5vlttI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=HU49W4fea0IMExAP/zB2aJuRxZWegUzQ3t/bdT74EvxbEo4TAm2I5YsjSeQyDCCz7mxE6I2bzT51AqpHWc6Rv66o9393Sy5CigGYQoy1heCPTjcJ6Tx0omIjzh4s4JzPzO3Zxii4duBdSy9x5tRuGGpEMNpkh0jHjFWRwoSnN6E= Received: by 10.65.222.11 with SMTP id z11mr1430449qbq.1180713191858; Fri, 01 Jun 2007 08:53:11 -0700 (PDT) Received: by 10.64.233.11 with HTTP; Fri, 1 Jun 2007 08:53:11 -0700 (PDT) Message-ID: Date: Fri, 1 Jun 2007 11:53:11 -0400 From: "Yoav Shapira" Sender: yoavshapira@gmail.com To: "Tomcat Developers List" Subject: Re: How to load a static class on Tomcat startup In-Reply-To: <150.217.13.52.1027550293.1180713080@webmail.inet.it> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <150.217.13.52.1027550293.1180713080@webmail.inet.it> X-Google-Sender-Auth: 8da24f549142a570 X-Virus-Checked: Checked by ClamAV on apache.org Hey, Use ServletContextListener's contextInitialized method. In it you can do your Class.forName call or whatever other way you want to load the class. This is portable and doesn't depend on Tomcat's internal implementation. Also, this is not a question for the dev mailing list, but for the users mailing list. Please see http://tomcat.apache.org/lists.html and if you have follow-up questions, post them on the users mailing list. Thanks, Yoav On 6/1/07, atreyuas@ngi.it wrote: > Hello everybody, > I want to know how I can configure Tomcat to load a Singleton class on his > startup routine? This class implement a cache that I want to stay in memory > until Tomcat is shutted down. > > I've read about context but it seem to load the class only on a particular URL > request.. > > I want the class to be loaded with Tomcat, without any request is made. > > Thanks to all > > Andrea > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org > For additional commands, e-mail: dev-help@tomcat.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org