You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/04/27 20:48:23 UTC

qpid-proton git commit: PROTON-1164: [C++ binding] Remove on_timer event and example - This will be replaced by a function inject capability

Repository: qpid-proton
Updated Branches:
  refs/heads/master 91a1dc1f1 -> 616fe02dd


PROTON-1164: [C++ binding] Remove on_timer event and example
- This will be replaced by a function inject capability


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/616fe02d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/616fe02d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/616fe02d

Branch: refs/heads/master
Commit: 616fe02dd1f23be1f18ef3e13b62cc963943f28d
Parents: 91a1dc1
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Apr 27 14:46:52 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Apr 27 14:46:52 2016 -0400

----------------------------------------------------------------------
 examples/cpp/CMakeLists.txt                     |   1 -
 examples/cpp/example_test.py                    |   9 --
 examples/cpp/recurring_timer.cpp                | 101 -------------------
 .../bindings/cpp/include/proton/handler.hpp     |   7 --
 proton-c/bindings/cpp/src/handler.cpp           |   1 -
 proton-c/bindings/cpp/src/messaging_adapter.cpp |   7 --
 proton-c/bindings/cpp/src/messaging_adapter.hpp |   1 -
 7 files changed, 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/616fe02d/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 3a81718..f79c8d2 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -35,7 +35,6 @@ foreach(example
     client
     server
     server_direct
-    recurring_timer
     connection_options
     queue_browser
     selected_recv

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/616fe02d/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
index 38a5154..4ea0484 100644
--- a/examples/cpp/example_test.py
+++ b/examples/cpp/example_test.py
@@ -285,15 +285,6 @@ map{string(k1):int(42), symbol(k2):boolean(false)}
         self.maxDiff = None
         self.assertEqual(want, self.proc(["encode_decode"]).wait_exit())
 
-    def test_recurring_timer(self):
-        expect="""Tick...
-Tick...
-Tock...
-"""
-        self.maxDiff = None
-        # Disable valgrind, this test is time-sensitive.
-        self.assertEqual(expect, self.proc(["recurring_timer", "-t", ".05", "-k", ".01"], skip_valgrind=True).wait_exit())
-
     def ssl_certs_dir(self):
         """Absolute path to the test SSL certificates"""
         pn_root = dirname(dirname(dirname(sys.argv[0])))

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/616fe02d/examples/cpp/recurring_timer.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/recurring_timer.cpp b/examples/cpp/recurring_timer.cpp
deleted file mode 100644
index ef1d827..0000000
--- a/examples/cpp/recurring_timer.cpp
+++ /dev/null
@@ -1,101 +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.
- *
- */
-
-#include "options.hpp"
-
-#include "proton/container.hpp"
-#include "proton/handler.hpp"
-#include "proton/task.hpp"
-
-#include <iostream>
-#include <map>
-
-#include "fake_cpp11.hpp"
-
-class ticker : public proton::handler {
-    void on_timer(proton::container &) override {
-        std::cout << "Tick..." << std::endl;
-    }
-};
-
-class tocker : public proton::handler {
-    void on_timer(proton::container &) override {
-        std::cout << "Tock..." << std::endl;
-    }
-};
-
-
-class recurring : public proton::handler {
-  private:
-    int remaining_msecs, tick_ms;
-    ticker tick_handler;
-    tocker tock_handler;
-    proton::task cancel_task;
-  public:
-
-    recurring(int msecs, int tickms) : remaining_msecs(msecs), tick_ms(tickms), cancel_task(0) {}
-
-    proton::task ticktock(proton::container &c) {
-        // Show timer events in separate handlers.
-        c.schedule(tick_ms, &tick_handler);
-        return c.schedule(tick_ms * 3, &tock_handler);
-    }
-
-    void on_container_start(proton::container &c) override {
-        // Demonstrate cancel(), we will cancel the first tock on the first recurring::on_timer_task
-        cancel_task = ticktock(c);
-        c.schedule(0);
-    }
-
-    void on_timer(proton::container &c) override {
-        if (!!cancel_task) {
-            cancel_task.cancel();
-            cancel_task = 0;
-            c.schedule(tick_ms * 4);
-        } else {
-            remaining_msecs -= tick_ms * 4;
-            if (remaining_msecs > 0) {
-                ticktock(c);
-                c.schedule(tick_ms * 4);
-            }
-        }
-    }
-};
-
-int main(int argc, char **argv) {
-    // Command line options
-    double running_time = 5;
-    double tick = 0.25;
-    example::options opts(argc, argv);
-    opts.add_value(running_time, 't', "running time", "running time in seconds", "RUNTIME");
-    opts.add_value(tick, 'k', "tick time", "tick time as fraction of second", "TICK");
-    try {
-        opts.parse();
-        recurring recurring_handler(int(running_time * 1000), int(tick * 1000));
-        proton::container(recurring_handler).run();
-        return 0;
-    } catch (const example::bad_option& e) {
-        std::cout << opts << std::endl << e.what() << std::endl;
-    } catch (const std::exception& e) {
-        std::cerr << e.what() << std::endl;
-    }
-    return 1;
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/616fe02d/proton-c/bindings/cpp/include/proton/handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/handler.hpp b/proton-c/bindings/cpp/include/proton/handler.hpp
index 15814cc..f963369 100644
--- a/proton-c/bindings/cpp/include/proton/handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/handler.hpp
@@ -142,13 +142,6 @@ PN_CPP_CLASS_EXTERN handler
     /// The sending peer settled a transfer.
     PN_CPP_EXTERN virtual void on_delivery_settle(delivery &d);
 
-    /// @cond INTERNAL
-    /// XXX settle API questions around task
-    /// XXX register functions instead of having these funny generic events
-    /// A timer fired.
-    PN_CPP_EXTERN virtual void on_timer(container &c);
-    /// @endcond
-
     /// Fallback error handling.
     PN_CPP_EXTERN virtual void on_error(const error_condition &c);
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/616fe02d/proton-c/bindings/cpp/src/handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/handler.cpp b/proton-c/bindings/cpp/src/handler.cpp
index 29f55b4..5bb3859 100644
--- a/proton-c/bindings/cpp/src/handler.cpp
+++ b/proton-c/bindings/cpp/src/handler.cpp
@@ -39,7 +39,6 @@ handler::~handler(){}
 void handler::on_container_start(container &) {}
 void handler::on_message(delivery &, message &) {}
 void handler::on_sendable(sender &) {}
-void handler::on_timer(container &) {}
 void handler::on_transport_close(transport &) {}
 void handler::on_transport_error(transport &t) { on_error(t.error()); }
 void handler::on_connection_close(connection &) {}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/616fe02d/proton-c/bindings/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp
index a1ba250..3c494e5 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -242,11 +242,4 @@ void messaging_adapter::on_transport_tail_closed(proton_event &pe) {
     }
 }
 
-void messaging_adapter::on_timer_task(proton_event& pe)
-{
-    if (pe.container()) {
-        delegate_.on_timer(*pe.container());
-    }
-}
-
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/616fe02d/proton-c/bindings/cpp/src/messaging_adapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.hpp b/proton-c/bindings/cpp/src/messaging_adapter.hpp
index ce51c4a..1a33630 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.hpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.hpp
@@ -51,7 +51,6 @@ class messaging_adapter : public proton_handler
     void on_link_remote_open(proton_event &e);
     void on_link_remote_close(proton_event &e);
     void on_transport_tail_closed(proton_event &e);
-    void on_timer_task(proton_event &e);
 
   private:
     handler &delegate_;  // The handler for generated messaging_event's


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org