summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Instance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/Instance.cpp')
-rw-r--r--cpp/src/Ice/Instance.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 8a1e5f45405..34133c7d42d 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2009 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.
@@ -29,6 +29,7 @@
#include <Ice/LoggerI.h>
#include <Ice/Network.h>
#include <Ice/EndpointFactoryManager.h>
+#include <Ice/RetryQueue.h>
#include <Ice/TcpEndpointI.h>
#include <Ice/UdpEndpointI.h>
#include <Ice/DynamicLibrary.h>
@@ -285,6 +286,19 @@ IceInternal::Instance::endpointHostResolver()
return _endpointHostResolver;
}
+RetryQueuePtr
+IceInternal::Instance::retryQueue()
+{
+ IceUtil::RecMutex::Lock sync(*this);
+
+ if(_state == StateDestroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ return _retryQueue;
+}
+
IceUtil::TimerPtr
IceInternal::Instance::timer()
{
@@ -743,7 +757,7 @@ void
IceInternal::Instance::setStringConverter(const Ice::StringConverterPtr& stringConverter)
{
//
- // No locking, as it can only be called during plugin loading
+ // No locking, as it can only be called during plug-in loading
//
_initData.stringConverter = stringConverter;
}
@@ -752,7 +766,7 @@ void
IceInternal::Instance::setWstringConverter(const Ice::WstringConverterPtr& wstringConverter)
{
//
- // No locking, as it can only be called during plugin loading
+ // No locking, as it can only be called during plug-in loading
//
_initData.wstringConverter = wstringConverter;
}
@@ -761,7 +775,7 @@ void
IceInternal::Instance::setLogger(const Ice::LoggerPtr& logger)
{
//
- // No locking, as it can only be called during plugin loading
+ // No locking, as it can only be called during plug-in loading
//
_initData.logger = logger;
}
@@ -952,7 +966,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_routerManager = new RouterManager;
- _locatorManager = new LocatorManager;
+ _locatorManager = new LocatorManager(_initData.properties);
_referenceFactory = new ReferenceFactory(this, communicator);
@@ -991,6 +1005,8 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_servantFactoryManager = new ObjectFactoryManager();
_objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
+
+ _retryQueue = new RetryQueue(this);
if(_initData.wstringConverter == 0)
{
@@ -1039,6 +1055,7 @@ IceInternal::Instance::~Instance()
assert(!_serverThreadPool);
assert(!_selectorThread);
assert(!_endpointHostResolver);
+ assert(!_retryQueue);
assert(!_timer);
assert(!_routerManager);
assert(!_locatorManager);
@@ -1129,7 +1146,9 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
}
//
- // Start connection monitor if necessary.
+ // Start connection monitor if necessary. Set the check interval to
+ // 1/10 of the ACM timeout with a minmal value of 1 second and a
+ // maximum value of 5 minutes.
//
Int interval = 0;
if(_clientACM > 0 && _serverACM > 0)
@@ -1144,6 +1163,10 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
{
interval = _serverACM;
}
+ if(interval > 0)
+ {
+ interval = min(300, max(1, (int)interval / 10));
+ }
interval = _initData.properties->getPropertyAsIntWithDefault("Ice.MonitorConnections", interval);
if(interval > 0)
{
@@ -1200,6 +1223,11 @@ IceInternal::Instance::destroy()
_outgoingConnectionFactory->waitUntilFinished();
}
+ if(_retryQueue)
+ {
+ _retryQueue->destroy();
+ }
+
ThreadPoolPtr serverThreadPool;
ThreadPoolPtr clientThreadPool;
SelectorThreadPtr selectorThread;
@@ -1210,6 +1238,7 @@ IceInternal::Instance::destroy()
_objectAdapterFactory = 0;
_outgoingConnectionFactory = 0;
+ _retryQueue = 0;
if(_connectionMonitor)
{