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 8DC4E10150 for ; Fri, 17 Jan 2014 19:06:36 +0000 (UTC) Received: (qmail 95759 invoked by uid 500); 17 Jan 2014 19:04:11 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 94856 invoked by uid 500); 17 Jan 2014 19:03:14 -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 92736 invoked by uid 99); 17 Jan 2014 19:01:49 -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 19:01:48 +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 19:01:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 59E872388A3B; Fri, 17 Jan 2014 19:01:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1559222 - /cxf/branches/2.7.x-fixes/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java Date: Fri, 17 Jan 2014 19:01:24 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140117190124.59E872388A3B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Jan 17 19:01:23 2014 New Revision: 1559222 URL: http://svn.apache.org/r1559222 Log: Merged revisions 1559220 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1559220 | dkulp | 2014-01-17 13:53:56 -0500 (Fri, 17 Jan 2014) | 2 lines [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/branches/2.7.x-fixes/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java Modified: cxf/branches/2.7.x-fixes/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java?rev=1559222&r1=1559221&r2=1559222&view=diff ============================================================================== --- cxf/branches/2.7.x-fixes/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java (original) +++ cxf/branches/2.7.x-fixes/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java Fri Jan 17 19:01:23 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; @@ -82,6 +85,8 @@ import org.apache.cxf.ws.discovery.wsdl. import org.apache.cxf.wsdl.EndpointReferenceUtils; public class WSDiscoveryServiceImpl implements WSDiscoveryService { + private static final Logger LOG = LogUtils.getL7dLogger(WSDiscoveryService.class); + Bus bus; Endpoint udpEndpoint; WSDiscoveryClient client; @@ -121,13 +126,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); } @@ -145,7 +150,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); @@ -226,8 +233,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 { @@ -237,12 +246,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; }