Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7C6461015A for ; Fri, 17 Jan 2014 19:06:42 +0000 (UTC) Received: (qmail 94732 invoked by uid 500); 17 Jan 2014 19:03:09 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 93604 invoked by uid 500); 17 Jan 2014 19:02:28 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 81919 invoked by uid 99); 17 Jan 2014 18:54:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 18:54:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 18:54:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BA78523889CB; Fri, 17 Jan 2014 18:53:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1559220 - /cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java Date: Fri, 17 Jan 2014 18:53:56 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140117185356.BA78523889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Jan 17 18:53:56 2014 New Revision: 1559220 URL: http://svn.apache.org/r1559220 Log: [CXF-5491] If the ws-discovery service fails to startup as part of th a normal listener process, log the warning and continue so the real services won't block. Modified: cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java Modified: cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java?rev=1559220&r1=1559219&r2=1559220&view=diff ============================================================================== --- cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java (original) +++ cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java Fri Jan 17 18:53:56 2014 @@ -28,6 +28,8 @@ import java.util.ListIterator; import java.util.Map; import java.util.UUID; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; @@ -54,6 +56,7 @@ import org.w3c.dom.Document; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.common.jaxb.JAXBContextCache; +import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.endpoint.Server; import org.apache.cxf.jaxws.spi.ProviderImpl; @@ -81,6 +84,8 @@ import org.apache.cxf.ws.discovery.wsdl. import org.apache.cxf.ws.discovery.wsdl.ScopesType; public class WSDiscoveryServiceImpl implements WSDiscoveryService { + private static final Logger LOG = LogUtils.getL7dLogger(WSDiscoveryService.class); + Bus bus; Endpoint udpEndpoint; WSDiscoveryClient client; @@ -120,13 +125,13 @@ public class WSDiscoveryServiceImpl impl } public HelloType register(EndpointReference ref) { - startup(); + startup(false); HelloType ht = client.register(ref); registered.add(ht); return ht; } public void register(HelloType ht) { - startup(); + startup(false); client.register(ht); registered.add(ht); } @@ -144,7 +149,9 @@ public class WSDiscoveryServiceImpl impl if (o == Boolean.TRUE || Boolean.valueOf((String)o)) { return; } - startup(); + if (!startup(true)) { + return; + } HelloType ht = new HelloType(); ht.setScopes(new ScopesType()); ht.setMetadataVersion(1); @@ -225,8 +232,10 @@ public class WSDiscoveryServiceImpl impl } - public synchronized void startup() { + startup(false); + } + public synchronized boolean startup(boolean optional) { if (!started && client.isAdHoc()) { Bus b = BusFactory.getAndSetThreadDefaultBus(bus); try { @@ -236,12 +245,19 @@ public class WSDiscoveryServiceImpl impl udpEndpoint.setProperties(props); udpEndpoint.publish("soap.udp://239.255.255.250:3702"); started = true; + } catch (RuntimeException ex) { + if (!optional) { + throw ex; + } else { + LOG.log(Level.WARNING, "Could not start WS-Discovery Service.", ex); + } } finally { if (b != bus) { BusFactory.setThreadDefaultBus(b); } } } + return true; }