diff options
Diffstat (limited to 'cpp/test/IceBox/admin/TestI.cpp')
-rw-r--r-- | cpp/test/IceBox/admin/TestI.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cpp/test/IceBox/admin/TestI.cpp b/cpp/test/IceBox/admin/TestI.cpp new file mode 100644 index 00000000000..e729d9adfcf --- /dev/null +++ b/cpp/test/IceBox/admin/TestI.cpp @@ -0,0 +1,50 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace Test; + +TestFacetI::TestFacetI() : + _called(false) +{ +} + +Ice::PropertyDict +TestFacetI::getChanges(const Ice::Current& current) +{ + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + + // + // The client calls PropertiesAdmin::setProperties() and then invokes + // this operation. Since setProperties() is implemented using AMD, the + // client might receive its reply and then call getChanges() before our + // updated() method is called. We block here to ensure that updated() + // gets called before we return the most recent set of changes. + // + while(!_called) + { + wait(); + } + + _called = false; + + return _changes; +} + +void +TestFacetI::updated(const Ice::PropertyDict& changes) +{ + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + + _changes = changes; + _called = true; + notify(); +} |