You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2017/11/30 17:43:38 UTC

[1/2] thrift git commit: THRIFT-3657 D TFileWriterTransport close should use non-priority send Client: D

Repository: thrift
Updated Branches:
  refs/heads/master af5628637 -> 026c9d032


THRIFT-3657 D TFileWriterTransport close should use non-priority send
Client: D

This closes #884
This closes #1427


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/1541f0a7
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/1541f0a7
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/1541f0a7

Branch: refs/heads/master
Commit: 1541f0a74d6b1f85b9658f8f65a46ed19b57f657
Parents: af56286
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Mon Feb 22 02:16:30 2016 +0900
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:41:35 2017 -0500

----------------------------------------------------------------------
 lib/d/src/thrift/transport/file.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/1541f0a7/lib/d/src/thrift/transport/file.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/transport/file.d b/lib/d/src/thrift/transport/file.d
index 04d34ac..aac7289 100644
--- a/lib/d/src/thrift/transport/file.d
+++ b/lib/d/src/thrift/transport/file.d
@@ -637,7 +637,7 @@ final class TFileWriterTransport : TBaseTransport {
   override void close() {
     if (!isOpen) return;
 
-    prioritySend(writerThread_, ShutdownMessage(), thisTid); // FIXME: Should use normal send here.
+    send(writerThread_, ShutdownMessage(), thisTid);
     receive((ShutdownMessage msg, Tid tid){});
     isOpen_ = false;
   }


[2/2] thrift git commit: THRIFT-3686 Java processor should report internal error on uncaught exception Client: java

Posted by jk...@apache.org.
THRIFT-3686 Java processor should report internal error on uncaught exception
Client: java

This closes #904
This closes #1428


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/026c9d03
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/026c9d03
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/026c9d03

Branch: refs/heads/master
Commit: 026c9d032c4a298ecb9edbcdfb52590facb442f3
Parents: 1541f0a
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Sat Feb 27 16:27:05 2016 +0900
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:43:26 2017 -0500

----------------------------------------------------------------------
 .../src/org/apache/thrift/ProcessFunction.java  | 28 ++++++++++++--------
 .../apache/thrift/server/ServerTestBase.java    | 17 +++++++-----
 2 files changed, 27 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/026c9d03/lib/java/src/org/apache/thrift/ProcessFunction.java
----------------------------------------------------------------------
diff --git a/lib/java/src/org/apache/thrift/ProcessFunction.java b/lib/java/src/org/apache/thrift/ProcessFunction.java
index 5c039fe..340e301 100644
--- a/lib/java/src/org/apache/thrift/ProcessFunction.java
+++ b/lib/java/src/org/apache/thrift/ProcessFunction.java
@@ -4,6 +4,7 @@ import org.apache.thrift.protocol.TMessage;
 import org.apache.thrift.protocol.TMessageType;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.transport.TTransportException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,24 +31,29 @@ public abstract class ProcessFunction<I, T extends TBase> {
       return;
     }
     iprot.readMessageEnd();
-    TBase result = null;
+    TSerializable result = null;
+    byte msgType = TMessageType.REPLY;
 
     try {
       result = getResult(iface, args);
-    } catch(TException tex) {
-      LOGGER.error("Internal error processing " + getMethodName(), tex);
-      handleException(seqid, oprot);
-      return;
-    } catch(RuntimeException rex) {
-      LOGGER.error("Internal error processing " + getMethodName(), rex);
-      if (handleRuntimeExceptions()) {
-        handleException(seqid, oprot);
+    } catch (TTransportException ex) {
+      LOGGER.error("Transport error while processing " + getMethodName(), ex);
+      throw ex;
+    } catch (TApplicationException ex) {
+      LOGGER.error("Internal application error processing " + getMethodName(), ex);
+      result = ex;
+      msgType = TMessageType.EXCEPTION;
+    } catch (Exception ex) {
+      LOGGER.error("Internal error processing " + getMethodName(), ex);
+      if(!isOneway()) {
+        result = new TApplicationException(TApplicationException.INTERNAL_ERROR,
+            "Internal error processing " + getMethodName());
+        msgType = TMessageType.EXCEPTION;
       }
-      return;
     }
 
     if(!isOneway()) {
-      oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.REPLY, seqid));
+      oprot.writeMessageBegin(new TMessage(getMethodName(), msgType, seqid));
       result.write(oprot);
       oprot.writeMessageEnd();
       oprot.getTransport().flush();

http://git-wip-us.apache.org/repos/asf/thrift/blob/026c9d03/lib/java/test/org/apache/thrift/server/ServerTestBase.java
----------------------------------------------------------------------
diff --git a/lib/java/test/org/apache/thrift/server/ServerTestBase.java b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
index e3e4288..e245963 100644
--- a/lib/java/test/org/apache/thrift/server/ServerTestBase.java
+++ b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
@@ -234,7 +234,8 @@ public abstract class ServerTestBase extends TestCase {
         x.message = arg;
         throw x;
       } else if ("TException".equals(arg)) {
-        throw new TException(arg);
+        // Unspecified exception should yield a TApplicationException on client side
+        throw new RuntimeException(arg);
       } else {
         Xtruct result = new Xtruct();
         result.string_thing = arg;
@@ -681,13 +682,15 @@ public abstract class ServerTestBase extends TestCase {
         x.errorCode = 1001;
         x.message = arg;
         // throw and onError yield the same result.
-        // resultHandler.onError(x);
-        // return;
-        throw x;
-      } else if ("TException".equals(arg)) {
-        // throw new TException(arg);
-        resultHandler.onError(new TException(arg));
+        // throw x;
+        resultHandler.onError(x);
         return;
+      } else if ("TException".equals(arg)) {
+        // throw and onError yield the same result.
+        // resultHandler.onError(new TException(arg));
+        // return;
+        // Unspecified exception should yield a TApplicationException on client side
+        throw new RuntimeException(arg);
       }
       resultHandler.onComplete(null);
     }