summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES7
-rw-r--r--cpp/include/Ice/FactoryTableDef.h4
-rw-r--r--cpp/include/Ice/UserExceptionFactory.h4
-rw-r--r--cpp/src/Ice/Connection.cpp50
-rw-r--r--cpp/src/Ice/Connection.h2
-rw-r--r--cpp/src/Ice/Instance.cpp7
-rw-r--r--cpp/src/Ice/ThreadPool.h2
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp21
-rw-r--r--cpp/src/Ice/UdpTransceiver.h2
9 files changed, 39 insertions, 60 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index deccd1b8825..b046a9dde2c 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,11 +1,14 @@
Changes since version 1.1.1
---------------------------
+- Bi-directional connections are now handled by the client-side thread
+ pool instead of the server-side thread pool.
+
- Fixed a bug in the generated code that caused "at-most-once"
semantics to be ignored for collocated invocations.
-- Removed all Ice dependencies on Xerces. Added a simple C++
- wrapper around the expat XML parser as IceXML/Parser.h.
+- Removed all Ice dependencies on Xerces. Added a simple C++ wrapper
+ around the expat XML parser as IceXML/Parser.h.
- Implemented TwowayOnlyException. That exception is raised if an
attempt is made to invoke an operation that has a return value,
diff --git a/cpp/include/Ice/FactoryTableDef.h b/cpp/include/Ice/FactoryTableDef.h
index 65a7aba2a49..776e985cacf 100644
--- a/cpp/include/Ice/FactoryTableDef.h
+++ b/cpp/include/Ice/FactoryTableDef.h
@@ -12,8 +12,8 @@
//
// **********************************************************************
-#ifndef ICE_FACTORYTABLEDEF_H
-#define ICE_FACTORYTABLEDEF_H
+#ifndef ICE_FACTORY_TABLE_DEF_H
+#define ICE_FACTORY_TABLE_DEF_H
#include <IceUtil/StaticMutex.h>
#include <IceUtil/Mutex.h>
diff --git a/cpp/include/Ice/UserExceptionFactory.h b/cpp/include/Ice/UserExceptionFactory.h
index 9d2f2f53ed7..aac8894c03b 100644
--- a/cpp/include/Ice/UserExceptionFactory.h
+++ b/cpp/include/Ice/UserExceptionFactory.h
@@ -12,8 +12,8 @@
//
// **********************************************************************
-#ifndef ICE_USEREXCEPTIONFACTORY_H
-#define ICE_USEREXCEPTIONFACTORY_H
+#ifndef ICE_USER_EXCEPTION_FACTORY_H
+#define ICE_USER_EXCEPTION_FACTORY_H
#include <IceUtil/Shared.h>
#include <IceUtil/Handle.h>
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index d23fa6ce8f7..9c1a28ff1da 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -890,28 +890,9 @@ IceInternal::Connection::setAdapter(const ObjectAdapterPtr& adapter)
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
//
- // We are registered with a thread pool in active and closing
- // mode. However, we only change subscription if we're in active
- // mode, and thus ignore closing mode here.
+ // We never change the thread pool with which we were initially
+ // registered, even if we add or remove an object adapter.
//
- if(_state == StateActive)
- {
- if(adapter && !_adapter)
- {
- //
- // Client is now server.
- //
- unregisterWithPool();
- }
-
- if(!adapter && _adapter)
- {
- //
- // Server is now client.
- //
- unregisterWithPool();
- }
- }
_adapter = adapter;
if(_adapter)
@@ -1299,6 +1280,7 @@ IceInternal::Connection::finished(const ThreadPoolPtr& threadPool)
{
_transceiver->close();
_transceiver = 0;
+ _threadPool = 0; // We don't need the thread pool anymore.
notifyAll();
}
}
@@ -1363,10 +1345,12 @@ IceInternal::Connection::Connection(const InstancePtr& instance,
{
if(_adapter)
{
+ _threadPool = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool();
_servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager();
}
else
{
+ _threadPool = _instance->clientThreadPool();
_servantManager = 0;
}
@@ -1405,8 +1389,6 @@ IceInternal::Connection::Connection(const InstancePtr& instance,
replyHdr[7] = encodingMinor;
replyHdr[8] = replyMsg;
replyHdr[9] = 1; // Default compression status: compression supported but not used.
-
- _warnUdp = _instance->properties()->getPropertyAsInt("Ice.Warn.Datagrams") > 0;
}
IceInternal::Connection::~Connection()
@@ -1606,15 +1588,8 @@ IceInternal::Connection::registerWithPool()
{
if(!_registeredWithPool)
{
- if(_adapter)
- {
- dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->_register(_transceiver->fd(), this);
- }
- else
- {
- _instance->clientThreadPool()->_register(_transceiver->fd(), this);
- }
-
+ assert(_threadPool);
+ _threadPool->_register(_transceiver->fd(), this);
_registeredWithPool = true;
ConnectionMonitorPtr connectionMonitor = _instance->connectionMonitor();
@@ -1630,15 +1605,8 @@ IceInternal::Connection::unregisterWithPool()
{
if(_registeredWithPool)
{
- if(_adapter)
- {
- dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->unregister(_transceiver->fd());
- }
- else
- {
- _instance->clientThreadPool()->unregister(_transceiver->fd());
- }
-
+ assert(_threadPool);
+ _threadPool->unregister(_transceiver->fd());
_registeredWithPool = false;
ConnectionMonitorPtr connectionMonitor = _instance->connectionMonitor();
diff --git a/cpp/src/Ice/Connection.h b/cpp/src/Ice/Connection.h
index 107d92a3f9a..72834bdcbb0 100644
--- a/cpp/src/Ice/Connection.h
+++ b/cpp/src/Ice/Connection.h
@@ -144,9 +144,9 @@ private:
const TraceLevelsPtr _traceLevels;
bool _registeredWithPool;
+ ThreadPoolPtr _threadPool;
bool _warn;
- bool _warnUdp;
int _acmTimeout;
IceUtil::Time _acmAbsoluteTimeout;
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 770e7aef0cf..306af207e6d 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -365,12 +365,19 @@ IceInternal::Instance::flushBatchRequests()
{
OutgoingConnectionFactoryPtr connectionFactory;
ObjectAdapterFactoryPtr adapterFactory;
+
{
IceUtil::RecMutex::Lock sync(*this);
+ if(_destroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
connectionFactory = _outgoingConnectionFactory;
adapterFactory = _objectAdapterFactory;
}
+
connectionFactory->flushBatchRequests();
adapterFactory->flushBatchRequests();
}
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h
index 3b22c508400..35b445b667b 100644
--- a/cpp/src/Ice/ThreadPool.h
+++ b/cpp/src/Ice/ThreadPool.h
@@ -100,7 +100,7 @@ private:
int _inUse; // Number of threads that are currently in use.
double _load; // Current load in number of threads.
- bool _warnUdp;
+ const bool _warnUdp;
IceUtil::Mutex _promoteMutex;
};
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 9e7af7bc5ad..6ee05d8d2b6 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -128,15 +128,15 @@ IceInternal::UdpTransceiver::read(Buffer& buf, int)
const int packetSize = min(_maxPacketSize, _rcvSize - _udpOverhead);
if(packetSize < static_cast<int>(buf.b.size()))
{
- //
- // We log a warning here because this is the server side -- without the
- // the warning, there would only be silence.
- //
- if(_warn)
- {
- Warning out(_logger);
- out << "DatagramLimitException: maximum size of " << packetSize << " exceeded";
- }
+ //
+ // We log a warning here because this is the server side -- without the
+ // the warning, there would only be silence.
+ //
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "DatagramLimitException: maximum size of " << packetSize << " exceeded";
+ }
throw Ice::DatagramLimitException(__FILE__, __LINE__);
}
buf.b.resize(packetSize);
@@ -261,7 +261,8 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
_traceLevels(instance->traceLevels()),
_logger(instance->logger()),
_incoming(false),
- _connect(true)
+ _connect(true),
+ _warn(instance->properties()->getPropertyAsInt("Ice.Warn.Datagrams") > 0)
{
try
{
diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h
index 852eed16990..e54b034d3bd 100644
--- a/cpp/src/Ice/UdpTransceiver.h
+++ b/cpp/src/Ice/UdpTransceiver.h
@@ -69,7 +69,7 @@ private:
bool _connect;
int _rcvSize;
int _sndSize;
- bool _warn;
+ const bool _warn;
static const int _udpOverhead;
static const int _maxPacketSize;
};