summaryrefslogtreecommitdiff
path: root/cpp/demo/Freeze/library/LibraryI.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-12-19 21:57:28 +0000
committerMark Spruiell <mes@zeroc.com>2002-12-19 21:57:28 +0000
commita15264b4c7f270181b0fea3db6b30896596f4ec1 (patch)
tree567b96885aabe74126edc1ac64610f9c209f6d24 /cpp/demo/Freeze/library/LibraryI.cpp
parentFixed a deadlock in adapter activation (diff)
downloadice-a15264b4c7f270181b0fea3db6b30896596f4ec1.tar.bz2
ice-a15264b4c7f270181b0fea3db6b30896596f4ec1.tar.xz
ice-a15264b4c7f270181b0fea3db6b30896596f4ec1.zip
adding destroy flag
Diffstat (limited to 'cpp/demo/Freeze/library/LibraryI.cpp')
-rw-r--r--cpp/demo/Freeze/library/LibraryI.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/cpp/demo/Freeze/library/LibraryI.cpp b/cpp/demo/Freeze/library/LibraryI.cpp
index f24f413033c..8eaed395b37 100644
--- a/cpp/demo/Freeze/library/LibraryI.cpp
+++ b/cpp/demo/Freeze/library/LibraryI.cpp
@@ -18,7 +18,7 @@
using namespace std;
BookI::BookI(const LibraryIPtr& library) :
- _library(library)
+ _library(library), _destroyed(false)
{
}
@@ -31,6 +31,13 @@ BookI::destroy(const Ice::Current&)
{
IceUtil::RWRecMutex::RLock sync(*this);
+ if(_destroyed)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+
+ _destroyed = true;
+
try
{
_library->remove(description);
@@ -52,6 +59,13 @@ BookI::destroy(const Ice::Current&)
::BookDescription
BookI::getBookDescription(const Ice::Current&) const
{
+ IceUtil::RWRecMutex::RLock sync(*this);
+
+ if(_destroyed)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+
// Immutable
return description;
}
@@ -61,6 +75,11 @@ BookI::getRenterName(const Ice::Current&) const
{
IceUtil::RWRecMutex::RLock sync(*this);
+ if(_destroyed)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+
if(rentalCustomerName.empty())
{
throw BookNotRentedException();
@@ -73,6 +92,11 @@ BookI::rentBook(const ::std::string& name, const Ice::Current&)
{
IceUtil::RWRecMutex::WLock sync(*this);
+ if(_destroyed)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+
if(!rentalCustomerName.empty())
{
throw BookRentedException();
@@ -85,6 +109,11 @@ BookI::returnBook(const Ice::Current&)
{
IceUtil::RWRecMutex::WLock sync(*this);
+ if(_destroyed)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+
if(rentalCustomerName.empty())
{
throw BookNotRentedException();