You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/01/16 08:43:18 UTC

[camel] branch master updated: CAMEL-12099: Update camel-thrift to libthrift 0.11.0

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 308766a  CAMEL-12099: Update camel-thrift to libthrift 0.11.0
308766a is described below

commit 308766ab90e2b671666ced96c7e6abc73b778c84
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Tue Jan 16 11:02:04 2018 +0300

    CAMEL-12099: Update camel-thrift to libthrift 0.11.0
---
 components/camel-thrift/README.md                  |  4 +--
 .../camel/component/thrift/server/Invocation.java  | 34 --------------------
 .../component/thrift/server/ThriftHsHaServer.java  | 36 +++-------------------
 .../thrift/server/ThriftThreadPoolServer.java      |  2 +-
 components/camel-thrift/src/test/thrift/README.md  |  6 ++--
 parent/pom.xml                                     |  2 +-
 6 files changed, 11 insertions(+), 73 deletions(-)

diff --git a/components/camel-thrift/README.md b/components/camel-thrift/README.md
index 668e452..a367947 100644
--- a/components/camel-thrift/README.md
+++ b/components/camel-thrift/README.md
@@ -9,8 +9,8 @@ For linux/osx you download the .tar distro, and untar it, and then
     sudo ./bootstrap.sh
     export CXXFLAGS='-Os -ffunction-sections -Wl,--gc-sections -fno-asynchronous-unwind-tables -Wl,--strip-all'
     sudo ./configure --without-c_glib --without-java --without-python --without-ruby --without-nodejs --disable-libs --disable-tests --disable-tutorial --disable-shared --enable-static
-    sudo ./make check
-    sudo ./make install
+    sudo make check
+    sudo make install
 
 If its succesful, you can type
 
diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/Invocation.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/Invocation.java
deleted file mode 100644
index d61547b..0000000
--- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/Invocation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.thrift.server;
-
-import org.apache.thrift.server.AbstractNonblockingServer.FrameBuffer;
-
-/**
- * Copy of the org.apache.thrift.server.Invocation
- */
-class Invocation implements Runnable {
-    private final FrameBuffer frameBuffer;
-
-    public Invocation(final FrameBuffer frameBuffer) {
-        this.frameBuffer = frameBuffer;
-    }
-
-    public void run() {
-        frameBuffer.invoke();
-    }
-}
diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftHsHaServer.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftHsHaServer.java
index 2ae49e1..6ac8ca0 100644
--- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftHsHaServer.java
+++ b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftHsHaServer.java
@@ -17,22 +17,17 @@
 package org.apache.camel.component.thrift.server;
 
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.RejectedExecutionException;
 
 import org.apache.camel.CamelContext;
-import org.apache.thrift.server.TNonblockingServer;
+import org.apache.thrift.server.THsHaServer;
 import org.apache.thrift.transport.TNonblockingServerTransport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /*
  * Thrift HsHaServer implementation with executors controlled by the Camel Executor Service Manager
  */
-public class ThriftHsHaServer extends TNonblockingServer {
-    private static final Logger LOG = LoggerFactory.getLogger(ThriftHsHaServer.class);
+public class ThriftHsHaServer extends THsHaServer {
 
-    public static class Args extends AbstractNonblockingServerArgs<Args> {
-        private ExecutorService executorService;
+    public static class Args extends THsHaServer.Args {
         private ExecutorService startThreadPool;
         private CamelContext context;
 
@@ -40,11 +35,6 @@ public class ThriftHsHaServer extends TNonblockingServer {
             super(transport);
         }
 
-        public Args executorService(ExecutorService executorService) {
-            this.executorService = executorService;
-            return this;
-        }
-
         public Args startThreadPool(ExecutorService startThreadPool) {
             this.startThreadPool = startThreadPool;
             return this;
@@ -56,7 +46,6 @@ public class ThriftHsHaServer extends TNonblockingServer {
         }
     }
 
-    private final ExecutorService invoker;
     private final CamelContext context;
     private final ExecutorService startExecutor;
 
@@ -64,7 +53,6 @@ public class ThriftHsHaServer extends TNonblockingServer {
         super(args);
 
         this.context = args.context;
-        this.invoker = args.executorService;
         this.startExecutor = args.startThreadPool;
     }
 
@@ -97,22 +85,6 @@ public class ThriftHsHaServer extends TNonblockingServer {
     @Override
     protected void waitForShutdown() {
         joinSelector();
-        context.getExecutorServiceManager().shutdownGraceful(invoker);
-    }
-
-    @Override
-    protected boolean requestInvoke(FrameBuffer frameBuffer) {
-        try {
-            Runnable invocation = getRunnable(frameBuffer);
-            invoker.execute(invocation);
-            return true;
-        } catch (RejectedExecutionException rx) {
-            LOG.warn("ExecutorService rejected execution!", rx);
-            return false;
-        }
-    }
-
-    protected Runnable getRunnable(FrameBuffer frameBuffer) {
-        return new Invocation(frameBuffer);
+        context.getExecutorServiceManager().shutdownGraceful(getInvoker());
     }
 }
diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java
index 1b749c9..2b387e4 100644
--- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java
+++ b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java
@@ -142,7 +142,7 @@ public class ThriftThreadPoolServer extends TServer {
         });
     }
 
-    public void waitForShutdown() {
+    private void waitForShutdown() {
         int failureCount = 0;
         while (!stopped_) {
             try {
diff --git a/components/camel-thrift/src/test/thrift/README.md b/components/camel-thrift/src/test/thrift/README.md
index 5fe3aaf..98f153c 100644
--- a/components/camel-thrift/src/test/thrift/README.md
+++ b/components/camel-thrift/src/test/thrift/README.md
@@ -1,9 +1,9 @@
 Thrift tutorial java files generation
 -----------------------
-$ cd src/test/thrift
+cd src/test/thrift
 
-$ thrift -r --gen java -out ../java/ ./tutorial-dataformat.thrift
+thrift -r --gen java -out ../java/ ./tutorial-dataformat.thrift
 
-$ thrift -r --gen java -out ../java/ ./tutorial-component.thrift
+thrift -r --gen java -out ../java/ ./tutorial-component.thrift
 
 *Examples taken from the Apache Thrift java tutorial https://thrift.apache.org/tutorial/java*
\ No newline at end of file
diff --git a/parent/pom.xml b/parent/pom.xml
index b1941ee..cce13a5 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -384,7 +384,7 @@
     <jettison-version>1.3.8</jettison-version>
     <jgit-version>4.10.0.201712302008-r</jgit-version>
     <jgroups-version>4.0.9.Final</jgroups-version>
-    <libthrift-version>0.10.0</libthrift-version>
+    <libthrift-version>0.11.0</libthrift-version>
     <jibx-version>1.2.6</jibx-version>
     <jing-bundle-version>20030619_5</jing-bundle-version>
     <jing-version>20030619</jing-version>

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