rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ifplu...@apache.org
Subject [rocketmq-client-cpp] 10/29: refactor: remove dynamic exception specifications
Date Tue, 29 Dec 2020 03:36:27 GMT
This is an automated email from the ASF dual-hosted git repository.

ifplusor pushed a commit to branch re_dev
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git

commit cb2789660c8ca49e76bfd1dc56c713ae90efa47a
Author: James Yin <ywhjames@hotmail.com>
AuthorDate: Thu Aug 6 23:34:00 2020 +0800

    refactor: remove dynamic exception specifications
---
 include/MessageUtil.h               |  2 +-
 src/MQClientAPIImpl.cpp             |  4 ++--
 src/MQClientAPIImpl.h               |  4 ++--
 src/consumer/RebalanceImpl.cpp      |  2 +-
 src/consumer/RebalanceImpl.h        |  2 +-
 src/io/Buffer.hpp                   |  6 +++---
 src/message/MessageUtil.cpp         |  3 +--
 src/transport/TcpRemotingClient.cpp | 18 ++++++++----------
 src/transport/TcpRemotingClient.h   | 13 ++++++-------
 9 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/include/MessageUtil.h b/include/MessageUtil.h
index d44fd8f..ba21b70 100644
--- a/include/MessageUtil.h
+++ b/include/MessageUtil.h
@@ -24,7 +24,7 @@ namespace rocketmq {
 
 class ROCKETMQCLIENT_API MessageUtil {
  public:
-  static MQMessage createReplyMessage(const Message& requestMessage, const std::string&
body) throw(MQClientException);
+  static MQMessage createReplyMessage(const Message& requestMessage, const std::string&
body);
 
   static const std::string& getReplyToClient(const Message& msg);
 };
diff --git a/src/MQClientAPIImpl.cpp b/src/MQClientAPIImpl.cpp
index 8ef0d97..42c9f6f 100644
--- a/src/MQClientAPIImpl.cpp
+++ b/src/MQClientAPIImpl.cpp
@@ -156,7 +156,7 @@ void MQClientAPIImpl::sendMessageAsync(const std::string& addr,
                                        MQClientInstancePtr instance,
                                        int64_t timeoutMillis,
                                        int retryTimesWhenSendFailed,
-                                       DefaultMQProducerImplPtr producer) throw(RemotingException)
{
+                                       DefaultMQProducerImplPtr producer) {
   // delete in future
   auto* cbw = new SendCallbackWrap(addr, brokerName, msg, std::forward<RemotingCommand>(request),
sendCallback,
                                    topicPublishInfo, instance, retryTimesWhenSendFailed,
0, producer);
@@ -169,7 +169,7 @@ void MQClientAPIImpl::sendMessageAsync(const std::string& addr,
   }
 }
 
-void MQClientAPIImpl::sendMessageAsyncImpl(SendCallbackWrap* cbw, int64_t timeoutMillis)
throw(RemotingException) {
+void MQClientAPIImpl::sendMessageAsyncImpl(SendCallbackWrap* cbw, int64_t timeoutMillis)
{
   const auto& addr = cbw->getAddr();
   auto& request = cbw->getRemotingCommand();
   m_remotingClient->invokeAsync(addr, request, cbw, timeoutMillis);
diff --git a/src/MQClientAPIImpl.h b/src/MQClientAPIImpl.h
index dcf8da9..c773991 100644
--- a/src/MQClientAPIImpl.h
+++ b/src/MQClientAPIImpl.h
@@ -179,9 +179,9 @@ class MQClientAPIImpl {
                         MQClientInstancePtr instance,
                         int64_t timeoutMilliseconds,
                         int retryTimesWhenSendFailed,
-                        DefaultMQProducerImplPtr producer) throw(RemotingException);
+                        DefaultMQProducerImplPtr producer);
 
-  void sendMessageAsyncImpl(SendCallbackWrap* cbw, int64_t timeoutMillis) throw(RemotingException);
+  void sendMessageAsyncImpl(SendCallbackWrap* cbw, int64_t timeoutMillis);
 
   PullResult* pullMessageSync(const std::string& addr, RemotingCommand& request,
int timeoutMillis);
 
diff --git a/src/consumer/RebalanceImpl.cpp b/src/consumer/RebalanceImpl.cpp
index d3b8e78..fb24e97 100644
--- a/src/consumer/RebalanceImpl.cpp
+++ b/src/consumer/RebalanceImpl.cpp
@@ -224,7 +224,7 @@ void RebalanceImpl::lockAll() {
   }
 }
 
-void RebalanceImpl::doRebalance(const bool isOrder) throw(MQClientException) {
+void RebalanceImpl::doRebalance(const bool isOrder) {
   LOG_DEBUG("start doRebalance");
   for (const auto& it : m_subscriptionInner) {
     const std::string& topic = it.first;
diff --git a/src/consumer/RebalanceImpl.h b/src/consumer/RebalanceImpl.h
index 0a62f49..18b555b 100755
--- a/src/consumer/RebalanceImpl.h
+++ b/src/consumer/RebalanceImpl.h
@@ -49,7 +49,7 @@ class RebalanceImpl {
   bool lock(MQMessageQueue mq);
   void lockAll();
 
-  void doRebalance(const bool isOrder = false) throw(MQClientException);
+  void doRebalance(const bool isOrder = false);
 
   void destroy();
 
diff --git a/src/io/Buffer.hpp b/src/io/Buffer.hpp
index a066e2c..aae1d5b 100644
--- a/src/io/Buffer.hpp
+++ b/src/io/Buffer.hpp
@@ -28,7 +28,7 @@ namespace rocketmq {
 template <typename A>
 class Buffer {
  protected:
-  Buffer(int32_t mark, int32_t pos, int32_t lim, int32_t cap) throw(std::invalid_argument)
{
+  Buffer(int32_t mark, int32_t pos, int32_t lim, int32_t cap) {
     if (cap < 0) {
       throw std::invalid_argument("Negative capacity: " + UtilAll::to_string(cap));
     }
@@ -45,7 +45,7 @@ class Buffer {
   }
 
  public:
-  Buffer& position(int new_position) throw(std::invalid_argument) {
+  Buffer& position(int new_position) {
     if ((new_position > limit_) || (new_position < 0)) {
       throw std::invalid_argument("");
     }
@@ -56,7 +56,7 @@ class Buffer {
     return *this;
   }
 
-  Buffer& limit(int new_limit) throw(std::invalid_argument) {
+  Buffer& limit(int new_limit) {
     if ((new_limit > capacity_) || (new_limit < 0)) {
       throw std::invalid_argument("");
     }
diff --git a/src/message/MessageUtil.cpp b/src/message/MessageUtil.cpp
index 21d2510..418750a 100644
--- a/src/message/MessageUtil.cpp
+++ b/src/message/MessageUtil.cpp
@@ -25,8 +25,7 @@
 
 namespace rocketmq {
 
-MQMessage MessageUtil::createReplyMessage(const Message& requestMessage,
-                                          const std::string& body) throw(MQClientException)
{
+MQMessage MessageUtil::createReplyMessage(const Message& requestMessage, const std::string&
body) {
   const auto& cluster = requestMessage.getProperty(MQMessageConst::PROPERTY_CLUSTER);
   if (!cluster.empty()) {
     auto replyMessage = std::make_shared<MessageImpl>(UtilAll::getReplyTopic(cluster),
body);
diff --git a/src/transport/TcpRemotingClient.cpp b/src/transport/TcpRemotingClient.cpp
index 5691f58..cf035f2 100644
--- a/src/transport/TcpRemotingClient.cpp
+++ b/src/transport/TcpRemotingClient.cpp
@@ -215,7 +215,7 @@ void TcpRemotingClient::scanResponseTable() {
 
 std::unique_ptr<RemotingCommand> TcpRemotingClient::invokeSync(const std::string&
addr,
                                                                RemotingCommand& request,
-                                                               int timeoutMillis) throw(RemotingException)
{
+                                                               int timeoutMillis) {
   auto beginStartTime = UtilAll::currentTimeMillis();
   auto channel = GetTransport(addr);
   if (channel != nullptr) {
@@ -247,10 +247,9 @@ std::unique_ptr<RemotingCommand> TcpRemotingClient::invokeSync(const
std::string
   }
 }
 
-std::unique_ptr<RemotingCommand> TcpRemotingClient::invokeSyncImpl(
-    TcpTransportPtr channel,
-    RemotingCommand& request,
-    int64_t timeoutMillis) throw(RemotingTimeoutException, RemotingSendRequestException)
{
+std::unique_ptr<RemotingCommand> TcpRemotingClient::invokeSyncImpl(TcpTransportPtr
channel,
+                                                                   RemotingCommand& request,
+                                                                   int64_t timeoutMillis)
{
   int code = request.code();
   int opaque = request.opaque();
 
@@ -281,7 +280,7 @@ std::unique_ptr<RemotingCommand> TcpRemotingClient::invokeSyncImpl(
 void TcpRemotingClient::invokeAsync(const std::string& addr,
                                     RemotingCommand& request,
                                     InvokeCallback* invokeCallback,
-                                    int64_t timeoutMillis) throw(RemotingException) {
+                                    int64_t timeoutMillis) {
   auto beginStartTime = UtilAll::currentTimeMillis();
   auto channel = GetTransport(addr);
   if (channel != nullptr) {
@@ -305,7 +304,7 @@ void TcpRemotingClient::invokeAsync(const std::string& addr,
 void TcpRemotingClient::invokeAsyncImpl(TcpTransportPtr channel,
                                         RemotingCommand& request,
                                         int64_t timeoutMillis,
-                                        InvokeCallback* invokeCallback) throw(RemotingSendRequestException)
{
+                                        InvokeCallback* invokeCallback) {
   int code = request.code();
   int opaque = request.opaque();
 
@@ -335,7 +334,7 @@ void TcpRemotingClient::invokeAsyncImpl(TcpTransportPtr channel,
   }
 }
 
-void TcpRemotingClient::invokeOneway(const std::string& addr, RemotingCommand& request)
throw(RemotingException) {
+void TcpRemotingClient::invokeOneway(const std::string& addr, RemotingCommand& request)
{
   auto channel = GetTransport(addr);
   if (channel != nullptr) {
     try {
@@ -351,8 +350,7 @@ void TcpRemotingClient::invokeOneway(const std::string& addr, RemotingCommand&
r
   }
 }
 
-void TcpRemotingClient::invokeOnewayImpl(TcpTransportPtr channel,
-                                         RemotingCommand& request) throw(RemotingSendRequestException)
{
+void TcpRemotingClient::invokeOnewayImpl(TcpTransportPtr channel, RemotingCommand& request)
{
   request.markOnewayRPC();
   try {
     if (!SendCommand(channel, request)) {
diff --git a/src/transport/TcpRemotingClient.h b/src/transport/TcpRemotingClient.h
index f193714..6897dee 100755
--- a/src/transport/TcpRemotingClient.h
+++ b/src/transport/TcpRemotingClient.h
@@ -48,14 +48,14 @@ class TcpRemotingClient {
 
   std::unique_ptr<RemotingCommand> invokeSync(const std::string& addr,
                                               RemotingCommand& request,
-                                              int timeoutMillis = 3000) throw(RemotingException);
+                                              int timeoutMillis = 3000);
 
   void invokeAsync(const std::string& addr,
                    RemotingCommand& request,
                    InvokeCallback* invokeCallback,
-                   int64_t timeoutMillis) throw(RemotingException);
+                   int64_t timeoutMillis);
 
-  void invokeOneway(const std::string& addr, RemotingCommand& request) throw(RemotingException);
+  void invokeOneway(const std::string& addr, RemotingCommand& request);
 
   void registerProcessor(MQRequestCode requestCode, RequestProcessor* requestProcessor);
 
@@ -84,13 +84,12 @@ class TcpRemotingClient {
 
   std::unique_ptr<RemotingCommand> invokeSyncImpl(TcpTransportPtr channel,
                                                   RemotingCommand& request,
-                                                  int64_t timeoutMillis) throw(RemotingTimeoutException,
-                                                                               RemotingSendRequestException);
+                                                  int64_t timeoutMillis);
   void invokeAsyncImpl(TcpTransportPtr channel,
                        RemotingCommand& request,
                        int64_t timeoutMillis,
-                       InvokeCallback* invokeCallback) throw(RemotingSendRequestException);
-  void invokeOnewayImpl(TcpTransportPtr channel, RemotingCommand& request) throw(RemotingSendRequestException);
+                       InvokeCallback* invokeCallback);
+  void invokeOnewayImpl(TcpTransportPtr channel, RemotingCommand& request);
 
   // rpc hook
   void doBeforeRpcHooks(const std::string& addr, RemotingCommand& request, bool toSent);


Mime
View raw message