From 666526b693def61673a2b4ed51bbd6fa001383cc Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 10 Feb 2009 22:16:05 +0000 Subject: Remove unused class and clean up some FIXME comments. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@743131 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/cluster.mk | 2 - qpid/cpp/src/qpid/cluster/ConnectionDecoder.cpp | 8 ++-- qpid/cpp/src/qpid/cluster/ConnectionMap.cpp | 3 +- qpid/cpp/src/qpid/cluster/Decoder.cpp | 2 +- qpid/cpp/src/qpid/cluster/ThreadDispatch.cpp | 53 ------------------------- qpid/cpp/src/qpid/cluster/ThreadDispatch.h | 53 ------------------------- 6 files changed, 8 insertions(+), 113 deletions(-) delete mode 100644 qpid/cpp/src/qpid/cluster/ThreadDispatch.cpp delete mode 100644 qpid/cpp/src/qpid/cluster/ThreadDispatch.h diff --git a/qpid/cpp/src/cluster.mk b/qpid/cpp/src/cluster.mk index 8880493bf5..d02cad0140 100644 --- a/qpid/cpp/src/cluster.mk +++ b/qpid/cpp/src/cluster.mk @@ -74,8 +74,6 @@ cluster_la_SOURCES = \ qpid/cluster/OutputInterceptor.h \ qpid/cluster/PollerDispatch.cpp \ qpid/cluster/PollerDispatch.h \ - qpid/cluster/ThreadDispatch.cpp \ - qpid/cluster/ThreadDispatch.h \ qpid/cluster/ProxyInputHandler.h \ qpid/cluster/Quorum.h \ qpid/cluster/WriteEstimate.cpp \ diff --git a/qpid/cpp/src/qpid/cluster/ConnectionDecoder.cpp b/qpid/cpp/src/qpid/cluster/ConnectionDecoder.cpp index cb958758b8..3c18cf751e 100644 --- a/qpid/cpp/src/qpid/cluster/ConnectionDecoder.cpp +++ b/qpid/cpp/src/qpid/cluster/ConnectionDecoder.cpp @@ -40,12 +40,14 @@ void ConnectionDecoder::decode(const EventHeader& eh, const void* data, Connecti handler(EventFrame(eh, frame)); frame = decoder.frame; } - handler(EventFrame(eh, frame, 1)); // Set read-credit on the last frame. + // Set read-credit on the last frame ending in this event. + // Credit will be given when this frame is processed. + handler(EventFrame(eh, frame, 1)); } else { // We must give 1 unit read credit per event. - // This event does not contain any complete frames so - // we must give read credit directly. + // This event does not complete any frames so + // we give read credit directly. ConnectionPtr connection = map.getLocal(eh.getConnectionId()); if (connection) connection->giveReadCredit(1); diff --git a/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp b/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp index ed2fa94412..064e3cd252 100644 --- a/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp +++ b/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp @@ -56,7 +56,8 @@ ConnectionMap::ConnectionPtr ConnectionMap::get(const ConnectionId& id) { mgmtId << id; ConnectionPtr cp = new Connection(cluster, shadowOut, mgmtId.str(), id); std::pair ib = map.insert(Map::value_type(id, cp)); - assert(ib.second); // FIXME aconway 2009-02-03: exception. + if (!ib.second) + throw InternalErrorException(QPID_MSG("Duplicate entry in cluster connection map: " << id)); i = ib.first; } return i->second; diff --git a/qpid/cpp/src/qpid/cluster/Decoder.cpp b/qpid/cpp/src/qpid/cluster/Decoder.cpp index 54d0224db1..4645a489c8 100644 --- a/qpid/cpp/src/qpid/cluster/Decoder.cpp +++ b/qpid/cpp/src/qpid/cluster/Decoder.cpp @@ -39,7 +39,7 @@ void Decoder::decode(const EventHeader& eh, const void* data) { void Decoder::erase(const ConnectionId& c) { Map::iterator i = map.find(c); - if (i != map.end()) // FIXME aconway 2009-02-03: + if (i != map.end()) map.erase(i); } diff --git a/qpid/cpp/src/qpid/cluster/ThreadDispatch.cpp b/qpid/cpp/src/qpid/cluster/ThreadDispatch.cpp deleted file mode 100644 index 2f3f27f834..0000000000 --- a/qpid/cpp/src/qpid/cluster/ThreadDispatch.cpp +++ /dev/null @@ -1,53 +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 "ThreadDispatch.h" - -#include "qpid/log/Statement.h" -#include - -namespace qpid { -namespace cluster { - -ThreadDispatch::ThreadDispatch(Cpg& c, boost::shared_ptr, - boost::function e) - : cpg(c), onError(e) -{} - -ThreadDispatch::~ThreadDispatch() { - // FIXME aconway 2009-01-16: leaking thread. problems with Shutdown. - // thread.join(); -} - -void ThreadDispatch::start() { - thread = sys::Thread(static_cast(this)); -} - -// Entry point: called by IO to dispatch CPG events. -void ThreadDispatch::run() { - try { - cpg.dispatchBlocking(); - } catch (const std::exception& e) { - QPID_LOG(critical, "Error in cluster dispatch: " << e.what()); - onError(); - } -} - -}} // namespace qpid::cluster diff --git a/qpid/cpp/src/qpid/cluster/ThreadDispatch.h b/qpid/cpp/src/qpid/cluster/ThreadDispatch.h deleted file mode 100644 index 03038ea91b..0000000000 --- a/qpid/cpp/src/qpid/cluster/ThreadDispatch.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef QPID_CLUSTER_THREADDISPATCH_H -#define QPID_CLUSTER_THREADDISPATCH_H - -/* - * - * 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 "Cpg.h" -#include "qpid/sys/Thread.h" -#include "qpid/sys/Runnable.h" -#include "qpid/sys/Poller.h" -#include - -namespace qpid { -namespace cluster { - -/** - * Dispatch CPG events in a dedicated thread. - */ -class ThreadDispatch : private sys::Runnable { - public: - ThreadDispatch(Cpg&, boost::shared_ptr, boost::function onError) ; - ~ThreadDispatch(); - - void start(); - - private: - - Cpg& cpg; - sys::Thread thread; - boost::function onError; - void run(); -}; -}} // namespace qpid::cluster - -#endif /*!QPID_CLUSTER_THREADDISPATCH_H*/ -- cgit v1.2.1