diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IcePack/Forward.cpp | 163 | ||||
-rw-r--r-- | cpp/src/IcePack/Forward.h | 46 | ||||
-rw-r--r-- | cpp/src/IcePack/Makefile | 11 | ||||
-rw-r--r-- | cpp/src/IcePack/icepackS.dsp | 12 |
4 files changed, 10 insertions, 222 deletions
diff --git a/cpp/src/IcePack/Forward.cpp b/cpp/src/IcePack/Forward.cpp deleted file mode 100644 index d1573912a5a..00000000000 --- a/cpp/src/IcePack/Forward.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2001 -// MutableRealms, Inc. -// Huntsville, AL, USA -// -// All Rights Reserved -// -// ********************************************************************** - -#include <Ice/Ice.h> -#include <IcePack/Forward.h> -#include <IcePack/Admin.h> - -using namespace std; -using namespace Ice; -using namespace IcePack; - -IcePack::Forward::Forward(const CommunicatorPtr& communicator, const AdminPtr& admin) : - _communicator(communicator), - _admin(admin) -{ -#ifndef _WIN32 - _activator = new Activator(_communicator); - _activator->start(); - - _waitTime = _communicator->getProperties()->getPropertyAsIntWithDefault("IcePack.Activator.WaitTime", 10); - if(_waitTime < 0) - { - _waitTime = 0; - } -#endif -} - -IcePack::Forward::~Forward() -{ -} - -ObjectPtr -IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const Current& current, LocalObjectPtr&) -{ - // - // Look up the server description - // - ServerDescription desc = _admin->find(current.id, current); - - // - // If we didn't find a server description, we return null, meaning - // that the client will get an "object not exist" exception. - // - if(!desc.obj) - { - return 0; - } - -#ifndef _WIN32 - - assert(_activator); - - // - // We only try to activate if we have a path for the server - // - if(!desc.path.empty()) - { - try - { - bool doSleep = false; - int count = 0; - while(true) - { - try - { - // - // Activate the server. If the server is already - // running, this operation does nothing. - // - if(_activator->activate(desc)) - { - // - // If we just activated the server, we sleep - // below, to give the server some time to - // start up. - // - doSleep = true; - } - - if(doSleep) - { - sleep(1); - } - - // - // Try to ping the server, to make sure that it is - // really running. Note that even if activate() - // above returns false, i.e., if activate() - // indicates that the server was already running, - // it's still possible that the server shut down - // in the meantime, for example, because of a - // server timeout, a crash, or an explicit - // shutdown method. - // - desc.obj->ice_ping(); - - // - // Everything ok, the server is now up and - // running. The ping above also has the effect - // that the server idle timeout (if set) has been - // reset. If we wouldn't ping, there would be a - // higher chance that the server shuts down - // because of an idle timeout while we send back - // the location forward to the client. - // - break; - } - catch(const SocketException&) - { - // - // Ooops, we got a socket exception while trying - // to ping the server. Let's set the doSleep flag - // to give the server more time before we try - // again. - // - if(++count >= _waitTime) - { - throw; - } - - doSleep = true; - } - } - } - catch(const Exception& ex) - { - // - // If we get an exception, all we an do is to log it and - // to send a location forward to the client, which will - // then get a similar exception. - // - Error out(_communicator->getLogger()); - out << "exception during server activation:\n" << ex; - } - } - -#endif - - throw LocationForward(desc.obj); -} - -void -IcePack::Forward::finished(const ObjectAdapterPtr&, const Current&, const ObjectPtr&, const LocalObjectPtr&) -{ - // Nothing to do -} - -void -IcePack::Forward::deactivate() -{ -#ifndef _WIN32 - _activator->destroy(); - _activator->getThreadControl().join(); - _activator = 0; -#endif -} diff --git a/cpp/src/IcePack/Forward.h b/cpp/src/IcePack/Forward.h deleted file mode 100644 index ac2f2646238..00000000000 --- a/cpp/src/IcePack/Forward.h +++ /dev/null @@ -1,46 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2001 -// MutableRealms, Inc. -// Huntsville, AL, USA -// -// All Rights Reserved -// -// ********************************************************************** - -#ifndef ICE_PACK_FORWARD_H -#define ICE_PACK_FORWARD_H - -#include <IcePack/AdminF.h> -#ifndef _WIN32 -# include <IcePack/Activator.h> -#endif - -namespace IcePack -{ - -class Forward : public Ice::ServantLocator -{ -public: - - Forward(const Ice::CommunicatorPtr& communicator, const AdminPtr&); - virtual ~Forward(); - - virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&); - virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&, - const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void deactivate(); - -private: - - Ice::CommunicatorPtr _communicator; - AdminPtr _admin; -#ifndef _WIN32 - ActivatorPtr _activator; - int _waitTime; -#endif -}; - -} - -#endif diff --git a/cpp/src/IcePack/Makefile b/cpp/src/IcePack/Makefile index e6f9a0bed69..a20e8956542 100644 --- a/cpp/src/IcePack/Makefile +++ b/cpp/src/IcePack/Makefile @@ -44,6 +44,7 @@ SRCS = $(OBJS:.o=.cpp) \ $(SOBJS:.o=.cpp) HDIR = $(includedir)/IcePack +LOCAL_HDIR = ../IcePack SDIR = $(slicedir)/IcePack SLICECMD = $(SLICE2CPP) --include-dir IcePack --dll-export ICE_PACK_API -I$(slicedir) @@ -99,14 +100,14 @@ $(HDIR)/AdminF.h: $(SDIR)/AdminF.ice $(SLICE2CPP) clean:: rm -f $(HDIR)/AdminF.h -AdapterManager.h AdapterManager.cpp: AdapterManager.ice $(SLICE2CPP) +$(LOCAL_HDIR)/AdapterManager.h AdapterManager.cpp: AdapterManager.ice $(SLICE2CPP) rm -f AdapterManager.h AdapterManager.cpp $(SLICECMD) -I.. AdapterManager.ice clean:: rm -f AdapterManager.h AdapterManager.cpp -AdapterManagerF.h: AdapterManagerF.ice $(SLICE2CPP) +$(LOCAL_HDIR)/AdapterManagerF.h: AdapterManagerF.ice $(SLICE2CPP) rm -f AdapterManagerF.h AdapterManagerF.cpp $(SLICECMD) -I.. AdapterManagerF.ice rm -f AdapterManagerF.cpp @@ -114,14 +115,14 @@ AdapterManagerF.h: AdapterManagerF.ice $(SLICE2CPP) clean:: rm -f AdapterManagerF.h -ServerManager.h ServerManager.cpp: ServerManager.ice $(SLICE2CPP) +$(LOCAL_HDIR)/ServerManager.h ServerManager.cpp: ServerManager.ice $(SLICE2CPP) rm -f ServerManager.h ServerManager.cpp $(SLICECMD) -I.. ServerManager.ice clean:: rm -f ServerManager.h ServerManager.cpp -ServerManagerF.h: ServerManagerF.ice $(SLICE2CPP) +$(LOCAL_HDIR)/ServerManagerF.h: ServerManagerF.ice $(SLICE2CPP) rm -f ServerManagerF.h ServerManagerF.cpp $(SLICECMD) -I.. ServerManagerF.ice rm -f ServerManagerF.cpp @@ -129,7 +130,7 @@ ServerManagerF.h: ServerManagerF.ice $(SLICE2CPP) clean:: rm -f ServerManagerF.h -Activator.h Activator.cpp: Activator.ice $(SLICE2CPP) +$(LOCAL_HDIR)/Activator.h Activator.cpp: Activator.ice $(SLICE2CPP) rm -f Activator.h Activator.cpp $(SLICECMD) -I.. Activator.ice diff --git a/cpp/src/IcePack/icepackS.dsp b/cpp/src/IcePack/icepackS.dsp index eeea931c959..ca9d5d995af 100644 --- a/cpp/src/IcePack/icepackS.dsp +++ b/cpp/src/IcePack/icepackS.dsp @@ -107,11 +107,11 @@ SOURCE=.\AdminI.cpp # End Source File
# Begin Source File
-SOURCE=.\LocatorAdminI.cpp
+SOURCE=.\LocatorI.cpp
# End Source File
# Begin Source File
-SOURCE=.\LocatorI.cpp
+SOURCE=.\LocatorRegistryI.cpp
# End Source File
# Begin Source File
@@ -135,10 +135,6 @@ SOURCE=.\Activator.h # End Source File
# Begin Source File
-SOURCE=.\ActivatorI.h
-# End Source File
-# Begin Source File
-
SOURCE=.\AdapterManager.h
# End Source File
# Begin Source File
@@ -155,11 +151,11 @@ SOURCE=.\AdminI.h # End Source File
# Begin Source File
-SOURCE=.\LocatorAdminI.h
+SOURCE=.\LocatorI.h
# End Source File
# Begin Source File
-SOURCE=.\LocatorI.h
+SOURCE=.\LocatorRegistryI.h
# End Source File
# Begin Source File
|