You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2009/03/24 21:01:59 UTC

svn commit: r757992 - in /incubator/thrift/trunk: compiler/cpp/src/parse/ lib/erl/ lib/erl/src/ lib/java/test/org/apache/thrift/test/ lib/py/src/server/ test/ test/cpp/src/ test/csharp/ThriftTest/ test/erl/src/ test/hs/ test/ocaml/server/ test/py/

Author: dreiss
Date: Tue Mar 24 20:01:58 2009
New Revision: 757992

URL: http://svn.apache.org/viewvc?rev=757992&view=rev
Log:
THRIFT-136. s/async/oneway/ in misc places

This is mostly an internal-only change.
It affects docstrings, messages, variables, test cases, etc.

Modified:
    incubator/thrift/trunk/compiler/cpp/src/parse/t_function.h
    incubator/thrift/trunk/lib/erl/README
    incubator/thrift/trunk/lib/erl/src/thrift_processor.erl
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestServer.java
    incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py
    incubator/thrift/trunk/test/ThriftTest.thrift
    incubator/thrift/trunk/test/cpp/src/TestClient.cpp
    incubator/thrift/trunk/test/cpp/src/TestServer.cpp
    incubator/thrift/trunk/test/csharp/ThriftTest/TestClient.cs
    incubator/thrift/trunk/test/csharp/ThriftTest/TestServer.cs
    incubator/thrift/trunk/test/erl/src/test_disklog.erl
    incubator/thrift/trunk/test/erl/src/test_server.erl
    incubator/thrift/trunk/test/hs/Server.hs
    incubator/thrift/trunk/test/ocaml/server/TestServer.ml
    incubator/thrift/trunk/test/py/TestClient.py
    incubator/thrift/trunk/test/py/TestServer.py

Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_function.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_function.h?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_function.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_function.h Tue Mar 24 20:01:58 2009
@@ -43,7 +43,7 @@
     oneway_(oneway)
   {
     if (oneway_ && !xceptions_->get_members().empty()) {
-      throw std::string("Async methods can't throw exceptions.");
+      throw std::string("Oneway methods can't throw exceptions.");
     }
   }
 

Modified: incubator/thrift/trunk/lib/erl/README
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/erl/README?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/erl/README (original)
+++ incubator/thrift/trunk/lib/erl/README Tue Mar 24 20:01:58 2009
@@ -9,7 +9,7 @@
 {error,{bad_args,testVoid,[asdf]}}
 121> thrift_client:call(C, testI32, [123]).
 {ok,123}
-122> thrift_client:call(C, testAsync, [1]).
+122> thrift_client:call(C, testOneway, [1]).
 {ok,ok}
 123> catch thrift_client:call(C, testXception, ["foo"]).
 {error,{no_function,testXception}}

Modified: incubator/thrift/trunk/lib/erl/src/thrift_processor.erl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/erl/src/thrift_processor.erl?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/erl/src/thrift_processor.erl (original)
+++ incubator/thrift/trunk/lib/erl/src/thrift_processor.erl Tue Mar 24 20:01:58 2009
@@ -62,13 +62,13 @@
 
 handle_function_catch(State = #thrift_processor{service = Service},
                       Function, ErrType, ErrData) ->
-    IsAsync = Service:function_info(Function, reply_type) =:= async_void,
+    IsOneway = Service:function_info(Function, reply_type) =:= async_void,
 
     case {ErrType, ErrData} of
-        _ when IsAsync ->
+        _ when IsOneway ->
             Stack = erlang:get_stacktrace(),
             error_logger:warning_msg(
-              "async void ~p threw error which must be ignored: ~p",
+              "oneway void ~p threw error which must be ignored: ~p",
               [Function, {ErrType, ErrData, Stack}]),
             ok;
 

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java Tue Mar 24 20:01:58 2009
@@ -354,17 +354,17 @@
         System.out.print("}\n");
 
         // Test oneway
