Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 24779EBC1 for ; Fri, 14 Dec 2012 15:50:14 +0000 (UTC) Received: (qmail 93014 invoked by uid 500); 14 Dec 2012 15:50:14 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 92788 invoked by uid 500); 14 Dec 2012 15:50:12 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 92759 invoked by uid 99); 14 Dec 2012 15:50:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2012 15:50:12 +0000 Date: Fri, 14 Dec 2012 15:50:12 +0000 (UTC) From: "Guillaume Nodet (JIRA)" To: dev@felix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FELIX-3824) Possible InvalidStateException thrown while unregistering bundle services MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FELIX-3824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13532405#comment-13532405 ] Guillaume Nodet commented on FELIX-3824: ---------------------------------------- Proposed patch for the ServiceRegistry#unregisterServices method: {code} diff --git a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java index f8dea41..f280b4e 100644 --- a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java +++ b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java @@ -202,7 +202,14 @@ public class ServiceRegistry { if (((ServiceRegistrationImpl) regs[i]).isValid()) { - regs[i].unregister(); + try + { + regs[i].unregister(); + } + catch (IllegalStateException e) + { + // Ignore exception if the service has already been unregistered + } } } {code} > Possible InvalidStateException thrown while unregistering bundle services > ------------------------------------------------------------------------- > > Key: FELIX-3824 > URL: https://issues.apache.org/jira/browse/FELIX-3824 > Project: Felix > Issue Type: Bug > Components: Framework > Reporter: Guillaume Nodet > Assignee: Guillaume Nodet > Priority: Minor > > I think there's a small possibility that an InvalidStateException is thrown when unregistering services after the bundle is stopped. It can only happen if the registration is held by someone and unregistered concurrently with the bundle being stopped. > I think it does not hurt to catch and ignore it as I had it once. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira