cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [cxf] branch master updated: [CXF-7570] Looking up the default executor service
Date Wed, 22 Nov 2017 13:13:29 GMT
This is an automated email from the ASF dual-hosted git repository.

sergeyb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new f8af79f  [CXF-7570] Looking up the default executor service
f8af79f is described below

commit f8af79f310557a9c2185895d2edc007813b990ee
Author: Sergey Beryozkin <sberyozkin@gmail.com>
AuthorDate: Wed Nov 22 13:13:16 2017 +0000

    [CXF-7570] Looking up the default executor service
---
 .../main/java/org/apache/cxf/jaxrs/client/WebClient.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
index 89f5805..38a62ec 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
@@ -1260,8 +1260,9 @@ public class WebClient extends AbstractClient {
 
     // Link to JAX-RS 2.1 CompletionStageRxInvoker
     public CompletionStageRxInvoker rx() {
-        return rx((ExecutorService)null);
+        return rx(lookUpExecutorService());
     }
+    
     public CompletionStageRxInvoker rx(ExecutorService ex) {
         return new CompletionStageRxInvokerImpl(this, ex);
     }
@@ -1297,4 +1298,16 @@ public class WebClient extends AbstractClient {
         }
     }
 
+    private ExecutorService lookUpExecutorService() {
+        try {
+            javax.naming.InitialContext ic = new javax.naming.InitialContext();
+            Object execService = ic.lookup("java:comp/DefaultManagedExecutorService");
+            if (execService != null) {
+                return (ExecutorService)execService; 
+            }
+        } catch (Throwable ex) {
+            // ignore
+        }
+        return null;
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <commits@cxf.apache.org>'].

Mime
View raw message