-        System.out.print("testAsync(3)...");
-        long startAsync = System.nanoTime();
-        testClient.testAsync(3);
-        long asyncElapsedMillis = (System.nanoTime() - startAsync) / 1000000;
-        if (asyncElapsedMillis > 200) {
-          throw new Exception("Async test failed: took " +
-                              Long.toString(asyncElapsedMillis) +
+        System.out.print("testOneway(3)...");
+        long startOneway = System.nanoTime();
+        testClient.testOneway(3);
+        long onewayElapsedMillis = (System.nanoTime() - startOneway) / 1000000;
+        if (onewayElapsedMillis > 200) {
+          throw new Exception("Oneway test failed: took " +
+                              Long.toString(onewayElapsedMillis) +
                               "ms");
         } else {
           System.out.println("Success - took " +
-                             Long.toString(asyncElapsedMillis) +
+                             Long.toString(onewayElapsedMillis) +
                              "ms");
         }
 

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestServer.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestServer.java?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestServer.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/TestServer.java Tue Mar 24 20:01:58 2009
@@ -233,8 +233,8 @@
       return result;
     }
 
-    public void testAsync(int sleepFor) {
-      System.out.println("testAsync(" + Integer.toString(sleepFor) +
+    public void testOneway(int sleepFor) {
+      System.out.println("testOneway(" + Integer.toString(sleepFor) +
                          ") => sleeping...");
       try {
         Thread.sleep(sleepFor * 1000);

Modified: incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py (original)
+++ incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py Tue Mar 24 20:01:58 2009
@@ -148,7 +148,7 @@
         This function is the only function witch can be called asynchronous.
         
         The ready can switch Connection to three states:
-            WAIT_LEN if request was async.
+            WAIT_LEN if request was oneway.
             SEND_ANSWER if request was processed in normal way.
             CLOSED if request throws unexpected exception.
         

Modified: incubator/thrift/trunk/test/ThriftTest.thrift
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/ThriftTest.thrift?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/ThriftTest.thrift (original)
+++ incubator/thrift/trunk/test/ThriftTest.thrift Tue Mar 24 20:01:58 2009
@@ -103,7 +103,7 @@
   Xtruct testMultiException(string arg0, string arg1) throws(Xception err1, Xception2 err2)
 
   /* Test oneway void */
-  async void testAsync(1:i32 secondsToSleep)
+  async void testOneway(1:i32 secondsToSleep)
 }
 
 service SecondService

Modified: incubator/thrift/trunk/test/cpp/src/TestClient.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/cpp/src/TestClient.cpp?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/cpp/src/TestClient.cpp (original)
+++ incubator/thrift/trunk/test/cpp/src/TestClient.cpp Tue Mar 24 20:01:58 2009
@@ -422,10 +422,10 @@
 
     /* test oneway void */
     {
-        printf("testClient.testAsync(3) =>");
-        uint64_t startAsync = now();
-        testClient.testAsync(3);
-        uint64_t elapsed = now() - startAsync;
+        printf("testClient.testOneway(3) =>");
+        uint64_t startOneway = now();
+        testClient.testOneway(3);
+        uint64_t elapsed = now() - startOneway;
         if (elapsed > 200 * 1000) { // 0.2 seconds
             printf("  FAILURE - took %.2f ms\n", (double)elapsed/1000.0);
         } else {

Modified: incubator/thrift/trunk/test/cpp/src/TestServer.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/cpp/src/TestServer.cpp?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/cpp/src/TestServer.cpp (original)
+++ incubator/thrift/trunk/test/cpp/src/TestServer.cpp Tue Mar 24 20:01:58 2009
@@ -261,10 +261,10 @@
     }
   }
 
-  void testAsync(int sleepFor) {
-    printf("testAsync(%d): Sleeping...\n", sleepFor);
+  void testOneway(int sleepFor) {
+    printf("testOneway(%d): Sleeping...\n", sleepFor);
     sleep(sleepFor);
-    printf("testAsync(%d): done sleeping!\n", sleepFor);
+    printf("testOneway(%d): done sleeping!\n", sleepFor);
   }
 };
 

Modified: incubator/thrift/trunk/test/csharp/ThriftTest/TestClient.cs
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/csharp/ThriftTest/TestClient.cs?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/csharp/ThriftTest/TestClient.cs (original)
+++ incubator/thrift/trunk/test/csharp/ThriftTest/TestClient.cs Tue Mar 24 20:01:58 2009
@@ -399,8 +399,8 @@
 			Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing
 						+ ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n");
 
-			Console.WriteLine("Test Async(1)");
-			client.testAsync(1);
+			Console.WriteLine("Test Oneway(1)");
+			client.testOneway(1);
 		}
 	}
 }

Modified: incubator/thrift/trunk/test/csharp/ThriftTest/TestServer.cs
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/csharp/ThriftTest/TestServer.cs?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/csharp/ThriftTest/TestServer.cs (original)
+++ incubator/thrift/trunk/test/csharp/ThriftTest/TestServer.cs Tue Mar 24 20:01:58 2009
@@ -269,11 +269,11 @@
 				}
 			}
 
-			public void testAsync(int arg)
+			public void testOneway(int arg)
 			{
-				Console.WriteLine("testAsync(" + arg + "), sleeping...");
+				Console.WriteLine("testOneway(" + arg + "), sleeping...");
 				System.Threading.Thread.Sleep(arg * 1000);
-				Console.WriteLine("testAsync finished");
+				Console.WriteLine("testOneway finished");
 			}
 
 		} // class TestHandler

