[asterisk-scf-commits] asterisk-scf/integration/test_channel.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Sep 15 08:32:37 CDT 2010


branch "master" has been updated
       via  f32ea798b60fff56d0f125912413dd7066ed313d (commit)
      from  322c0254039000c9388bb93db8dad1130208922f (commit)

Summary of changes:
 include/TestEndpoint.h |    5 +----
 src/Service.cpp        |    2 +-
 src/TestEndpoint.cpp   |   17 +++++------------
 3 files changed, 7 insertions(+), 17 deletions(-)


- Log -----------------------------------------------------------------
commit f32ea798b60fff56d0f125912413dd7066ed313d
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Sep 15 10:02:39 2010 -0230

    Remove singleton instantiation semantics from test driver to allow
    for multiple instances to be created.

diff --git a/include/TestEndpoint.h b/include/TestEndpoint.h
index f8f85a2..19fb508 100755
--- a/include/TestEndpoint.h
+++ b/include/TestEndpoint.h
@@ -28,10 +28,7 @@ namespace TestUtil
         //
         TestEndpoint() {}
     public:
-        static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr initialize(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id);
-    private:
-        static boost::shared_mutex mMutex;
-        static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr mImpl;
+        static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr create(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id);
     };
 }
 } // End of namespace AsteriskSCF
diff --git a/src/Service.cpp b/src/Service.cpp
index c17b02b..22f5b4c 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -59,7 +59,7 @@ int TestChannelDriver::run(int, char*[])
     Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("AsteriskSCF.TestChannelService");
     adapter->activate();
 
-    AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr servant = AsteriskSCF::TestUtil::TestEndpoint::initialize(mConsoleDriver, adapter, "TestChannel.Locator");
+    AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr servant = AsteriskSCF::TestUtil::TestEndpoint::create(mConsoleDriver, adapter, "TestChannel.Locator");
     AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx endpointLocatorPrx = 
         AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx::checkedCast(adapter->add(servant, communicator()->stringToIdentity("TestChannel")));
 
diff --git a/src/TestEndpoint.cpp b/src/TestEndpoint.cpp
index 4df6457..921238e 100644
--- a/src/TestEndpoint.cpp
+++ b/src/TestEndpoint.cpp
@@ -460,19 +460,12 @@ private:
 
 typedef IceUtil::Handle<EndpointLocatorI> EndpointLocatorIPtr;
 
-boost::shared_mutex AsteriskSCF::TestUtil::TestEndpoint::mMutex;
-AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr AsteriskSCF::TestUtil::TestEndpoint::mImpl;
-
-    AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr TestEndpoint::initialize(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id)
+AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr TestEndpoint::create(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id)
 {
-    boost::unique_lock<boost::shared_mutex> lock(mMutex);
-    if(mImpl.get() == 0)
-    {
-        EndpointLocatorIPtr impl(new EndpointLocatorI(adapter, id));
-        driver->setHandler(CommandsPtr::dynamicCast(impl->getCommandInterface()));
-        mImpl = AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr::dynamicCast(impl);
-    }
-    return mImpl;
+    
+    EndpointLocatorIPtr impl(new EndpointLocatorI(adapter, id));
+    driver->setHandler(CommandsPtr::dynamicCast(impl->getCommandInterface()));
+    return  AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr::dynamicCast(impl);
 }
 
 }

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/test_channel.git



More information about the asterisk-scf-commits mailing list