Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5563391A6 for ; Mon, 20 Feb 2012 07:45:53 +0000 (UTC) Received: (qmail 10637 invoked by uid 500); 20 Feb 2012 07:45:52 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 9220 invoked by uid 500); 20 Feb 2012 07:45:38 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 9161 invoked by uid 99); 20 Feb 2012 07:45:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Feb 2012 07:45:36 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_HI,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [141.146.126.227] (HELO acsinet15.oracle.com) (141.146.126.227) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Feb 2012 07:45:25 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q1K7j3lF015617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Feb 2012 07:45:04 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q1K7j3uw005597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 20 Feb 2012 07:45:03 GMT Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q1K7j3Do021819 for ; Mon, 20 Feb 2012 01:45:03 -0600 Received: from [192.168.0.3] (/84.215.180.161) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 19 Feb 2012 23:45:03 -0800 Message-ID: <4F41F9FA.7060806@oracle.com> Date: Mon, 20 Feb 2012 08:44:58 +0100 From: Kristian Waagan User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: derby-user@db.apache.org Subject: Re: Shutdown DB does not work / threadding issue References: <47490538.72a5qhe2mF@venus> In-Reply-To: <47490538.72a5qhe2mF@venus> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090205.4F41FA00.0073,ss=1,re=0.000,fgs=0 X-Virus-Checked: Checked by ClamAV on apache.org On 18.02.2012 15:45, Karl Weber wrote: > Hi, > > I am using Derby DB in an embedded environment. I am shutting down the DB and > the system using the following two methods (I have ommitted all try-catch- > finally stuff, logging etc.) > > Shutting down the DB, where fDS is an EmbeddedDataSource40: > > public void shutdownDB() { > fDS.setShutdownDatabase("shutdown"); > fDS.getConnection().close(); > } > > Shutting down the system: > > public void shutdownDerby() { > DriverManager.getConnection("jdbc:derby:;shutdown=true"); > } > > This works, if it is done on the thread that is shutting down my OSGi > component, which encapsulates Derby, i.e. the deactivate-method called by the > OSGi framework. This does, however, _not_ work, if it is put in a separate > thread in the deactivate-method, as in > > new Thread(new Runnable() { > @Override > public void run() { > shutdownBD(); > shutdownDerby(); > } > }).start(); > > In this case, the Runnable stops at the statement > > fDS.getConnection().close(); Hi, When you say stops, do you mean the thread is blocking/hanging? If so, can you obtain a stack trace? Regards, -- Kristian > > No Throwable is thrown. Nevertheless, the DB does not seem to be stopped > correctly, as in the latter case (only) I find the two files dbex.lck and > db.lck in the DB folder. > > Right before this "last" statement is called, I have around 12 threads > running, so the thread running the Runnable will most probably not be the last > thread in the JVM, if that matters. > > For some reason I would like to shutdown things asynchroneously. What do I > miss here? > > I am using Derby 10.8.2.2. > > /Karl