diff options
author | Mark Spruiell <mes@zeroc.com> | 2010-04-05 15:47:54 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2010-04-05 15:47:54 -0700 |
commit | e1b51ca329d346d7e1666b8f1b16164aa6bb7eea (patch) | |
tree | f3bfffa54ddad539da93db9fcec28f6c24586a96 /cpp | |
parent | bug 4718 - Glacier2 helpers need to trap CommunicatorDestroyedException (diff) | |
download | ice-e1b51ca329d346d7e1666b8f1b16164aa6bb7eea.tar.bz2 ice-e1b51ca329d346d7e1666b8f1b16164aa6bb7eea.tar.xz ice-e1b51ca329d346d7e1666b8f1b16164aa6bb7eea.zip |
bug 4717 - minor fixes to casino demo
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/Freeze/casino/BankI.cpp | 27 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/BankI.h | 35 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/BetI.cpp | 26 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/BetI.h | 14 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/BetResolver.cpp | 5 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/BetResolver.h | 7 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/Client.cpp | 33 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/PlayerI.cpp | 7 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/PlayerI.h | 10 | ||||
-rw-r--r-- | cpp/demo/Freeze/casino/Server.cpp | 95 |
10 files changed, 129 insertions, 130 deletions
diff --git a/cpp/demo/Freeze/casino/BankI.cpp b/cpp/demo/Freeze/casino/BankI.cpp index 9aba51d1738..a3c632570b8 100644 --- a/cpp/demo/Freeze/casino/BankI.cpp +++ b/cpp/demo/Freeze/casino/BankI.cpp @@ -18,7 +18,7 @@ BankI::buyChips(int chips, const Casino::PlayerPrx& p, const Ice::Current&) { outstandingChips += chips; chipsSold += chips; - + CasinoStore::PersistentPlayerPrx player = CasinoStore::PersistentPlayerPrx::uncheckedCast(p); try @@ -40,7 +40,7 @@ BankI::getPlayers(const Ice::Current& current) const Casino::PlayerPrxSeq result; Freeze::EvictorIteratorPtr p = _playerEvictor->getIterator("", 10); - + while(p->hasNext()) { Ice::Identity ident = p->next(); @@ -55,7 +55,7 @@ BankI::getOutstandingChips(const Ice::Current&) const { return outstandingChips; } - + int BankI::getEarnings(const Ice::Current&) const { @@ -71,7 +71,7 @@ BankI::getLiveBetCount(const Ice::Current&) const bool BankI::checkAllChips(const Ice::Current& current) const -{ +{ int playerTotal = 0; Casino::PlayerPrxSeq players = getPlayers(current); @@ -114,7 +114,7 @@ BankI::createBet(int amount, int lifetime, const Ice::Current&) outstandingChips += amount; Ice::ObjectPtr betI = new BetI(amount, closeTime, _prx, _betEvictor, _bankEdge); - CasinoStore::PersistentBetPrx newBet = + CasinoStore::PersistentBetPrx newBet = CasinoStore::PersistentBetPrx::uncheckedCast(_betEvictor->add(betI, ident)); _betResolver->add(newBet, closeTime); @@ -144,7 +144,7 @@ BankI::returnAllChips(const CasinoStore::PersistentPlayerPrx& p, const Ice::Curr assert(0); throw Freeze::DatabaseException(__FILE__, __LINE__, "returnAllChips: player does not exist"); } - + if(count != 0) { try @@ -168,7 +168,7 @@ void BankI::reloadBets(const Ice::Current& current) { vector<CasinoStore::PersistentBetPrx> bets = getBets(current.adapter); - + for(size_t i = 0; i < bets.size(); ++i) { _betResolver->add(bets[i], bets[i]->getCloseTime()); @@ -179,8 +179,8 @@ BankI::BankI() { } -BankI::BankI(const CasinoStore::PersistentBankPrx& prx, - const Freeze::TransactionalEvictorPtr& evictor, const Freeze::TransactionalEvictorPtr& playerEvictor, +BankI::BankI(const CasinoStore::PersistentBankPrx& prx, + const Freeze::TransactionalEvictorPtr& evictor, const Freeze::TransactionalEvictorPtr& playerEvictor, const Freeze::TransactionalEvictorPtr& betEvictor, BetResolver& betResolver, int bankEdge) { chipsSold = 0; @@ -188,10 +188,9 @@ BankI::BankI(const CasinoStore::PersistentBankPrx& prx, init(prx, evictor, playerEvictor, betEvictor, betResolver, bankEdge); } - -void +void BankI::init(const CasinoStore::PersistentBankPrx& prx, - const Freeze::TransactionalEvictorPtr& evictor, const Freeze::TransactionalEvictorPtr& playerEvictor, + const Freeze::TransactionalEvictorPtr& evictor, const Freeze::TransactionalEvictorPtr& playerEvictor, const Freeze::TransactionalEvictorPtr& betEvictor, BetResolver& betResolver, int bankEdge) { _prx = prx; @@ -202,13 +201,13 @@ BankI::init(const CasinoStore::PersistentBankPrx& prx, _bankEdge = bankEdge; } -vector<CasinoStore::PersistentBetPrx> +vector<CasinoStore::PersistentBetPrx> BankI::getBets(const Ice::ObjectAdapterPtr& adapter) const { vector<CasinoStore::PersistentBetPrx> result; Freeze::EvictorIteratorPtr p = _betEvictor->getIterator("", 100); - + while(p->hasNext()) { Ice::Identity ident = p->next(); diff --git a/cpp/demo/Freeze/casino/BankI.h b/cpp/demo/Freeze/casino/BankI.h index 7d2a1182285..6fee4e1af22 100644 --- a/cpp/demo/Freeze/casino/BankI.h +++ b/cpp/demo/Freeze/casino/BankI.h @@ -20,40 +20,39 @@ class BankI : public CasinoStore::PersistentBank public: virtual bool buyChips(int, const Casino::PlayerPrx&, const Ice::Current&); - + virtual Casino::PlayerPrxSeq getPlayers(const Ice::Current&) const; - + virtual int getOutstandingChips(const Ice::Current&) const; - + virtual int getEarnings(const Ice::Current&) const; - + virtual int getLiveBetCount(const Ice::Current&) const; - + virtual bool checkAllChips(const Ice::Current&) const; - + virtual Casino::BetPrx createBet(int, int, const Ice::Current&); - + virtual void win(int, const Ice::Current&); - + virtual void returnAllChips(const CasinoStore::PersistentPlayerPrx&, const Ice::Current&); - + virtual void reloadBets(const Ice::Current&); - + BankI(); - - BankI(const CasinoStore::PersistentBankPrx&, - const Freeze::TransactionalEvictorPtr&, const Freeze::TransactionalEvictorPtr&, + + BankI(const CasinoStore::PersistentBankPrx&, + const Freeze::TransactionalEvictorPtr&, const Freeze::TransactionalEvictorPtr&, const Freeze::TransactionalEvictorPtr&, BetResolver&, int); - void + void init(const CasinoStore::PersistentBankPrx&, - const Freeze::TransactionalEvictorPtr&, const Freeze::TransactionalEvictorPtr&, - const Freeze::TransactionalEvictorPtr&, BetResolver& betResolver, int); + const Freeze::TransactionalEvictorPtr&, const Freeze::TransactionalEvictorPtr&, + const Freeze::TransactionalEvictorPtr&, BetResolver&, int); private: - + std::vector<CasinoStore::PersistentBetPrx> getBets(const Ice::ObjectAdapterPtr&) const; - #if (defined(_MSC_VER) && (_MSC_VER < 1300)) || defined(__BCPLUSPLUS__) // diff --git a/cpp/demo/Freeze/casino/BetI.cpp b/cpp/demo/Freeze/casino/BetI.cpp index c652136c5f0..f0dda403e42 100644 --- a/cpp/demo/Freeze/casino/BetI.cpp +++ b/cpp/demo/Freeze/casino/BetI.cpp @@ -9,22 +9,22 @@ #include <BetI.h> - -int +int BetI::getAmount(const Ice::Current&) const { return amount; } -void +void BetI::accept(const Casino::PlayerPrx& p, const Ice::Current&) { - CasinoStore::PersistentPlayerPrx player = CasinoStore::PersistentPlayerPrx::uncheckedCast(p); - if(player == 0) + if(!p) { throw Casino::OutOfChipsException(); } - + + CasinoStore::PersistentPlayerPrx player = CasinoStore::PersistentPlayerPrx::uncheckedCast(p); + try { player->withdraw(amount); @@ -36,7 +36,7 @@ BetI::accept(const Casino::PlayerPrx& p, const Ice::Current&) } } -int +int BetI::getChipsInPlay(const Ice::Current&) const { return amount * static_cast<int>(potentialWinners.size()); @@ -62,14 +62,14 @@ BetI::complete(int random, const Ice::Current& current) // Pick a winner using random // int winnerIndex = random % (size + (_bankEdge - 1)); - + if(winnerIndex >= size) { winnerIndex = 0; } - + CasinoStore::WinnerPrx winner = potentialWinners[winnerIndex]; - + try { winner->win(amount * size); @@ -82,7 +82,7 @@ BetI::complete(int random, const Ice::Current& current) winner = potentialWinners[0]; winner->win(amount * size); } - + // // Self-destroys // @@ -93,7 +93,7 @@ BetI::BetI() { } -BetI::BetI(int amount, Ice::Long closeTime, const CasinoStore::PersistentBankPrx& bank, +BetI::BetI(int amount, Ice::Long closeTime, const CasinoStore::PersistentBankPrx& bank, const Freeze::TransactionalEvictorPtr& evictor, int bankEdge) { this->amount = amount; @@ -108,5 +108,3 @@ BetI::init(const Freeze::TransactionalEvictorPtr& evictor, int bankEdge) _evictor = evictor; _bankEdge = bankEdge; } - - diff --git a/cpp/demo/Freeze/casino/BetI.h b/cpp/demo/Freeze/casino/BetI.h index 7beedf2032b..75f2c482dac 100644 --- a/cpp/demo/Freeze/casino/BetI.h +++ b/cpp/demo/Freeze/casino/BetI.h @@ -19,25 +19,25 @@ class BetI : public CasinoStore::PersistentBet public: virtual int getAmount(const Ice::Current&) const; - + virtual void accept(const Casino::PlayerPrx&, const Ice::Current&); - + virtual int getChipsInPlay(const Ice::Current&) const; - + virtual Ice::Long getCloseTime(const Ice::Current&) const; - + virtual void complete(int, const Ice::Current&); BetI(); - + BetI(int, Ice::Long, const CasinoStore::PersistentBankPrx&, const Freeze::TransactionalEvictorPtr& evictor, int); - + void init(const Freeze::TransactionalEvictorPtr&, int); private: - Freeze::TransactionalEvictorPtr _evictor; + Freeze::TransactionalEvictorPtr _evictor; int _bankEdge; }; diff --git a/cpp/demo/Freeze/casino/BetResolver.cpp b/cpp/demo/Freeze/casino/BetResolver.cpp index 9271770b4a8..f518f7a673c 100644 --- a/cpp/demo/Freeze/casino/BetResolver.cpp +++ b/cpp/demo/Freeze/casino/BetResolver.cpp @@ -27,7 +27,6 @@ BetResolver::start() } } - void BetResolver::add(const CasinoStore::PersistentBetPrx& bet, Ice::Long closeTime) { @@ -41,7 +40,7 @@ BetResolver::add(const CasinoStore::PersistentBetPrx& bet, Ice::Long closeTime) { } - virtual void + virtual void runTimerTask() { try @@ -65,7 +64,7 @@ BetResolver::add(const CasinoStore::PersistentBetPrx& bet, Ice::Long closeTime) private: BetResolver& _resolver; CasinoStore::PersistentBetPrx _bet; - + }; IceUtil::Time timeLeft = IceUtil::Time::milliSeconds(closeTime) - IceUtil::Time::now(); diff --git a/cpp/demo/Freeze/casino/BetResolver.h b/cpp/demo/Freeze/casino/BetResolver.h index fa6bb3984b9..bc27b8185ea 100644 --- a/cpp/demo/Freeze/casino/BetResolver.h +++ b/cpp/demo/Freeze/casino/BetResolver.h @@ -23,11 +23,11 @@ public: BetResolver(); void start(); - + void add(const CasinoStore::PersistentBetPrx&, Ice::Long); - + void destroy(); - + int getBetCount() const; #if (!defined(_MSC_VER) || (_MSC_VER >= 1300)) && (!defined(__BCPLUSPLUS__)) @@ -47,4 +47,3 @@ private: }; #endif - diff --git a/cpp/demo/Freeze/casino/Client.cpp b/cpp/demo/Freeze/casino/Client.cpp index 60f0921ea2c..d94c223aefb 100644 --- a/cpp/demo/Freeze/casino/Client.cpp +++ b/cpp/demo/Freeze/casino/Client.cpp @@ -55,19 +55,19 @@ CasinoClient::run(int argc, char* argv[]) cout << "Retrieve bank and players... " << flush; Casino::BankPrx bank = Casino::BankPrx::uncheckedCast(communicator()->propertyToProxy("Bank.Proxy")); - + Casino::PlayerPrxSeq players = bank->getPlayers(); cout << "ok" << endl; cout << "Starting balances" << endl; printBalances(players); - + cout << "Current bank earnings: " << bank->getEarnings() << " chips" << endl; cout << "All chips accounted for? " << (bank->checkAllChips() ? "yes" : "no") << endl; - + cout << "Each player buys 3,000 chips... " << flush; - + for(size_t i = 0; i < players.size(); ++i) { Casino::PlayerPrx player = players[i]; @@ -75,7 +75,7 @@ CasinoClient::run(int argc, char* argv[]) { if(!bank->buyChips(3000, player)) { - cout << "(" << player->ice_getIdentity().name << "is gone) " << flush; + cout << "(" << player->ice_getIdentity().name << " is gone) " << flush; players[i] = 0; } } @@ -83,7 +83,7 @@ CasinoClient::run(int argc, char* argv[]) cout << "ok" << endl; cout << "All chips accounted for? " << (bank->checkAllChips() ? "yes" : "no") << endl; - + cout << "Create " << betCount1 << " 10-chips bets... " << flush; int b; @@ -108,7 +108,7 @@ CasinoClient::run(int argc, char* argv[]) catch(const Casino::OutOfChipsException&) { cout << "(" << player->ice_getIdentity().name << " is out) " << flush; - + players[i] = 0; } } @@ -117,7 +117,7 @@ CasinoClient::run(int argc, char* argv[]) cout << " ok" << endl; cout << "Live bets: " << bank->getLiveBetCount() << endl; - + int index = static_cast<int>(rand() % players.size()); Casino::PlayerPrx gonner = players[index]; players[index] = 0; @@ -139,13 +139,12 @@ CasinoClient::run(int argc, char* argv[]) } cout << "All chips accounted for? " << (bank->checkAllChips() ? "yes" : "no") << endl; - + cout << "Sleep for 2 seconds" << endl; IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2)); cout << "Live bets: " << bank->getLiveBetCount() << endl; - cout << "Create " << betCount2 << " 10-chips bets... " << flush; for(b = 0; b < betCount2; ++b) @@ -169,22 +168,22 @@ CasinoClient::run(int argc, char* argv[]) catch(const Casino::OutOfChipsException&) { cout << "(" << player->ice_getIdentity().name << " is out) " << flush; - + players[i] = 0; } } } } cout << " ok" << endl; - + cout << "Live bets: " << bank->getLiveBetCount() << endl; cout << "Sleep for 10 seconds" << endl; IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(10)); cout << "Live bets: " << bank->getLiveBetCount() << endl; - + cout << "Ending balances" << endl; printBalances(players); - + cout << "Current bank earnings: " << bank->getEarnings() << " chips" << endl; cout << "All chips accounted for? " << (bank->checkAllChips() ? "yes" : "no") << endl; @@ -192,19 +191,19 @@ CasinoClient::run(int argc, char* argv[]) return 0; } -void +void CasinoClient::printBalances(Casino::PlayerPrxSeq& players) const { for(size_t i = 0; i < players.size(); ++i) { Casino::PlayerPrx player = players[i]; - + if(player != 0) { try { int chips = player->getChips(); - cout << player->ice_getIdentity().name << ": " << chips << " chips" << endl; + cout << player->ice_getIdentity().name << ": " << chips << " chips" << endl; } catch(const Ice::ObjectNotExistException&) { diff --git a/cpp/demo/Freeze/casino/PlayerI.cpp b/cpp/demo/Freeze/casino/PlayerI.cpp index 7c1761c13c3..8b588824cfe 100644 --- a/cpp/demo/Freeze/casino/PlayerI.cpp +++ b/cpp/demo/Freeze/casino/PlayerI.cpp @@ -22,7 +22,7 @@ PlayerI::destroy(const Ice::Current& current) _evictor->remove(current.id); } -void +void PlayerI::withdraw(int count, const Ice::Current&) { int newBalance = chips - count; @@ -45,12 +45,11 @@ PlayerI::PlayerI() : { } -void -PlayerI::init(const CasinoStore::PersistentPlayerPrx& myPrx, const Freeze::TransactionalEvictorPtr& evictor, +void +PlayerI::init(const CasinoStore::PersistentPlayerPrx& myPrx, const Freeze::TransactionalEvictorPtr& evictor, const CasinoStore::PersistentBankPrx& bank) { _myPrx = myPrx; _evictor = evictor; _bank = bank; } - diff --git a/cpp/demo/Freeze/casino/PlayerI.h b/cpp/demo/Freeze/casino/PlayerI.h index 909b5a27719..c60a61ee0a4 100644 --- a/cpp/demo/Freeze/casino/PlayerI.h +++ b/cpp/demo/Freeze/casino/PlayerI.h @@ -21,16 +21,16 @@ public: virtual int getChips(const Ice::Current&) const; virtual void destroy(const Ice::Current&); - + virtual void withdraw(int, const Ice::Current&); - + virtual void win(int count, const Ice::Current&); - + PlayerI(); - void init(const CasinoStore::PersistentPlayerPrx&, const Freeze::TransactionalEvictorPtr&, + void init(const CasinoStore::PersistentPlayerPrx&, const Freeze::TransactionalEvictorPtr&, const CasinoStore::PersistentBankPrx&); - + private: CasinoStore::PersistentPlayerPrx _myPrx; diff --git a/cpp/demo/Freeze/casino/Server.cpp b/cpp/demo/Freeze/casino/Server.cpp index 5f78ebc6b5f..46138f8baf8 100644 --- a/cpp/demo/Freeze/casino/Server.cpp +++ b/cpp/demo/Freeze/casino/Server.cpp @@ -36,40 +36,39 @@ private: // public: #endif + CasinoStore::PersistentBankPrx _bankPrx; Freeze::TransactionalEvictorPtr _bankEvictor; Freeze::TransactionalEvictorPtr _playerEvictor; Freeze::TransactionalEvictorPtr _betEvictor; - BetResolver _betResolver; + BetResolver _betResolver; int _bankEdge; }; -int +int main(int argc, char* argv[]) { CasinoServer app("db"); return app.main(argc, argv, "config.server"); } - template<class T> class ObjectFactory : public Ice::ObjectFactory { public: - + virtual Ice::ObjectPtr create(const string& type) { return new T; } - + virtual void destroy() { } }; - int CasinoServer::run(int argc, char* argv[]) { @@ -92,7 +91,7 @@ CasinoServer::run(int argc, char* argv[]) _bankEdge = 1; } cout << "Bank edge is " << _bankEdge << endl; - + // // Create an object adapter // @@ -104,15 +103,15 @@ CasinoServer::run(int argc, char* argv[]) communicator()->addObjectFactory(new ObjectFactory<BankI>, CasinoStore::PersistentBank::ice_staticId()); communicator()->addObjectFactory(new ObjectFactory<PlayerI>, CasinoStore::PersistentPlayer::ice_staticId()); communicator()->addObjectFactory(new ObjectFactory<BetI>, CasinoStore::PersistentBet::ice_staticId()); - + // // Create evictors; each type gets its own type-specific evictor // - + // // Bank evictor // - + class BankInitializer : public Freeze::ServantInitializer { public: @@ -122,21 +121,24 @@ CasinoServer::run(int argc, char* argv[]) { } - virtual void - initialize(const Ice::ObjectAdapterPtr& adapter, const Ice::Identity& identity, const string& facet, const Ice::ObjectPtr& servant) + virtual void + initialize(const Ice::ObjectAdapterPtr& adapter, const Ice::Identity& identity, const string& facet, + const Ice::ObjectPtr& servant) { BankI* bank = dynamic_cast<BankI*>(servant.get()); - bank->init(_server._bankPrx, _server._bankEvictor, _server._playerEvictor, _server._betEvictor, _server._betResolver, _server._bankEdge); + bank->init(_server._bankPrx, _server._bankEvictor, _server._playerEvictor, _server._betEvictor, + _server._betResolver, _server._bankEdge); } + private: CasinoServer& _server; }; _bankEvictor = - Freeze::createTransactionalEvictor(adapter, _envName, "bank", + Freeze::createTransactionalEvictor(adapter, _envName, "bank", createTypeMap(CasinoStore::PersistentBank::ice_staticId()), new BankInitializer(*this)); - + int size = properties->getPropertyAsInt("Bank.EvictorSize"); if(size > 0) { @@ -145,7 +147,6 @@ CasinoServer::run(int argc, char* argv[]) adapter->addServantLocator(_bankEvictor, "bank"); - // // Player evictor // @@ -158,33 +159,34 @@ CasinoServer::run(int argc, char* argv[]) _server(server) { } - - virtual void - initialize(const Ice::ObjectAdapterPtr& adapter, const Ice::Identity& identity, const string& facet, const Ice::ObjectPtr& servant) + + virtual void + initialize(const Ice::ObjectAdapterPtr& adapter, const Ice::Identity& identity, const string& facet, + const Ice::ObjectPtr& servant) { - CasinoStore::PersistentPlayerPrx prx = + CasinoStore::PersistentPlayerPrx prx = CasinoStore::PersistentPlayerPrx::uncheckedCast(adapter->createProxy(identity)); - + PlayerI* player = dynamic_cast<PlayerI*>(servant.get()); player->init(prx, _server._playerEvictor, _server._bankPrx); } + private: CasinoServer& _server; }; - + _playerEvictor = - Freeze::createTransactionalEvictor(adapter, _envName, "player", + Freeze::createTransactionalEvictor(adapter, _envName, "player", createTypeMap(CasinoStore::PersistentPlayer::ice_staticId()), new PlayerInitializer(*this)); - + size = properties->getPropertyAsInt("Player.EvictorSize"); if(size > 0) { _playerEvictor->setSize(size); } - - adapter->addServantLocator(_playerEvictor, "player"); + adapter->addServantLocator(_playerEvictor, "player"); // // Bet evictor @@ -198,19 +200,21 @@ CasinoServer::run(int argc, char* argv[]) _server(server) { } - - virtual void - initialize(const Ice::ObjectAdapterPtr& adapter, const Ice::Identity& identity, const string& facet, const Ice::ObjectPtr& servant) - { + + virtual void + initialize(const Ice::ObjectAdapterPtr& adapter, const Ice::Identity& identity, const string& facet, + const Ice::ObjectPtr& servant) + { BetI* bet = dynamic_cast<BetI*>(servant.get()); bet->init(_server._betEvictor, _server._bankEdge); } + private: CasinoServer& _server; }; _betEvictor = - Freeze::createTransactionalEvictor(adapter, _envName, "bet", + Freeze::createTransactionalEvictor(adapter, _envName, "bet", createTypeMap(CasinoStore::PersistentBet::ice_staticId()), new BetInitializer(*this)); size = properties->getPropertyAsInt("Bet.EvictorSize"); @@ -220,7 +224,6 @@ CasinoServer::run(int argc, char* argv[]) } adapter->addServantLocator(_betEvictor, "bet"); - // // Prepare startup @@ -233,27 +236,31 @@ CasinoServer::run(int argc, char* argv[]) // // Retrieve / create the bank // - + Ice::Identity bankId = communicator()->stringToIdentity("bank/Montecito"); _bankPrx = CasinoStore::PersistentBankPrx::uncheckedCast(adapter->createProxy(bankId)); - + if(!_bankEvictor->hasObject(bankId)) { - _bankEvictor->add(new BankI(_bankPrx, _bankEvictor, _playerEvictor, _betEvictor, _betResolver, _bankEdge), bankId); + _bankEvictor->add(new BankI(_bankPrx, _bankEvictor, _playerEvictor, _betEvictor, _betResolver, _bankEdge), + bankId); } - + // // reload existing bets into the bet resolver // - + _bankPrx->reloadBets(); - + // // Create players / recreate missing players // - const string players[] = { "al", "bob", "charlie", "dave", "ed", "fred", "gene", "herb", "irvin", "joe", "ken", "lance" }; - + const string players[] = + { + "al", "bob", "charlie", "dave", "ed", "fred", "gene", "herb", "irvin", "joe", "ken", "lance" + }; + for(size_t i = 0; i < 12; ++i) { #if defined(_MSC_VER) && (_MSC_VER < 1300) @@ -267,16 +274,16 @@ CasinoServer::run(int argc, char* argv[]) { _playerEvictor->add(new PlayerI, ident); } - } - + } + // // Everything is ready, activate // adapter->activate(); - + shutdownOnInterrupt(); communicator()->waitForShutdown(); - + _betResolver.destroy(); } catch(...) |