diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 77 | ||||
-rw-r--r-- | cpp/include/Ice/Application.h | 9 | ||||
-rw-r--r-- | cpp/src/Ice/Application.cpp | 71 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 359 |
4 files changed, 300 insertions, 216 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 739f1fed8d1..dce758af820 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,56 +1,61 @@ Changes since version 1.1.0 --------------------------- -- ObjectAdapter::removeServantLocator() no longer exists. - The life cycle of servant locators that are registered - with an object adapter ends when the adapter is destroyed. +- Added destroyOnInterrupt() to the Application + class. destroyOnInterrupt() is now the default behavior, because + shutdownOnInterrupt() only shuts down the server side of an + application, and therefore doesn't work with pure clients. -- Changed Ice::ServantLocator::deactivate to be passed the category for - which a servant locator is being deactivated. +- ObjectAdapter::removeServantLocator() no longer exists. The life + cycle of servant locators that are registered with an object adapter + ends when the adapter is destroyed. -- Added --noindex option to slice2docbook to suppress generation of index - pages for pdf version of documentation. +- Changed Ice::ServantLocator::deactivate to be passed the category + for which a servant locator is being deactivated. -- Changed the behavior of Freeze::Map::insert to match the insert behavior - on associative containers in the C++ standard: if the element is already - there, it is not updated. - Added Freeze::Map::put function, to insert or replace an element, like - the old insert. This corresponds to the behavior of Berkeley DB's - DB->put(). +- Added --noindex option to slice2docbook to suppress generation of + index pages for pdf version of documentation. + +- Changed the behavior of Freeze::Map::insert to match the insert + behavior on associative containers in the C++ standard: if the + element is already there, it is not updated. Added Freeze::Map::put + function, to insert or replace an element, like the old insert. This + corresponds to the behavior of Berkeley DB's DB->put(). - Added saveObject() operation on Evictor, and savedObject() operation - on PersistenceStrategy. - saveObject() saves a persistent object immediately. Once an operation - has called saveObject(), the object is considered "clean": other updates - by the same operation can only be reliably saved by another call to - saveObject(). - -- Added a test to the Slice parser to complain if an operation on a local - interface or class has an exception specification. - -- Added a test to the property parsing code to print a warning on stderr - if a property is not recognized. This prevents silly typos, such as - "Ice.config=MyFile" (instead of "Ice.Config=MyFile") from slipping through - undetected. - -- Changed the mapping of the Slice byte type: ::Ice::Byte is now a typedef - for unsigned char. (Previously, ::Ice::Byte was a typedef to char.) This - change guarantees that byte values are always in the range 0..255 (instead - of either -128..127 or 0..255, depending on the CPU architecture). This - change also permits function overloading for ::Ice::Byte and char (which - can be useful if you use both strings and byte sequences). + on PersistenceStrategy. saveObject() saves a persistent object + immediately. Once an operation has called saveObject(), the object + is considered "clean": other updates by the same operation can only + be reliably saved by another call to saveObject(). + +- Added a test to the Slice parser to complain if an operation on a + local interface or class has an exception specification. + +- Added a test to the property parsing code to print a warning on + stderr if a property is not recognized. This prevents silly typos, + such as "Ice.config=MyFile" (instead of "Ice.Config=MyFile") from + slipping through undetected. + +- Changed the mapping of the Slice byte type: ::Ice::Byte is now a + typedef for unsigned char. (Previously, ::Ice::Byte was a typedef to + char.) This change guarantees that byte values are always in the + range 0..255 (instead of either -128..127 or 0..255, depending on + the CPU architecture). This change also permits function overloading + for ::Ice::Byte and char (which can be useful if you use both + strings and byte sequences). - Portability fix in src/IceSSL/OpenSSLPluginI.cpp. - config/Make.rules now checks that mkshlib is defined. -- src/IceUtil/CtrlCHandler.cpp now handles (ignores) EINTR returned by +- src/IceUtil/CtrlCHandler.cpp now handles (ignores) EINTR returned by sigwait. -- added DB_PRIVATE flag to DBEnv->open() on Linux, to be able to use +- Added DB_PRIVATE flag to DBEnv->open() on Linux, to be able to use the Berkeley DB that ships with RedHat 9. -- Changed the python code for printing output from test clients, so that you get each line as it comes. +- Changed the python code for printing output from test clients, so + that you get each line as it comes. Changes since version 1.0.1 --------------------------- diff --git a/cpp/include/Ice/Application.h b/cpp/include/Ice/Application.h index f3524a93f82..d8ab0b60237 100644 --- a/cpp/include/Ice/Application.h +++ b/cpp/include/Ice/Application.h @@ -54,11 +54,9 @@ public: static CommunicatorPtr communicator(); // - // These methods can be used to set a Ctrl+C Handler callback - // that calls communicator()->shutdown() upon interrupt (to - // make communicator()->waitForShutdown() return) or to ignore - // interrupts. + // These methods can be used to set a Ctrl+C Handler callback. // + static void destroyOnInterrupt(); static void shutdownOnInterrupt(); static void ignoreInterrupt(); @@ -68,7 +66,8 @@ public: // is received after holdInterrupt() was called is remember and // delivered when releaseInterupt() is called. That signal is then // handled according to the signal disposition established with - // shutdownOnInterrupt() or ignoreInterrupt(). + // destroyOnInterrupt(), shutdownOnInterrupt() or + // ignoreInterrupt(). // static void holdInterrupt(); static void releaseInterrupt(); diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp index b0d0268ceb8..455e7c2bb0d 100644 --- a/cpp/src/Ice/Application.cpp +++ b/cpp/src/Ice/Application.cpp @@ -63,6 +63,50 @@ static void holdInterruptCallback(int signal) } } +static void destroyOnInterruptCallback(int signal) +{ + if(_nohup && signal == SIGHUP) + { + return; + } + + { + StaticMutex::Lock lock(_mutex); + _interrupted = true; + } + + try + { + _communicator->destroy(); + } + catch(const IceUtil::Exception& ex) + { + cerr << _appName << " (while destroying in response to signal " << signal + << "): " << ex << endl; + } + catch(const std::exception& ex) + { + cerr << _appName << " (while destroying in response to signal " << signal + << "): std::exception: " << ex.what() << endl; + } + catch(const std::string& msg) + { + cerr << _appName << " (while destroying in response to signal " << signal + << "): " << msg << endl; + } + catch(const char * msg) + { + cerr << _appName << " (while destroying in response to signal " << signal + << "): " << msg << endl; + } + catch(...) + { + cerr << _appName << " (while destroying in response to signal " << signal + << "): unknown exception" << endl; + } +} + + static void shutdownOnInterruptCallback(int signal) { if(_nohup && signal == SIGHUP) @@ -151,13 +195,15 @@ Ice::Application::main(int argc, char* argv[], const char* configFile) _communicator = initialize(argc, argv); } - // Used by shutdownOnInterruptCallback + // + // Used by destroyOnInterruptCallback and shutdownOnInterruptCallback. // _nohup = (_communicator->getProperties()->getPropertyAsInt("Ice.Nohup") > 0); - // The default is to shutdown when a signal is received: // - shutdownOnInterrupt(); + // The default is to destroy when a signal is received. + // + destroyOnInterrupt(); status = run(argc, argv); } @@ -242,6 +288,25 @@ Ice::Application::communicator() } void +Ice::Application::destroyOnInterrupt() +{ + assert(_ctrlCHandler.get() != 0); + + StaticMutex::Lock lock(_mutex); + if(_ctrlCHandler->getCallback() == holdInterruptCallback) + { + _released = true; + _ctrlCHandler->setCallback(destroyOnInterruptCallback); + lock.release(); + _condVar->signal(); + } + else + { + _ctrlCHandler->setCallback(destroyOnInterruptCallback); + } +} + +void Ice::Application::shutdownOnInterrupt() { assert(_ctrlCHandler.get() != 0); diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 3467f46c33d..f89dccea13b 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -100,183 +100,198 @@ Ice::PropertiesI::getPropertiesForPrefix(const string& prefix) // Examples: "Ice.Foo.*" allows all properties with that prefix, such as "Ice.Foo.Bar". // "Ice.Foo*" allows properties such as "Ice.Foo.Bar" and "Ice.FooBar". // -static const string iceProps[] = { - "ChangeUser", - "Config", - "ConnectionIdleTime", - "Daemon", - "DaemonNoChdir", - "DaemonNoClose", - "Default.Host", - "Default.Locator", - "Default.Protocol", - "Default.Router", - "Logger.Timestamp", - "MonitorConnections", - "Nohup", - "NullHandleAbort", - "Override.Compress", - "Override.Timeout", - "Plugin.*", - "PrintAdapterReady", - "PrintProcessId", - "ProgramName", - "RetryIntervals", - "ServerIdleTime", - "ThreadPool.Client.Size", - "ThreadPool.Client.SizeMax", - "ThreadPool.Client.SizeWarn", - "ThreadPool.Server.Size", - "Trace.Network", - "Trace.Protocol", - "Trace.Retry", - "UseSyslog", - "Warn.AMICallback", - "Warn.Connections", - "Warn.Dispatch", - "Warn.Leaks" - }; - -static const string iceBoxProps[] = { - "DBEnvName.*", - "PrintServicesReady", - "Service.*", - "ServiceManager.AdapterId", - "ServiceManager.Endpoints", - "ServiceManager.Identity", - "UseSharedCommunicator.*" - }; - -static const string icePackProps[] = { - "Node.AdapterId", - "Node.CollocateRegistry", - "Node.Data", - "Node.Endpoints", - "Node.Name", - "Node.PrintServersReady", - "Node.PropertiesOverride", - "Node.ThreadPool.Size", - "Node.Trace.Activator", - "Node.Trace.Adapter", - "Node.Trace.Server", - "Node.WaitTime", - "Registry.Admin.AdapterId", - "Registry.Admin.Endpoints", - "Registry.Client.Endpoints", - "Registry.Data", - "Registry.DynamicRegistration", - "Registry.Internal.AdapterId", - "Registry.Internal.Endpoints", - "Registry.Server.Endpoints", - "Registry.Trace.AdapterRegistry", - "Registry.Trace.NodeRegistry", - "Registry.Trace.ObjectRegistry", - "Registry.Trace.ServerRegistry" - }; - -static const string icePatchProps[] = { - "BusyTimeout", - "RemoveOrphaned", - "Thorough", - "Trace.Files", - "UpdatePeriod" - }; - -static const string iceSSLProps[] = { - "Client.CertificateVerifier", - "Client.CertPath*", - "Client.Config", - "Client.Handshake.Retries", - "Client.Overrides.CACertificate", - "Client.Overrides.DSA.Certificate", - "Client.Overrides.DSA.PrivateKey", - "Client.Overrides.RSA.Certificate", - "Client.Overrides.RSA.PrivateKey", - "Client.Passphrase.Retries", - "Server.CertificateVerifier", - "Server.CertPath*", - "Server.Config", - "Server.Overrides.CACertificate", - "Server.Overrides.DSA.Certificate", - "Server.Overrides.DSA.PrivateKey", - "Server.Overrides.RSA.Certificate", - "Server.Overrides.RSA.PrivateKey", - "Server.Passphrase.Retries", - "Trace.Security" - }; - -static const string iceStormProps[] = { - "Flush.Timeout", - "Publish.Endpoints", - "TopicManager.Endpoints", - "TopicManager.Proxy", - "Trace.Flush", - "Trace.Subscriber", - "Trace.Topic", - "Trace.TopicManager" - }; - -static const string glacierProps[] = { - "Router.AcceptCert", - "Router.AllowCategories", - "Router.Client.BatchSleepTime", - "Router.Client.Endpoints", - "Router.Client.ForwardContext", - "Router.Endpoints", - "Router.Identity", - "Router.PrintProxyOnFd", - "Router.Server.BatchSleepTime", - "Router.Server.Endpoints", - "Router.Server.ForwardContext", - "Router.SessionManager", - "Router.Trace.Client", - "Router.Trace.RoutingTable", - "Router.Trace.Server", - "Router.UserId", - "Starter.AddUserToAllowCategories", - "Starter.Certificate.BitStrength", - "Starter.Certificate.CommonName", - "Starter.Certificate.Country", - "Starter.Certificate.IssuedAdjust", - "Starter.Certificate.Locality", - "Starter.Certificate.Organization", - "Starter.Certificate.OrganizationalUnit", - "Starter.Certificate.SecondsValid", - "Starter.Certificate.StateProvince", - "Starter.CryptPasswords", - "Starter.Endpoints", - "Starter.PasswordVerifier", - "Starter.PropertiesOverride", - "Starter.RouterPath", - "Starter.StartupTimeout", - "Starter.Trace" - }; - -static const string freezeProps[] = { - "Trace.DB", - "Trace.Evictor" - }; - -struct PropertyValues { +static const string iceProps[] = +{ + "ChangeUser", + "Config", + "ConnectionIdleTime", + "Daemon", + "DaemonNoChdir", + "DaemonNoClose", + "Default.Host", + "Default.Locator", + "Default.Protocol", + "Default.Router", + "Logger.Timestamp", + "MonitorConnections", + "Nohup", + "NullHandleAbort", + "Override.Compress", + "Override.Timeout", + "Plugin.*", + "PrintAdapterReady", + "PrintProcessId", + "ProgramName", + "RetryIntervals", + "ServerIdleTime", + "ThreadPool.Client.Size", + "ThreadPool.Client.SizeMax", + "ThreadPool.Client.SizeWarn", + "ThreadPool.Server.Size", + "Trace.Network", + "Trace.Protocol", + "Trace.Retry", + "UseSyslog", + "Warn.AMICallback", + "Warn.Connections", + "Warn.Dispatch", + "Warn.Leaks" +}; + +static const string iceBoxProps[] = +{ + "DBEnvName.*", + "PrintServicesReady", + "Service.*", + "ServiceManager.AdapterId", + "ServiceManager.Endpoints", + "ServiceManager.Identity", + "UseSharedCommunicator.*" +}; + +static const string icePackProps[] = +{ + "Node.AdapterId", + "Node.CollocateRegistry", + "Node.Data", + "Node.Endpoints", + "Node.Name", + "Node.PrintServersReady", + "Node.PropertiesOverride", + "Node.ThreadPool.Size", + "Node.Trace.Activator", + "Node.Trace.Adapter", + "Node.Trace.Server", + "Node.WaitTime", + "Registry.Admin.AdapterId", + "Registry.Admin.Endpoints", + "Registry.Client.Endpoints", + "Registry.Data", + "Registry.DynamicRegistration", + "Registry.Internal.AdapterId", + "Registry.Internal.Endpoints", + "Registry.Server.Endpoints", + "Registry.Trace.AdapterRegistry", + "Registry.Trace.NodeRegistry", + "Registry.Trace.ObjectRegistry", + "Registry.Trace.ServerRegistry" +}; + +static const string icePatchProps[] = +{ + "Endpoints", + "BusyTimeout", + "RemoveOrphaned", + "Thorough", + "Trace.Files", + "UpdatePeriod" +}; + +static const string iceSSLProps[] = +{ + "Client.CertificateVerifier", + "Client.CertPath*", + "Client.Config", + "Client.Handshake.Retries", + "Client.Overrides.CACertificate", + "Client.Overrides.DSA.Certificate", + "Client.Overrides.DSA.PrivateKey", + "Client.Overrides.RSA.Certificate", + "Client.Overrides.RSA.PrivateKey", + "Client.Passphrase.Retries", + "Server.CertificateVerifier", + "Server.CertPath*", + "Server.Config", + "Server.Overrides.CACertificate", + "Server.Overrides.DSA.Certificate", + "Server.Overrides.DSA.PrivateKey", + "Server.Overrides.RSA.Certificate", + "Server.Overrides.RSA.PrivateKey", + "Server.Passphrase.Retries", + "Trace.Security" +}; + +static const string iceStormProps[] = +{ + "Flush.Timeout", + "Publish.Endpoints", + "TopicManager.Endpoints", + "TopicManager.Proxy", + "Trace.Flush", + "Trace.Subscriber", + "Trace.Topic", + "Trace.TopicManager" +}; + +static const string glacierProps[] = +{ + "Router.AcceptCert", + "Router.AllowCategories", + "Router.Client.BatchSleepTime", + "Router.Client.Endpoints", + "Router.Client.ForwardContext", + "Router.Endpoints", + "Router.Identity", + "Router.PrintProxyOnFd", + "Router.Server.BatchSleepTime", + "Router.Server.Endpoints", + "Router.Server.ForwardContext", + "Router.SessionManager", + "Router.Trace.Client", + "Router.Trace.RoutingTable", + "Router.Trace.Server", + "Router.UserId", + "Starter.AddUserToAllowCategories", + "Starter.Certificate.BitStrength", + "Starter.Certificate.CommonName", + "Starter.Certificate.Country", + "Starter.Certificate.IssuedAdjust", + "Starter.Certificate.Locality", + "Starter.Certificate.Organization", + "Starter.Certificate.OrganizationalUnit", + "Starter.Certificate.SecondsValid", + "Starter.Certificate.StateProvince", + "Starter.CryptPasswords", + "Starter.Endpoints", + "Starter.PasswordVerifier", + "Starter.PropertiesOverride", + "Starter.RouterPath", + "Starter.StartupTimeout", + "Starter.Trace" +}; + +static const string freezeProps[] = +{ + "Trace.DB", + "Trace.Evictor" +}; + +struct PropertyValues +{ string prefix; const string* props; size_t propsSize; - PropertyValues(string pf, const string* p, size_t s) : prefix(pf), props(p), propsSize(s) {} + + PropertyValues(string pf, const string* p, size_t s) : + prefix(pf), props(p), propsSize(s) + { + } }; // // Array of valid properties for each application. // -static const PropertyValues validProps[] = { - PropertyValues("Freeze", freezeProps, sizeof(freezeProps) / sizeof(freezeProps[0])), - PropertyValues("Glacier", glacierProps, sizeof(glacierProps) / sizeof(glacierProps[0])), - PropertyValues("IceBox", iceBoxProps, sizeof(iceBoxProps) / sizeof(iceBoxProps[0])), - PropertyValues("Ice", iceProps, sizeof(iceProps) / sizeof(iceProps[0])), - PropertyValues("IcePack", icePackProps, sizeof(icePackProps) / sizeof(icePackProps[0])), - PropertyValues("IcePatch", icePatchProps, sizeof(icePatchProps) / sizeof(icePatchProps[0])), - PropertyValues("IceSSL", iceSSLProps, sizeof(iceSSLProps) / sizeof(iceSSLProps[0])), - PropertyValues("IceStorm", iceStormProps, sizeof(iceStormProps) / sizeof(iceStormProps[0])) - }; +static const PropertyValues validProps[] = +{ + PropertyValues("Freeze", freezeProps, sizeof(freezeProps) / sizeof(freezeProps[0])), + PropertyValues("Glacier", glacierProps, sizeof(glacierProps) / sizeof(glacierProps[0])), + PropertyValues("IceBox", iceBoxProps, sizeof(iceBoxProps) / sizeof(iceBoxProps[0])), + PropertyValues("Ice", iceProps, sizeof(iceProps) / sizeof(iceProps[0])), + PropertyValues("IcePack", icePackProps, sizeof(icePackProps) / sizeof(icePackProps[0])), + PropertyValues("IcePatch", icePatchProps, sizeof(icePatchProps) / sizeof(icePatchProps[0])), + PropertyValues("IceSSL", iceSSLProps, sizeof(iceSSLProps) / sizeof(iceSSLProps[0])), + PropertyValues("IceStorm", iceStormProps, sizeof(iceStormProps) / sizeof(iceStormProps[0])) +}; static const size_t validPropsSize = sizeof(validProps) / sizeof(validProps[0]); @@ -284,9 +299,9 @@ void Ice::PropertiesI::setProperty(const string& key, const string& value) { // - // Check if the property is legal. (We write to cerr instead of using - // a logger because no logger may be established at the time the property - // is parsed.) + // Check if the property is legal. (We write to cerr instead of + // using a logger because no logger may be established at the time + // the property is parsed.) // string::size_type dotPos = key.find('.'); if(dotPos != string::npos) |