Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 26840 invoked from network); 18 Aug 2010 19:55:13 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Aug 2010 19:55:13 -0000 Received: (qmail 43056 invoked by uid 500); 18 Aug 2010 19:55:13 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 42983 invoked by uid 500); 18 Aug 2010 19:55:12 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 42975 invoked by uid 99); 18 Aug 2010 19:55:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Aug 2010 19:55:11 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of niparasc@gmail.com designates 209.85.161.171 as permitted sender) Received: from [209.85.161.171] (HELO mail-gx0-f171.google.com) (209.85.161.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Aug 2010 19:55:04 +0000 Received: by gxk6 with SMTP id 6so421241gxk.16 for ; Wed, 18 Aug 2010 12:54:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=LcPA6Jw+DHb5KCS/2OTBAYoflSP14WkPw/k2KukRDzk=; b=Mc5UWbdQkgy0olAcsrdeoFpiIU8Ib/numg5g1fwIoNhTSBp/LeGdivofP2Nfn25c/N VvaA8Vb7F5FThK1ZTtvGFfp4XfTLv2IYIPJkvJmd4JoY2LK6vhLQtRM3jLoxlMvZg5Kf kb+XLsEKhPADyfonVl+/bny4rniyNw+KwuTzQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=lr2wPYI5VbEy2OirI38csZYaJS60LKBSU1e/ZuDnqZ3lRqrmcb27ev+TebEYo+wbzF p/L3zTJcPvejel1tNfzNx7jnJ+q5HOZ2P1jwKGLaNHW76N1D8GPEXdpBWtFasPbNJhJy /RWoZ0XeSrFXESHrF/LuuXsr42Spk5QfQpYi8= MIME-Version: 1.0 Received: by 10.151.62.5 with SMTP id p5mr944502ybk.55.1282161283807; Wed, 18 Aug 2010 12:54:43 -0700 (PDT) Received: by 10.231.130.140 with HTTP; Wed, 18 Aug 2010 12:54:43 -0700 (PDT) Date: Wed, 18 Aug 2010 22:54:43 +0300 Message-ID: Subject: How to stop a long running query? From: Nikolaos Paraschou To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=000e0cd59250ddbb5f048e1e6f23 --000e0cd59250ddbb5f048e1e6f23 Content-Type: text/plain; charset=ISO-8859-1 Hello, I have written a small application in java that interacts with db2 using apache cayenne. The application sends a long running query to the db2 server and awaits response. The query starts executing from within SwingWorker's doInBackground() method. During the query's execution, a cancel button appears allowing the user to cancel the operation. When clicked, SwingWorker's cancel() is called and everything seems to work fine regarding java code. The SwingWorker thread is canceled (I can confirm that). But, unfortunately, the other thread running the query doesn't stop (or perhaps it stops but the query is already being processed by db2 until finished). Is there any way to stop the query using cayenne specific methods? I tried to create a new DataContext and bind it to the running thread (the following code is executed inside doInBackground(): BaseContext.bindThreadObjectContext(DataContext.createDataContext()); ObjectContext oc = BaseContext.getThreadObjectContext(); return oc.performQuery(longRunQuery); No success. Thank you, Nikos --000e0cd59250ddbb5f048e1e6f23--