diff options
author | Michi Henning <michi@zeroc.com> | 2003-06-26 02:27:19 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2003-06-26 02:27:19 +0000 |
commit | 35a73118f5ee1fa8ad963cf61f74d15e477cf385 (patch) | |
tree | 0a852456ca8a131f016f2cb40676b2745d63e3fc /cpp | |
parent | Incorrect property settings for demos. (diff) | |
download | ice-35a73118f5ee1fa8ad963cf61f74d15e477cf385.tar.bz2 ice-35a73118f5ee1fa8ad963cf61f74d15e477cf385.tar.xz ice-35a73118f5ee1fa8ad963cf61f74d15e477cf385.zip |
Got rid of unnecessary _adapter and _communicator members.
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/Freeze/library/Collocated.cpp | 2 | ||||
-rw-r--r-- | cpp/demo/Freeze/library/LibraryI.cpp | 20 | ||||
-rw-r--r-- | cpp/demo/Freeze/library/LibraryI.h | 3 | ||||
-rw-r--r-- | cpp/demo/Freeze/library/Parser.cpp | 1 | ||||
-rw-r--r-- | cpp/demo/Freeze/library/Parser.h | 1 | ||||
-rw-r--r-- | cpp/demo/Freeze/library/Server.cpp | 2 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/Collocated.cpp | 2 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/Parser.cpp | 1 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/Parser.h | 1 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/PhoneBookI.cpp | 18 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/PhoneBookI.h | 3 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/Server.cpp | 2 |
12 files changed, 21 insertions, 35 deletions
diff --git a/cpp/demo/Freeze/library/Collocated.cpp b/cpp/demo/Freeze/library/Collocated.cpp index 4dc3497dbd9..6da670d4c27 100644 --- a/cpp/demo/Freeze/library/Collocated.cpp +++ b/cpp/demo/Freeze/library/Collocated.cpp @@ -76,7 +76,7 @@ LibraryCollocated::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbE // // Create the library, and add it to the Object Adapter. // - LibraryIPtr library = new LibraryI(adapter, dbAuthors, evictor); + LibraryIPtr library = new LibraryI(dbAuthors, evictor); adapter->add(library, stringToIdentity("library")); // diff --git a/cpp/demo/Freeze/library/LibraryI.cpp b/cpp/demo/Freeze/library/LibraryI.cpp index aff271110e8..faf92f55324 100644 --- a/cpp/demo/Freeze/library/LibraryI.cpp +++ b/cpp/demo/Freeze/library/LibraryI.cpp @@ -157,8 +157,7 @@ private: Ice::ObjectAdapterPtr _adapter; }; -LibraryI::LibraryI(const Ice::ObjectAdapterPtr& adapter, const Freeze::DBPtr& db, const Freeze::EvictorPtr& evictor) : - _adapter(adapter), +LibraryI::LibraryI(const Freeze::DBPtr& db, const Freeze::EvictorPtr& evictor) : _evictor(evictor), _authors(db) { @@ -169,11 +168,11 @@ LibraryI::~LibraryI() } ::BookPrx -LibraryI::createBook(const ::BookDescription& description, const Ice::Current&) +LibraryI::createBook(const ::BookDescription& description, const Ice::Current& c) { IceUtil::RWRecMutex::WLock sync(*this); - BookPrx book = IsbnToBook(_adapter)(description.isbn); + BookPrx book = IsbnToBook(c.adapter)(description.isbn); try { book->ice_ping(); @@ -221,7 +220,7 @@ LibraryI::createBook(const ::BookDescription& description, const Ice::Current&) } ::BookPrx -LibraryI::findByIsbn(const string& isbn, const Ice::Current&) const +LibraryI::findByIsbn(const string& isbn, const Ice::Current& c) const { // // No locking is necessary since no internal mutable state is @@ -231,7 +230,7 @@ LibraryI::findByIsbn(const string& isbn, const Ice::Current&) const try { - BookPrx book = IsbnToBook(_adapter)(isbn); + BookPrx book = IsbnToBook(c.adapter)(isbn); book->ice_ping(); return book; } @@ -245,7 +244,7 @@ LibraryI::findByIsbn(const string& isbn, const Ice::Current&) const } ::BookPrxSeq -LibraryI::findByAuthors(const string& authors, const Ice::Current&) const +LibraryI::findByAuthors(const string& authors, const Ice::Current& c) const { IceUtil::RWRecMutex::RLock sync(*this); @@ -260,7 +259,7 @@ LibraryI::findByAuthors(const string& authors, const Ice::Current&) const if(p != _authors.end()) { books.reserve(p->second.size()); - transform(p->second.begin(), p->second.end(), back_inserter(books), IsbnToBook(_adapter)); + transform(p->second.begin(), p->second.end(), back_inserter(books), IsbnToBook(c.adapter)); } return books; @@ -278,10 +277,7 @@ LibraryI::setEvictorSize(::Ice::Int size, const Ice::Current&) void LibraryI::shutdown(const Ice::Current& current) { - // - // No synchronization necessary, _adapter is immutable. - // - _adapter->getCommunicator()->shutdown(); + current.adapter->getCommunicator()->shutdown(); } void diff --git a/cpp/demo/Freeze/library/LibraryI.h b/cpp/demo/Freeze/library/LibraryI.h index 8fbfe2fbc75..f551279d498 100644 --- a/cpp/demo/Freeze/library/LibraryI.h +++ b/cpp/demo/Freeze/library/LibraryI.h @@ -24,7 +24,7 @@ class LibraryI : public Library, public IceUtil::RWRecMutex { public: - LibraryI(const Ice::ObjectAdapterPtr&, const Freeze::DBPtr&, const Freeze::EvictorPtr&); + LibraryI(const Freeze::DBPtr&, const Freeze::EvictorPtr&); virtual ~LibraryI(); virtual ::BookPrx createBook(const ::BookDescription&, const Ice::Current&); @@ -37,7 +37,6 @@ public: private: - Ice::ObjectAdapterPtr _adapter; Freeze::EvictorPtr _evictor; // diff --git a/cpp/demo/Freeze/library/Parser.cpp b/cpp/demo/Freeze/library/Parser.cpp index 6d866a30665..3f5211f5f42 100644 --- a/cpp/demo/Freeze/library/Parser.cpp +++ b/cpp/demo/Freeze/library/Parser.cpp @@ -595,7 +595,6 @@ Parser::parse(const string& commands, bool debug) } Parser::Parser(const CommunicatorPtr& communicator, const LibraryPrx& library) : - _communicator(communicator), _library(library) { } diff --git a/cpp/demo/Freeze/library/Parser.h b/cpp/demo/Freeze/library/Parser.h index 76dba93b61b..3e9d4646e7b 100644 --- a/cpp/demo/Freeze/library/Parser.h +++ b/cpp/demo/Freeze/library/Parser.h @@ -97,7 +97,6 @@ private: BookPrxSeq::iterator _current; std::string _commands; - Ice::CommunicatorPtr _communicator; LibraryPrx _library; bool _continue; int _errors; diff --git a/cpp/demo/Freeze/library/Server.cpp b/cpp/demo/Freeze/library/Server.cpp index 113f520f6f9..ab7d2a5b1f6 100644 --- a/cpp/demo/Freeze/library/Server.cpp +++ b/cpp/demo/Freeze/library/Server.cpp @@ -74,7 +74,7 @@ LibraryServer::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv) // // Create the library, and add it to the Object Adapter. // - LibraryIPtr library = new LibraryI(adapter, dbAuthors, evictor); + LibraryIPtr library = new LibraryI(dbAuthors, evictor); adapter->add(library, stringToIdentity("library")); // diff --git a/cpp/demo/Freeze/phonebook/Collocated.cpp b/cpp/demo/Freeze/phonebook/Collocated.cpp index 204a2347a87..8d3a2eef938 100644 --- a/cpp/demo/Freeze/phonebook/Collocated.cpp +++ b/cpp/demo/Freeze/phonebook/Collocated.cpp @@ -76,7 +76,7 @@ PhoneBookCollocated::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& d // // Create the phonebook, and add it to the Object Adapter. // - PhoneBookIPtr phoneBook = new PhoneBookI(adapter, dbPhoneBook, evictor); + PhoneBookIPtr phoneBook = new PhoneBookI(dbPhoneBook, evictor); adapter->add(phoneBook, stringToIdentity("phonebook")); // diff --git a/cpp/demo/Freeze/phonebook/Parser.cpp b/cpp/demo/Freeze/phonebook/Parser.cpp index 8bde64ba013..b77be8751e7 100644 --- a/cpp/demo/Freeze/phonebook/Parser.cpp +++ b/cpp/demo/Freeze/phonebook/Parser.cpp @@ -574,7 +574,6 @@ Parser::parse(const string& commands, bool debug) } Parser::Parser(const CommunicatorPtr& communicator, const PhoneBookPrx& phoneBook) : - _communicator(communicator), _phoneBook(phoneBook) { } diff --git a/cpp/demo/Freeze/phonebook/Parser.h b/cpp/demo/Freeze/phonebook/Parser.h index 472035f2b44..43c0028046e 100644 --- a/cpp/demo/Freeze/phonebook/Parser.h +++ b/cpp/demo/Freeze/phonebook/Parser.h @@ -97,7 +97,6 @@ private: Contacts::iterator _current; std::string _commands; - Ice::CommunicatorPtr _communicator; PhoneBookPrx _phoneBook; bool _continue; int _errors; diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp index 5bf7faa0cb2..5944704def2 100644 --- a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp +++ b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp @@ -148,8 +148,7 @@ ContactI::destroy(const Ice::Current&) } } -PhoneBookI::PhoneBookI(const ObjectAdapterPtr& adapter, const DBPtr& db, const EvictorPtr& evictor) : - _adapter(adapter), +PhoneBookI::PhoneBookI(const DBPtr& db, const EvictorPtr& evictor) : _db(db), _evictor(evictor), _nameIdentitiesDict(db) @@ -176,7 +175,7 @@ private: }; ContactPrx -PhoneBookI::createContact(const Ice::Current&) +PhoneBookI::createContact(const Ice::Current& c) { IceUtil::RWRecMutex::WLock sync(*this); @@ -221,7 +220,7 @@ PhoneBookI::createContact(const Ice::Current&) // Turn the identity into a Proxy and return the Proxy to the // caller. // - return IdentityToContact(_adapter)(ident); + return IdentityToContact(c.adapter)(ident); } catch(const Freeze::DBException& ex) { @@ -232,7 +231,7 @@ PhoneBookI::createContact(const Ice::Current&) } Contacts -PhoneBookI::findContacts(const string& name, const Ice::Current&) const +PhoneBookI::findContacts(const string& name, const Ice::Current& c) const { IceUtil::RWRecMutex::RLock sync(*this); @@ -252,7 +251,7 @@ PhoneBookI::findContacts(const string& name, const Ice::Current&) const Contacts contacts; contacts.reserve(identities.size()); - transform(identities.begin(), identities.end(), back_inserter(contacts), IdentityToContact(_adapter)); + transform(identities.begin(), identities.end(), back_inserter(contacts), IdentityToContact(c.adapter)); return contacts; } @@ -274,12 +273,9 @@ PhoneBookI::setEvictorSize(Int size, const Ice::Current&) } void -PhoneBookI::shutdown(const Ice::Current&) const +PhoneBookI::shutdown(const Ice::Current& c) const { - // - // No synchronization necessary, _adapter is immutable. - // - _adapter->getCommunicator()->shutdown(); + c.adapter->getCommunicator()->shutdown(); } void diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.h b/cpp/demo/Freeze/phonebook/PhoneBookI.h index 703c8693337..68875dcce71 100644 --- a/cpp/demo/Freeze/phonebook/PhoneBookI.h +++ b/cpp/demo/Freeze/phonebook/PhoneBookI.h @@ -58,7 +58,7 @@ class PhoneBookI : public PhoneBook, public IceUtil::RWRecMutex { public: - PhoneBookI(const Ice::ObjectAdapterPtr&, const Freeze::DBPtr&, const Freeze::EvictorPtr&); + PhoneBookI(const Freeze::DBPtr&, const Freeze::EvictorPtr&); virtual ContactPrx createContact(const Ice::Current&); virtual Contacts findContacts(const std::string&, const Ice::Current&) const; @@ -73,7 +73,6 @@ private: void removeI(const Ice::Identity&, const std::string&); - Ice::ObjectAdapterPtr _adapter; Freeze::DBPtr _db; Freeze::EvictorPtr _evictor; NameIdentitiesDict _nameIdentitiesDict; diff --git a/cpp/demo/Freeze/phonebook/Server.cpp b/cpp/demo/Freeze/phonebook/Server.cpp index 1bba00bacdd..5030c9aa5b1 100644 --- a/cpp/demo/Freeze/phonebook/Server.cpp +++ b/cpp/demo/Freeze/phonebook/Server.cpp @@ -74,7 +74,7 @@ PhoneBookServer::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv // // Create the phonebook, and add it to the Object Adapter. // - PhoneBookIPtr phoneBook = new PhoneBookI(adapter, dbPhoneBook, evictor); + PhoneBookIPtr phoneBook = new PhoneBookI(dbPhoneBook, evictor); adapter->add(phoneBook, stringToIdentity("phonebook")); // |