diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 23 | ||||
-rw-r--r-- | cpp/src/IceGrid/IceGridNode.cpp | 79 | ||||
-rw-r--r-- | cpp/src/IceGrid/ObserverSessionI.cpp | 1 | ||||
-rw-r--r-- | cpp/src/IceGrid/ServerI.cpp | 1 |
6 files changed, 94 insertions, 15 deletions
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index e9bfeb811e3..606dfb730ee 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Tue Jun 14 10:24:30 2005 +// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Jun 20 17:04:26 2005 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -155,6 +155,7 @@ const char* IceInternal::PropertyNames::IcePackProps[] = const char* IceInternal::PropertyNames::IceGridProps[] = { "IceGrid.Node.AdapterId", + "IceGrid.Node.RegisterProcess", "IceGrid.Node.CollocateRegistry", "IceGrid.Node.Data", "IceGrid.Node.Endpoints", diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 0ca294e8e73..79cdfab575b 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Tue Jun 14 10:24:30 2005 +// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Jun 20 17:04:26 2005 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index 14525b4fcd2..d9ba7fd861e 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -757,14 +757,27 @@ ServerInstanceDescriptor ApplicationDescriptorHelper::instantiate(const ServerInstanceDescriptor& inst) { ServerInstanceDescriptor instance = inst; + pushNodeVariables(inst.node); if(instance._cpp_template.empty()) { - assert(instance.descriptor); - return instance; + // + // We can't re-instantiate here -- this would break escaped variables. + // +// assert(instance.descriptor); +// set<string> missing; +// instance.descriptor = ServerDescriptorHelper(*this, instance.descriptor).instantiate(missing); +// if(!missing.empty()) +// { +// ostringstream os; +// os << "server undefined variables: "; +// copy(missing.begin(), missing.end(), ostream_iterator<string>(os, " ")); +// throw os.str(); +// } + } + else + { + instance.descriptor = _templates->instantiateServer(*this, instance._cpp_template, instance.parameterValues); } - - pushNodeVariables(inst.node); - instance.descriptor = _templates->instantiateServer(*this, instance._cpp_template, instance.parameterValues); _variables->pop(); return instance; } diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index 805a05c28a6..883d116627a 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -9,6 +9,7 @@ #include <IceUtil/UUID.h> #include <Ice/Ice.h> +#include <Ice/Locator.h> #include <Ice/Service.h> #include <IceGrid/Activator.h> #include <IceGrid/WaitQueue.h> @@ -81,6 +82,21 @@ private: }; typedef IceUtil::Handle<KeepAliveThread> KeepAliveThreadPtr; +class ProcessI : public Process +{ +public: + + ProcessI(const ActivatorPtr&); + + virtual void shutdown(const Current&); + virtual void writeMessage(const std::string&, Int, const Current&); + +private: + + ActivatorPtr _activator; +}; + + class NodeService : public Service { public: @@ -162,6 +178,34 @@ CollocatedRegistry::shutdown() _activator->shutdown(); } +ProcessI::ProcessI(const ActivatorPtr& activator) : _activator(activator) +{ +} + +void +ProcessI::shutdown(const Current&) +{ + _activator->shutdown(); +} + +void +ProcessI::writeMessage(const string& message, Int fd, const Current&) +{ + switch(fd) + { + case 1: + { + cout << message << endl; + break; + } + case 2: + { + cerr << message << endl; + break; + } + } +} + NodeService::NodeService() { } @@ -314,7 +358,8 @@ NodeService::start(int argc, char* argv[]) if(::_stat(dataPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode)) { ostringstream os; - SyscallException ex(__FILE__, __LINE__); + FileException ex(__FILE__, __LINE__); + ex.path = dataPath; ex.error = getSystemErrno(); os << ex; error("property `IceGrid.Node.Data' is set to an invalid path:\n" + os.str()); @@ -325,7 +370,8 @@ NodeService::start(int argc, char* argv[]) if(::stat(dataPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode)) { ostringstream os; - SyscallException ex(__FILE__, __LINE__); + FileException ex(__FILE__, __LINE__); + ex.path = dataPath; ex.error = getSystemErrno(); os << ex; error("property `IceGrid.Node.Data' is set to an invalid path:\n" + os.str()); @@ -390,6 +436,8 @@ NodeService::start(int argc, char* argv[]) // // Create the node object adapter. // + properties->setProperty("IceGrid.Node.RegisterProcess", "0"); + properties->setProperty("IceGrid.Node.AdapterId", ""); ObjectAdapterPtr adapter = communicator()->createObjectAdapter("IceGrid.Node"); // @@ -416,19 +464,34 @@ NodeService::start(int argc, char* argv[]) _keepAliveThread->start(); // + // Add a process servant to allow shutdown through the process + // interface if a server id is set on the node. + // + if(!properties->getProperty("Ice.ServerId").empty() && communicator()->getDefaultLocator()) + { + try + { + ProcessPrx proxy = ProcessPrx::uncheckedCast(adapter->addWithUUID(new ProcessI(_activator))); + LocatorRegistryPrx locatorRegistry = communicator()->getDefaultLocator()->getRegistry(); + locatorRegistry->setServerProcessProxy(properties->getProperty("Ice.ServerId"), proxy); + } + catch(const Ice::ServerNotFoundException&) + { + } + catch(const Ice::LocalException& ex) + { + } + } + + // // Start the activator. // _activator->start(); // - // We are ready to go! Activate the object adapter. NOTE: we don't want the activate call to - // set the direct proxy of the object adapter with the locator registry. This was already - // taken care of by the node registry. Furthermore, this wouldn't work anyway because the - // locator registry proxy would have collocation optimization enabled. + // Activate the adapter. // - adapter->setLocator(0); adapter->activate(); - adapter->setLocator(communicator()->getDefaultLocator()); // // Deploy application if a descriptor is passed as a command-line option. diff --git a/cpp/src/IceGrid/ObserverSessionI.cpp b/cpp/src/IceGrid/ObserverSessionI.cpp index f2c4e8760a2..5803eb008e0 100644 --- a/cpp/src/IceGrid/ObserverSessionI.cpp +++ b/cpp/src/IceGrid/ObserverSessionI.cpp @@ -19,6 +19,7 @@ ObserverSessionI::ObserverSessionI(const string& userId, RegistryObserverTopic& registryObserverTopic, NodeObserverTopic& nodeObserverTopic) : _userId(userId), + _updating(false), _destroyed(false), _database(database), _registryObserverTopic(registryObserverTopic), diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index b7b6ca15e3c..d4cb62ab9bf 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -785,6 +785,7 @@ ServerI::addAdapter(const AdapterDescriptor& descriptor, const ServerPrx& self, current.adapter->add(new ServerAdapterI(_node, self, descriptor.id, _waitTime), id); } _adapters[descriptor.id] = AdapterPrx::uncheckedCast(current.adapter->createProxy(id)); + _processRegistered |= descriptor.registerProcess; } void |