Modified: incubator/thrift/trunk/test/erl/src/test_disklog.erl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/erl/src/test_disklog.erl?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/erl/src/test_disklog.erl (original)
+++ incubator/thrift/trunk/test/erl/src/test_disklog.erl Tue Mar 24 20:01:58 2009
@@ -16,12 +16,12 @@
 
     % We have to make oneway calls into this client only since otherwise it will try
     % to read from the disklog and go boom.
-    {ok, ok} = thrift_client:call(Client, testAsync, [16#deadbeef]),
+    {ok, ok} = thrift_client:call(Client, testOneway, [16#deadbeef]),
     io:format("Call written~n"),
 
     % Use the send_call method to write a non-oneway call into the log
     ok = thrift_client:send_call(Client, testString, [<<"hello world">>]),
-    io:format("Non-async call sent~n"),
+    io:format("Non-oneway call sent~n"),
 
     ok = thrift_client:close(Client),
     io:format("Client closed~n"),
@@ -48,12 +48,12 @@
 
     % We have to make oneway calls into this client only since otherwise it will try
     % to read from the disklog and go boom.
-    {ok, ok} = thrift_client:call(Client, testAsync, [16#deadbeef]),
+    {ok, ok} = thrift_client:call(Client, testOneway, [16#deadbeef]),
     io:format("Call written~n"),
 
     % Use the send_call method to write a non-oneway call into the log
     ok = thrift_client:send_call(Client, testString, [<<"hello world">>]),
-    io:format("Non-async call sent~n"),
+    io:format("Non-oneway call sent~n"),
 
     ok = thrift_client:close(Client),
     io:format("Client closed~n"),

Modified: incubator/thrift/trunk/test/erl/src/test_server.erl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/erl/src/test_server.erl?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/erl/src/test_server.erl (original)
+++ incubator/thrift/trunk/test/erl/src/test_server.erl Tue Mar 24 20:01:58 2009
@@ -150,6 +150,6 @@
             {reply, #xtruct{string_thing = Arg1}}
     end;
 
-handle_function(testAsync, {Seconds}) ->
+handle_function(testOneway, {Seconds}) ->
     timer:sleep(1000 * Seconds),
     ok.

Modified: incubator/thrift/trunk/test/hs/Server.hs
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/hs/Server.hs?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/hs/Server.hs (original)
+++ incubator/thrift/trunk/test/hs/Server.hs Tue Mar 24 20:01:58 2009
@@ -28,7 +28,7 @@
     testMulti a a1 a2 a3 a4 a5 a6 = return (Xtruct Nothing Nothing Nothing Nothing)
     testException a c = throwDyn (Xception (Just 1) (Just "bya"))
     testMultiException a c1 c2 = return (Xtruct Nothing Nothing Nothing Nothing)
-    testAsync a (Just i) = do print i
+    testOneway a (Just i) = do print i
 
 
 main = do (run_basic_server TestHandler process 9090) `catchDyn` (\(TransportExn s t) -> print s)

Modified: incubator/thrift/trunk/test/ocaml/server/TestServer.ml
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/ocaml/server/TestServer.ml?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/ocaml/server/TestServer.ml (original)
+++ incubator/thrift/trunk/test/ocaml/server/TestServer.ml Tue Mar 24 20:01:58 2009
@@ -97,7 +97,7 @@
     let res = new xtruct in
       res#set_string_thing (sod a1);
       res
-  method testAsync i =
+  method testOneway i =
     Unix.sleep (sod i)
 end;;
 

Modified: incubator/thrift/trunk/test/py/TestClient.py
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/py/TestClient.py?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/py/TestClient.py (original)
+++ incubator/thrift/trunk/test/py/TestClient.py Tue Mar 24 20:01:58 2009
@@ -104,12 +104,12 @@
     except Exception: # type is undefined
       pass
 
-  def testAsync(self):
+  def testOneway(self):
     start = time.time()
-    self.client.testAsync(0.5)
+    self.client.testOneway(0.5)
     end = time.time()
     self.assertTrue(end - start < 0.2,
-                    "async sleep took %f sec" % (end - start))
+                    "oneway sleep took %f sec" % (end - start))
 
 class NormalBinaryTest(AbstractTest):
   protocol_factory = TBinaryProtocol.TBinaryProtocolFactory()

Modified: incubator/thrift/trunk/test/py/TestServer.py
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/py/TestServer.py?rev=757992&r1=757991&r2=757992&view=diff
==============================================================================
--- incubator/thrift/trunk/test/py/TestServer.py (original)
+++ incubator/thrift/trunk/test/py/TestServer.py Tue Mar 24 20:01:58 2009
@@ -54,8 +54,8 @@
     elif str == "throw_undeclared":
       raise ValueError("foo")
 
-  def testAsync(self, seconds):
-    print 'testAsync(%d) => sleeping...' % seconds
+  def testOneway(self, seconds):
+    print 'testOneway(%d) => sleeping...' % seconds
     time.sleep(seconds)
     print 'done sleeping'