summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/include/Ice/ObserverHelper.h8
-rw-r--r--cpp/include/Ice/Outgoing.h19
-rw-r--r--cpp/include/Ice/OutgoingAsync.h10
-rw-r--r--cpp/src/Ice/CollocatedRequestHandler.cpp8
-rw-r--r--cpp/src/Ice/InstrumentationI.cpp38
-rw-r--r--cpp/src/Ice/InstrumentationI.h17
-rw-r--r--cpp/src/Ice/Outgoing.cpp18
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp26
-rw-r--r--cpp/test/Ice/metrics/AllTests.cpp738
-rw-r--r--cpp/test/Ice/metrics/Collocated.cpp81
-rw-r--r--cpp/test/Ice/metrics/InstrumentationI.h27
-rw-r--r--cpp/test/Ice/metrics/Makefile14
-rw-r--r--cpp/test/Ice/metrics/Makefile.mak14
-rwxr-xr-xcpp/test/Ice/metrics/run.py2
-rw-r--r--cpp/test/Ice/operations/Collocated.cpp4
-rw-r--r--cpp/test/Ice/retry/InstrumentationI.cpp4
-rw-r--r--cs/src/Ice/CollocatedRequestHandler.cs8
-rw-r--r--cs/src/Ice/InstrumentationI.cs48
-rw-r--r--cs/src/Ice/Outgoing.cs68
-rw-r--r--cs/src/Ice/OutgoingAsync.cs73
-rw-r--r--cs/test/Ice/metrics/AllTests.cs720
-rw-r--r--cs/test/Ice/metrics/Collocated.cs93
-rw-r--r--cs/test/Ice/metrics/InstrumentationI.cs27
-rw-r--r--cs/test/Ice/metrics/Makefile6
-rw-r--r--cs/test/Ice/metrics/Makefile.mak6
-rw-r--r--cs/test/Ice/metrics/collocated.exe.config6
-rwxr-xr-xcs/test/Ice/metrics/run.py2
-rw-r--r--cs/test/Ice/operations/Collocated.cs7
-rw-r--r--cs/test/Ice/retry/Instrumentation.cs4
-rw-r--r--java/resources/metrics.cfg37
-rw-r--r--java/src/Ice/AsyncResult.java17
-rw-r--r--java/src/IceInternal/BatchOutgoing.java31
-rw-r--r--java/src/IceInternal/BatchOutgoingAsync.java14
-rw-r--r--java/src/IceInternal/CollocatedObserverI.java32
-rw-r--r--java/src/IceInternal/CollocatedRequestHandler.java8
-rw-r--r--java/src/IceInternal/CommunicatorBatchOutgoingAsync.java20
-rw-r--r--java/src/IceInternal/CommunicatorObserverI.java2
-rw-r--r--java/src/IceInternal/InvocationObserverI.java32
-rw-r--r--java/src/IceInternal/Outgoing.java40
-rw-r--r--java/src/IceInternal/OutgoingAsync.java22
-rw-r--r--java/test/Ice/metrics/AllTests.java730
-rw-r--r--java/test/Ice/metrics/ChildInvocationObserverI.java29
-rw-r--r--java/test/Ice/metrics/Collocated.java68
-rw-r--r--java/test/Ice/metrics/CollocatedObserverI.java15
-rw-r--r--java/test/Ice/metrics/InvocationObserverI.java18
-rw-r--r--java/test/Ice/metrics/RemoveObserverI.java16
-rwxr-xr-xjava/test/Ice/metrics/run.py2
-rw-r--r--java/test/Ice/operations/Collocated.java7
-rw-r--r--java/test/Ice/retry/Instrumentation.java4
-rwxr-xr-xpy/demo/Ice/metrics/Metrics.py11
-rw-r--r--py/modules/IcePy/Communicator.cpp7
-rw-r--r--py/modules/IcePy/Proxy.cpp61
-rw-r--r--py/test/Ice/info/AllTests.py2
-rwxr-xr-xpy/test/Ice/info/Client.py2
-rw-r--r--py/test/Ice/location/AllTests.py29
-rw-r--r--py/test/Ice/objects/AllTests.py13
-rwxr-xr-xpy/test/Ice/objects/Client.py2
-rwxr-xr-xpy/test/Ice/objects/Collocated.py2
-rw-r--r--py/test/Ice/operations/AllTests.py55
-rw-r--r--py/test/Ice/operations/BatchOneways.py49
-rwxr-xr-xpy/test/Ice/operations/Client.py2
-rwxr-xr-xpy/test/Ice/operations/Collocated.py15
-rw-r--r--py/test/Ice/proxy/AllTests.py41
-rw-r--r--py/test/Ice/servantLocator/AllTests.py7
-rw-r--r--py/test/Ice/timeout/AllTests.py2
-rwxr-xr-xpy/test/Ice/timeout/Client.py2
-rw-r--r--slice/Ice/Instrumentation.ice37
-rw-r--r--slice/Ice/Metrics.ice42
68 files changed, 2231 insertions, 1390 deletions
diff --git a/cpp/include/Ice/ObserverHelper.h b/cpp/include/Ice/ObserverHelper.h
index b3436dae027..614226b8c09 100644
--- a/cpp/include/Ice/ObserverHelper.h
+++ b/cpp/include/Ice/ObserverHelper.h
@@ -138,7 +138,7 @@ public:
}
}
- ::Ice::Instrumentation::RemoteObserverPtr
+ ::Ice::Instrumentation::ChildInvocationObserverPtr
getRemoteObserver(const Ice::ConnectionInfoPtr& con, const Ice::EndpointPtr& endpt, int requestId, int size)
{
if(_observer)
@@ -148,12 +148,12 @@ public:
return 0;
}
- ::Ice::Instrumentation::RemoteObserverPtr
- getCollocatedObserver(int requestId, int size)
+ ::Ice::Instrumentation::ChildInvocationObserverPtr
+ getCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, int requestId, int size)
{
if(_observer)
{
- return _observer->getCollocatedObserver(requestId, size);
+ return _observer->getCollocatedObserver(adapter, requestId, size);
}
return 0;
}
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index 726b793d5d4..64c6a1d7f92 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -21,6 +21,7 @@
#include <Ice/BasicStream.h>
#include <Ice/Current.h>
#include <Ice/ObserverHelper.h>
+#include <Ice/ObjectAdapterF.h>
namespace Ice
{
@@ -119,12 +120,13 @@ public:
void attachRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& endpt,
Ice::Int requestId, Ice::Int size)
{
- _remoteObserver.attach(_observer.getRemoteObserver(c, endpt, requestId, size));
+ _childObserver.attach(_observer.getRemoteObserver(c, endpt, requestId, size));
}
- void attachCollocatedObserver(Ice::Int requestId)
+ void attachCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, Ice::Int requestId)
{
- _remoteObserver.attach(_observer.getCollocatedObserver(requestId,
+ _childObserver.attach(_observer.getCollocatedObserver(adapter,
+ requestId,
static_cast<Ice::Int>(_os.b.size() -
IceInternal::headerSize - 4)));
}
@@ -140,7 +142,7 @@ private:
RequestHandlerPtr _handler;
IceUtil::UniquePtr<Ice::Exception> _exception;
InvocationObserver _observer;
- ObserverHelperT<Ice::Instrumentation::RemoteObserver> _remoteObserver;
+ ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver;
enum
{
@@ -185,12 +187,13 @@ public:
void attachRemoteObserver(const Ice::ConnectionInfoPtr& connection, const Ice::EndpointPtr& endpt, Ice::Int sz)
{
- _remoteObserver.attach(_observer.getRemoteObserver(connection, endpt, 0, sz));
+ _childObserver.attach(_observer.getRemoteObserver(connection, endpt, 0, sz));
}
- void attachCollocatedObserver(Ice::Int requestId)
+ void attachCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, Ice::Int requestId)
{
- _remoteObserver.attach(_observer.getCollocatedObserver(requestId,
+ _childObserver.attach(_observer.getCollocatedObserver(adapter,
+ requestId,
static_cast<Ice::Int>(_os.b.size() -
IceInternal::headerSize - 4)));
}
@@ -206,7 +209,7 @@ private:
BasicStream _os;
InvocationObserver _observer;
- ObserverHelperT<Ice::Instrumentation::RemoteObserver> _remoteObserver;
+ ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver;
};
}
diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h
index ad42915fcf8..96b5d96bd2d 100644
--- a/cpp/include/Ice/OutgoingAsync.h
+++ b/cpp/include/Ice/OutgoingAsync.h
@@ -24,6 +24,7 @@
#include <Ice/Current.h>
#include <Ice/BasicStream.h>
#include <Ice/ObserverHelper.h>
+#include <Ice/ObjectAdapterF.h>
#ifdef ICE_CPP11
# include <functional> // for std::function
@@ -122,12 +123,13 @@ public:
void __attachRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& endpt,
Ice::Int requestId, Ice::Int sz)
{
- _remoteObserver.attach(_observer.getRemoteObserver(c, endpt, requestId, sz));
+ _childObserver.attach(_observer.getRemoteObserver(c, endpt, requestId, sz));
}
- void __attachCollocatedObserver(Ice::Int requestId)
+ void __attachCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, Ice::Int requestId)
{
- _remoteObserver.attach(_observer.getCollocatedObserver(requestId,
+ _childObserver.attach(_observer.getCollocatedObserver(adapter,
+ requestId,
static_cast<Ice::Int>(_os.b.size() -
IceInternal::headerSize - 4)));
}
@@ -175,7 +177,7 @@ protected:
bool _sentSynchronously;
IceUtil::UniquePtr<Exception> _exception;
IceInternal::InvocationObserver _observer;
- IceInternal::ObserverHelperT<Ice::Instrumentation::RemoteObserver> _remoteObserver;
+ IceInternal::ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver;
};
}
diff --git a/cpp/src/Ice/CollocatedRequestHandler.cpp b/cpp/src/Ice/CollocatedRequestHandler.cpp
index 6db9bae4daf..896062a4d42 100644
--- a/cpp/src/Ice/CollocatedRequestHandler.cpp
+++ b/cpp/src/Ice/CollocatedRequestHandler.cpp
@@ -358,7 +358,7 @@ CollocatedRequestHandler::invokeRequest(Outgoing* out)
}
}
- out->attachCollocatedObserver(requestId);
+ out->attachCollocatedObserver(_adapter, requestId);
if(_reference->getInvocationTimeout() > 0)
{
@@ -389,7 +389,7 @@ CollocatedRequestHandler::invokeAsyncRequest(OutgoingAsync* outAsync)
}
}
- outAsync->__attachCollocatedObserver(requestId);
+ outAsync->__attachCollocatedObserver(_adapter, requestId);
_adapter->getThreadPool()->execute(new InvokeAllAsync(outAsync, outAsync->__getOs(), this, requestId, 1, false));
return AsyncStatusQueued;
@@ -428,7 +428,7 @@ CollocatedRequestHandler::invokeBatchRequests(BatchOutgoing* out)
}
}
- out->attachCollocatedObserver(0);
+ out->attachCollocatedObserver(_adapter, 0);
if(invokeNum > 0)
{
@@ -480,7 +480,7 @@ CollocatedRequestHandler::invokeAsyncBatchRequests(BatchOutgoingAsync* outAsync)
}
}
- outAsync->__attachCollocatedObserver(0);
+ outAsync->__attachCollocatedObserver(_adapter, 0);
if(invokeNum > 0)
{
diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp
index 6ff70f8aafb..b0a06b1cf08 100644
--- a/cpp/src/Ice/InstrumentationI.cpp
+++ b/cpp/src/Ice/InstrumentationI.cpp
@@ -583,7 +583,7 @@ private:
RemoteInvocationHelper::Attributes RemoteInvocationHelper::attributes;
-class CollocatedInvocationHelper : public MetricsHelperT<RemoteMetrics>
+class CollocatedInvocationHelper : public MetricsHelperT<CollocatedMetrics>
{
public:
@@ -600,7 +600,8 @@ public:
};
static Attributes attributes;
- CollocatedInvocationHelper(int requestId, int size) : _requestId(requestId), _size(size)
+ CollocatedInvocationHelper(const Ice::ObjectAdapterPtr& adapter, int requestId, int size) :
+ _requestId(requestId), _size(size), _id(adapter->getName())
{
}
@@ -609,7 +610,7 @@ public:
return attributes(this, attribute);
}
- virtual void initMetrics(const RemoteMetricsPtr& v) const
+ virtual void initMetrics(const CollocatedMetricsPtr& v) const
{
v->size += _size;
}
@@ -617,12 +618,6 @@ public:
const string&
getId() const
{
- if(_id.empty())
- {
- ostringstream os;
- os << _requestId;
- _id = os.str();
- }
return _id;
}
@@ -824,6 +819,16 @@ RemoteObserverI::reply(Int size)
}
void
+CollocatedObserverI::reply(Int size)
+{
+ forEach(add(&CollocatedMetrics::replySize, size));
+ if(_delegate)
+ {
+ _delegate->reply(size);
+ }
+}
+
+void
InvocationObserverI::retried()
{
forEach(inc(&InvocationMetrics::retry));
@@ -866,19 +871,19 @@ InvocationObserverI::getRemoteObserver(const ConnectionInfoPtr& connection,
return 0;
}
-RemoteObserverPtr
-InvocationObserverI::getCollocatedObserver(int requestId, int size)
+CollocatedObserverPtr
+InvocationObserverI::getCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, int requestId, int size)
{
try
{
- RemoteObserverPtr delegate;
+ CollocatedObserverPtr delegate;
if(_delegate)
{
- delegate = _delegate->getCollocatedObserver(requestId, size);
+ delegate = _delegate->getCollocatedObserver(adapter, requestId, size);
}
- return getObserverWithDelegate<RemoteObserverI>("Collocated",
- CollocatedInvocationHelper(requestId, size),
- delegate);
+ return getObserverWithDelegate<CollocatedObserverI>("Collocated",
+ CollocatedInvocationHelper(adapter, requestId, size),
+ delegate);
}
catch(const exception&)
{
@@ -899,6 +904,7 @@ CommunicatorObserverI::CommunicatorObserverI(const IceInternal::MetricsAdminIPtr
_endpointLookups(metrics, "EndpointLookup")
{
_invocations.registerSubMap<RemoteMetrics>("Remote", &InvocationMetrics::remotes);
+ _invocations.registerSubMap<CollocatedMetrics>("Collocated", &InvocationMetrics::collocated);
}
void
diff --git a/cpp/src/Ice/InstrumentationI.h b/cpp/src/Ice/InstrumentationI.h
index cdc31e8106c..db515999f23 100644
--- a/cpp/src/Ice/InstrumentationI.h
+++ b/cpp/src/Ice/InstrumentationI.h
@@ -184,6 +184,14 @@ public:
virtual void reply(Ice::Int);
};
+class CollocatedObserverI : public ObserverWithDelegateT<IceMX::CollocatedMetrics,
+ Ice::Instrumentation::CollocatedObserver>
+{
+public:
+
+ virtual void reply(Ice::Int);
+};
+
class InvocationObserverI : public ObserverWithDelegateT<IceMX::InvocationMetrics,
Ice::Instrumentation::InvocationObserver>
{
@@ -193,12 +201,11 @@ public:
virtual void userException();
- virtual Ice::Instrumentation::RemoteObserverPtr getRemoteObserver(const Ice::ConnectionInfoPtr&,
- const Ice::EndpointPtr&,
- Ice::Int,
- Ice::Int);
+ virtual Ice::Instrumentation::RemoteObserverPtr
+ getRemoteObserver(const Ice::ConnectionInfoPtr&, const Ice::EndpointPtr&, Ice::Int, Ice::Int);
- virtual Ice::Instrumentation::RemoteObserverPtr getCollocatedObserver(Ice::Int, Ice::Int);
+ virtual Ice::Instrumentation::CollocatedObserverPtr
+ getCollocatedObserver(const Ice::ObjectAdapterPtr&, Ice::Int, Ice::Int);
};
typedef ObserverWithDelegateT<IceMX::Metrics, Ice::Instrumentation::Observer> ObserverI;
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 73778c9dafd..0e89e524a0a 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -279,7 +279,7 @@ IceInternal::Outgoing::sent()
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
if(_proxy->__reference()->getMode() != Reference::ModeTwoway)
{
- _remoteObserver.detach();
+ _childObserver.detach();
_state = StateOK;
}
_sent = true;
@@ -297,8 +297,8 @@ IceInternal::Outgoing::finished(const Exception& ex, bool sent)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
assert(_state <= StateInProgress);
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
_state = StateFailed;
_exception.reset(ex.ice_clone());
@@ -314,11 +314,11 @@ IceInternal::Outgoing::finished(BasicStream& is)
assert(_proxy->__reference()->getMode() == Reference::ModeTwoway); // Can only be called for twoways.
assert(_state <= StateInProgress);
- if(_remoteObserver)
+ if(_childObserver)
{
- _remoteObserver->reply(static_cast<Int>(is.b.size() - headerSize - 4));
+ _childObserver->reply(static_cast<Int>(is.b.size() - headerSize - 4));
}
- _remoteObserver.detach();
+ _childObserver.detach();
_is.swap(is);
@@ -615,7 +615,7 @@ void
IceInternal::BatchOutgoing::sent()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
- _remoteObserver.detach();
+ _childObserver.detach();
_sent = true;
_monitor.notify();
@@ -631,8 +631,8 @@ void
IceInternal::BatchOutgoing::finished(const Ice::Exception& ex, bool)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
_exception.reset(ex.ice_clone());
_monitor.notify();
}
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index 5a600e8fce2..3fb2c8ed08b 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -527,7 +527,7 @@ IceInternal::OutgoingAsync::__sent()
assert(!(_state & Done));
if(_proxy->__reference()->getMode() != Reference::ModeTwoway)
{
- _remoteObserver.detach();
+ _childObserver.detach();
if(!_callback || !_callback->__hasSentCallback())
{
_observer.detach();
@@ -556,8 +556,8 @@ IceInternal::OutgoingAsync::__finished(const Ice::Exception& exc, bool sent)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
assert(!(_state & Done));
- _remoteObserver.failed(exc.ice_name());
- _remoteObserver.detach();
+ _childObserver.failed(exc.ice_name());
+ _childObserver.detach();
if(_timeoutRequestHandler)
{
_instance->timer()->cancel(this);
@@ -596,11 +596,11 @@ IceInternal::OutgoingAsync::__finished()
assert(!_exception.get() && !(_state & Done));
assert(!_is.b.empty());
- if(_remoteObserver)
+ if(_childObserver)
{
- _remoteObserver->reply(static_cast<Int>(_is.b.size() - headerSize - 4));
+ _childObserver->reply(static_cast<Int>(_is.b.size() - headerSize - 4));
}
- _remoteObserver.detach();
+ _childObserver.detach();
if(_timeoutRequestHandler)
{
@@ -854,7 +854,7 @@ IceInternal::BatchOutgoingAsync::__sent()
assert(!_exception.get());
_state |= Done | OK | Sent;
//_os.resize(0); // Don't clear the buffer now, it's needed for collocation optimization.
- _remoteObserver.detach();
+ _childObserver.detach();
if(_timeoutRequestHandler)
{
_instance->timer()->cancel(this);
@@ -878,8 +878,8 @@ IceInternal::BatchOutgoingAsync::__invokeSent()
void
IceInternal::BatchOutgoingAsync::__finished(const Ice::Exception& exc, bool)
{
- _remoteObserver.failed(exc.ice_name());
- _remoteObserver.detach();
+ _childObserver.failed(exc.ice_name());
+ _childObserver.detach();
if(_timeoutRequestHandler)
{
_instance->timer()->cancel(this);
@@ -1021,7 +1021,7 @@ IceInternal::CommunicatorBatchOutgoingAsync::flushConnection(const ConnectionIPt
virtual bool __sent()
{
- _remoteObserver.detach();
+ _childObserver.detach();
_outAsync->check(false);
return false;
}
@@ -1032,15 +1032,15 @@ IceInternal::CommunicatorBatchOutgoingAsync::flushConnection(const ConnectionIPt
virtual void __finished(const Ice::Exception& ex, bool)
{
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
_outAsync->check(false);
}
virtual void __attachRemoteObserver(const Ice::ConnectionInfoPtr& connection, const Ice::EndpointPtr& endpt,
Ice::Int requestId, Ice::Int sz)
{
- _remoteObserver.attach(_observer.getRemoteObserver(connection, endpt, requestId, sz));
+ _childObserver.attach(_observer.getRemoteObserver(connection, endpt, requestId, sz));
}
private:
diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp
index f7b0f2160ff..cf9904e8dc8 100644
--- a/cpp/test/Ice/metrics/AllTests.cpp
+++ b/cpp/test/Ice/metrics/AllTests.cpp
@@ -135,11 +135,14 @@ public:
{
wait();
}
- // Ensure that the previous updates were committed, the setProperties call returns before
- // notifying the callbacks so to ensure all the update callbacks have be notified we call
- // a second time, this will block until all the notifications from the first update have
- // completed.
- _serverProps->setProperties(Ice::PropertyDict());
+ if(_serverProps->ice_getConnection())
+ {
+ // Ensure that the previous updates were committed, the setProperties call returns before
+ // notifying the callbacks so to ensure all the update callbacks have be notified we call
+ // a second time, this will block until all the notifications from the first update have
+ // completed.
+ _serverProps->setProperties(Ice::PropertyDict());
+ }
_updated = false;
}
@@ -307,8 +310,19 @@ updateProps(const Ice::PropertiesAdminPrx& cprops,
const Ice::PropertyDict& props,
const string& map = string())
{
- cprops->setProperties(getClientProps(cprops, props, map));
- sprops->setProperties(getServerProps(sprops, props, map));
+ if(sprops->ice_getConnection())
+ {
+ cprops->setProperties(getClientProps(cprops, props, map));
+ sprops->setProperties(getServerProps(sprops, props, map));
+ }
+ else
+ {
+ Ice::PropertyDict clientProps = getClientProps(cprops, props, map);
+ Ice::PropertyDict serverProps = getClientProps(cprops, props, map);
+ serverProps.insert(clientProps.begin(), clientProps.end());
+ cprops->setProperties(serverProps);
+ }
+
callback->waitForUpdate();
}
@@ -372,6 +386,7 @@ MetricsPrx
allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& obsv)
{
MetricsPrx metrics = MetricsPrx::checkedCast(communicator->stringToProxy("metrics:default -p 12010"));
+ bool collocated = !metrics->ice_getConnection();
cout << "testing metrics admin facet checkedCast... " << flush;
Ice::ObjectPrx admin = communicator->getAdmin();
@@ -404,7 +419,11 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
Ice::Long timestamp;
IceMX::MetricsView view = clientMetrics->getMetricsView("View", timestamp);
- test(view["Connection"].size() == 1 && view["Connection"][0]->current == 1 && view["Connection"][0]->total == 1);
+ if(!collocated)
+ {
+ test(view["Connection"].size() == 1 && view["Connection"][0]->current == 1 &&
+ view["Connection"][0]->total == 1);
+ }
test(view["Thread"].size() == 1 && view["Thread"][0]->current == threadCount &&
view["Thread"][0]->total == threadCount);
cout << "ok" << endl;
@@ -421,308 +440,328 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
metrics->ice_connectionId("Con1")->ice_ping();
view = clientMetrics->getMetricsView("View", timestamp);
+ if(!collocated)
+ {
+ test(view["Connection"].size() == 2);
+ }
test(static_cast<int>(view["Thread"].size()) == threadCount);
- test(view["Connection"].size() == 2);
test(view["Invocation"].size() == 1);
IceMX::InvocationMetricsPtr invoke = IceMX::InvocationMetricsPtr::dynamicCast(view["Invocation"][0]);
test(invoke->id.find("[ice_ping]") > 0 && invoke->current == 0 && invoke->total == 5);
- test(invoke->remotes.size() == 2);
- test(invoke->remotes[0]->total = 2);
- test(invoke->remotes[1]->total = 3);
+ if(!collocated)
+ {
+ test(invoke->remotes.size() == 2);
+ test(invoke->remotes[0]->total = 2);
+ test(invoke->remotes[1]->total = 3);
+ }
+ else
+ {
+ test(invoke->collocated.size() == 1);
+ test(invoke->collocated[0]->total = 5);
+ }
view = serverMetrics->getMetricsView("View", timestamp);
- test(static_cast<int>(view["Thread"].size()) > threadCount);
- test(view["Connection"].size() == 2);
+ if(serverMetrics->ice_getConnection())
+ {
+ test(static_cast<int>(view["Thread"].size()) > threadCount);
+ test(view["Connection"].size() == 2);
+ }
test(view["Dispatch"].size() == 1);
test(view["Dispatch"][0]->current <= 1 && view["Dispatch"][0]->total == 5);
test(view["Dispatch"][0]->id.find("[ice_ping]") > 0);
- metrics->ice_getConnection()->close(false);
- metrics->ice_connectionId("Con1")->ice_getConnection()->close(false);
-
- waitForCurrent(clientMetrics, "View", "Connection", 0);
- waitForCurrent(serverMetrics, "View", "Connection", 0);
+ if(!collocated)
+ {
+ metrics->ice_getConnection()->close(false);
+ metrics->ice_connectionId("Con1")->ice_getConnection()->close(false);
+
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
+ }
clearView(clientProps, serverProps, update);
cout << "ok" << endl;
- cout << "testing connection metrics... " << flush;
+ map<string, IceMX::MetricsPtr> map;
- props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
- updateProps(clientProps, serverProps, update, props, "Connection");
+ if(!collocated)
+ {
+ cout << "testing connection metrics... " << flush;
- test(clientMetrics->getMetricsView("View", timestamp)["Connection"].empty());
- test(serverMetrics->getMetricsView("View", timestamp)["Connection"].empty());
+ props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
+ updateProps(clientProps, serverProps, update, props, "Connection");
- metrics->ice_ping();
+ test(clientMetrics->getMetricsView("View", timestamp)["Connection"].empty());
+ test(serverMetrics->getMetricsView("View", timestamp)["Connection"].empty());
- IceMX::ConnectionMetricsPtr cm1, sm1, cm2, sm2;
- cm1 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- sm1 = IceMX::ConnectionMetricsPtr::dynamicCast(serverMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- sm1 = getServerConnectionMetrics(serverMetrics, 25);
- test(cm1->total == 1 && sm1->total == 1);
+ metrics->ice_ping();
- metrics->ice_ping();
+ IceMX::ConnectionMetricsPtr cm1, sm1, cm2, sm2;
+ cm1 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ sm1 = IceMX::ConnectionMetricsPtr::dynamicCast(serverMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ sm1 = getServerConnectionMetrics(serverMetrics, 25);
+ test(cm1->total == 1 && sm1->total == 1);
- cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- sm2 = getServerConnectionMetrics(serverMetrics, 50);
+ metrics->ice_ping();
- test(cm2->sentBytes - cm1->sentBytes == 45); // 45 for ice_ping request
- test(cm2->receivedBytes - cm1->receivedBytes == 25); // 25 bytes for ice_ping response
- test(sm2->receivedBytes - sm1->receivedBytes == 45);
- test(sm2->sentBytes - sm1->sentBytes == 25);
+ cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ sm2 = getServerConnectionMetrics(serverMetrics, 50);
- cm1 = cm2;
- sm1 = sm2;
+ test(cm2->sentBytes - cm1->sentBytes == 45); // 45 for ice_ping request
+ test(cm2->receivedBytes - cm1->receivedBytes == 25); // 25 bytes for ice_ping response
+ test(sm2->receivedBytes - sm1->receivedBytes == 45);
+ test(sm2->sentBytes - sm1->sentBytes == 25);
- Test::ByteSeq bs;
- metrics->opByteS(bs);
+ cm1 = cm2;
+ sm1 = sm2;
- cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- sm2 = getServerConnectionMetrics(serverMetrics, sm1->sentBytes + cm2->receivedBytes - cm1->receivedBytes);
- Ice::Long requestSz = cm2->sentBytes - cm1->sentBytes;
- Ice::Long replySz = cm2->receivedBytes - cm1->receivedBytes;
+ Test::ByteSeq bs;
+ metrics->opByteS(bs);
- cm1 = cm2;
- sm1 = sm2;
+ cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1->sentBytes + cm2->receivedBytes - cm1->receivedBytes);
+ Ice::Long requestSz = cm2->sentBytes - cm1->sentBytes;
+ Ice::Long replySz = cm2->receivedBytes - cm1->receivedBytes;
- bs.resize(456);
- metrics->opByteS(bs);
+ cm1 = cm2;
+ sm1 = sm2;
- cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- sm2 = getServerConnectionMetrics(serverMetrics, sm1->sentBytes + replySz);
+ bs.resize(456);
+ metrics->opByteS(bs);
- // 4 is for the seq variable size
- test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4);
- test(cm2->receivedBytes - cm1->receivedBytes == replySz);
- test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4);
- test(sm2->sentBytes - sm1->sentBytes == replySz);
+ cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1->sentBytes + replySz);
- cm1 = cm2;
- sm1 = sm2;
+ // 4 is for the seq variable size
+ test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4);
+ test(cm2->receivedBytes - cm1->receivedBytes == replySz);
+ test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4);
+ test(sm2->sentBytes - sm1->sentBytes == replySz);
- bs.resize(1024 * 1024 * 10); // Try with large amount of data which should be sent in several chunks
- metrics->opByteS(bs);
+ cm1 = cm2;
+ sm1 = sm2;
- cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- sm2 = getServerConnectionMetrics(serverMetrics, sm1->sentBytes + replySz);
+ bs.resize(1024 * 1024 * 10); // Try with large amount of data which should be sent in several chunks
+ metrics->opByteS(bs);
- // 4 is for the seq variable size
- test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4);
- test(cm2->receivedBytes - cm1->receivedBytes == replySz);
- test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4);
- test(sm2->sentBytes - sm1->sentBytes == replySz);
-
- props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "state";
- updateProps(clientProps, serverProps, update, props, "Connection");
+ cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1->sentBytes + replySz);
- map<string, IceMX::MetricsPtr> map;
+ // 4 is for the seq variable size
+ test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4);
+ test(cm2->receivedBytes - cm1->receivedBytes == replySz);
+ test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4);
+ test(sm2->sentBytes - sm1->sentBytes == replySz);
- map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
+ props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "state";
+ updateProps(clientProps, serverProps, update, props, "Connection");
- test(map["active"]->current == 1);
+ map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
- ControllerPrx controller = ControllerPrx::checkedCast(communicator->stringToProxy("controller:default -p 12011"));
- controller->hold();
+ test(map["active"]->current == 1);
- map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]);
- test(map["active"]->current == 1);
- map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
- test(map["holding"]->current == 1);
+ ControllerPrx controller = ControllerPrx::checkedCast(communicator->stringToProxy("controller:default -p 12011"));
+ controller->hold();
- metrics->ice_getConnection()->close(false);
+ map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]);
+ test(map["active"]->current == 1);
+ map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
+ test(map["holding"]->current == 1);
- map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]);
- test(map["closing"]->current == 1);
- map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
- test(map["holding"]->current == 1);
+ metrics->ice_getConnection()->close(false);
- controller->resume();
+ map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]);
+ test(map["closing"]->current == 1);
+ map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
+ test(map["holding"]->current == 1);
- map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
- test(map["holding"]->current == 0);
+ controller->resume();
- props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
- updateProps(clientProps, serverProps, update, props, "Connection");
+ map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
+ test(map["holding"]->current == 0);
- metrics->ice_getConnection()->close(false);
+ props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
+ updateProps(clientProps, serverProps, update, props, "Connection");
- metrics->ice_timeout(500)->ice_ping();
- controller->hold();
- try
- {
- Ice::ByteSeq seq;
- seq.resize(10000000);
- metrics->ice_timeout(500)->opByteS(seq);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- }
- controller->resume();
+ metrics->ice_getConnection()->close(false);
- cm1 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- while(true)
- {
- sm1 = IceMX::ConnectionMetricsPtr::dynamicCast(
- serverMetrics->getMetricsView("View", timestamp)["Connection"][0]);
- if(sm1->failures >= 2)
+ metrics->ice_timeout(500)->ice_ping();
+ controller->hold();
+ try
{
- break;
+ Ice::ByteSeq seq;
+ seq.resize(10000000);
+ metrics->ice_timeout(500)->opByteS(seq);
+ test(false);
}
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
- }
- test(cm1->failures == 2 && sm1->failures >= 2);
-
- checkFailure(clientMetrics, "Connection", cm1->id, "Ice::TimeoutException", 1);
- checkFailure(clientMetrics, "Connection", cm1->id, "Ice::ConnectTimeoutException", 1);
- checkFailure(serverMetrics, "Connection", sm1->id, "Ice::ConnectionLostException");
-
- MetricsPrx m = metrics->ice_timeout(500)->ice_connectionId("Con1");
- m->ice_ping();
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator");
- //testAttribute(clientMetrics, clientProps, update, "Connection", "id", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint", "tcp -h 127.0.0.1 -p 12010 -t 500");
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "false");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "false");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010");
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "false");
- testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1");
- //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010");
- testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "");
-
- m->ice_getConnection()->close(false);
-
- waitForCurrent(clientMetrics, "View", "Connection", 0);
- waitForCurrent(serverMetrics, "View", "Connection", 0);
-
- cout << "ok" << endl;
-
- cout << "testing connection establishment metrics... " << flush;
-
- props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
- updateProps(clientProps, serverProps, update, props, "ConnectionEstablishment");
- test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].empty());
+ catch(const Ice::TimeoutException&)
+ {
+ }
+ controller->resume();
- metrics->ice_ping();
+ cm1 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ while(true)
+ {
+ sm1 = IceMX::ConnectionMetricsPtr::dynamicCast(
+ serverMetrics->getMetricsView("View", timestamp)["Connection"][0]);
+ if(sm1->failures >= 2)
+ {
+ break;
+ }
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
+ }
+ test(cm1->failures == 2 && sm1->failures >= 2);
+
+ checkFailure(clientMetrics, "Connection", cm1->id, "Ice::TimeoutException", 1);
+ checkFailure(clientMetrics, "Connection", cm1->id, "Ice::ConnectTimeoutException", 1);
+ checkFailure(serverMetrics, "Connection", sm1->id, "Ice::ConnectionLostException");
+
+ MetricsPrx m = metrics->ice_timeout(500)->ice_connectionId("Con1");
+ m->ice_ping();
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator");
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "id", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint", "tcp -h 127.0.0.1 -p 12010 -t 500");
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "false");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "false");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010");
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "false");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1");
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "");
- test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1);
- IceMX::MetricsPtr m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0];
- test(m1->current == 0 && m1->total == 1 && m1->id == "127.0.0.1:12010");
+ m->ice_getConnection()->close(false);
- metrics->ice_getConnection()->close(false);
- controller->hold();
- try
- {
- communicator->stringToProxy("test:tcp -p 12010 -h 127.0.0.1")->ice_timeout(10)->ice_ping();
- test(false);
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- }
- catch(const Ice::LocalException&)
- {
- test(false);
- }
- controller->resume();
- test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1);
- m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0];
- test(m1->id == "127.0.0.1:12010" && m1->total == 3 && m1->failures == 2);
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
- checkFailure(clientMetrics, "ConnectionEstablishment", m1->id, "Ice::ConnectTimeoutException", 2);
+ cout << "ok" << endl;
- Connect c(metrics);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
- "tcp -h 127.0.0.1 -p 12010", c);
+ cout << "testing connection establishment metrics... " << flush;
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "false", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c);
+ props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
+ updateProps(clientProps, serverProps, update, props, "ConnectionEstablishment");
+ test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].empty());
- cout << "ok" << endl;
+ metrics->ice_ping();
+
+ test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1);
+ IceMX::MetricsPtr m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0];
+ test(m1->current == 0 && m1->total == 1 && m1->id == "127.0.0.1:12010");
- //
- // Ice doesn't do any endpoint lookup with WinRT, the WinRT
- // runtime takes care of if.
- //
+ metrics->ice_getConnection()->close(false);
+ controller->hold();
+ try
+ {
+ communicator->stringToProxy("test:tcp -p 12010 -h 127.0.0.1")->ice_timeout(10)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ }
+ catch(const Ice::LocalException&)
+ {
+ test(false);
+ }
+ controller->resume();
+ test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1);
+ m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0];
+ test(m1->id == "127.0.0.1:12010" && m1->total == 3 && m1->failures == 2);
+
+ checkFailure(clientMetrics, "ConnectionEstablishment", m1->id, "Ice::ConnectTimeoutException", 2);
+
+ Connect c(metrics);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
+ "tcp -h 127.0.0.1 -p 12010", c);
+
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "false", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c);
+
+ cout << "ok" << endl;
+
+ //
+ // Ice doesn't do any endpoint lookup with WinRT, the WinRT
+ // runtime takes care of if.
+ //
#ifndef ICE_OS_WINRT
- cout << "testing endpoint lookup metrics... " << flush;
+ cout << "testing endpoint lookup metrics... " << flush;
- props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
- updateProps(clientProps, serverProps, update, props, "EndpointLookup");
- test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].empty());
+ props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
+ updateProps(clientProps, serverProps, update, props, "EndpointLookup");
+ test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].empty());
- Ice::ObjectPrx prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost");
- prx->ice_ping();
+ Ice::ObjectPrx prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost");
+ prx->ice_ping();
- test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 1);
- m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][0];
+ test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 1);
+ m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][0];
- test(m1->current <= 1 && m1->total == 1 && m1->id == "tcp -h localhost -p 12010");
+ test(m1->current <= 1 && m1->total == 1 && m1->id == "tcp -h localhost -p 12010");
- prx->ice_getConnection()->close(false);
+ prx->ice_getConnection()->close(false);
- bool dnsException = false;
- try
- {
- communicator->stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com")->ice_ping();
- test(false);
- }
- catch(const Ice::DNSException&)
- {
- dnsException = true;
- }
- catch(const Ice::LocalException&)
- {
- // Some DNS servers don't fail on unknown DNS names.
- }
- test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 2);
- m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][1];
- test(m1->id == "tcp -h unknownfoo.zeroc.com -p 12010 -t 500" && m1->total == 2 &&
- (!dnsException || m1->failures == 2));
- if(dnsException)
- {
- checkFailure(clientMetrics, "EndpointLookup", m1->id, "Ice::DNSException", 2);
- }
+ bool dnsException = false;
+ try
+ {
+ communicator->stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::DNSException&)
+ {
+ dnsException = true;
+ }
+ catch(const Ice::LocalException&)
+ {
+ // Some DNS servers don't fail on unknown DNS names.
+ }
+ test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 2);
+ m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][1];
+ test(m1->id == "tcp -h unknownfoo.zeroc.com -p 12010 -t 500" && m1->total == 2 &&
+ (!dnsException || m1->failures == 2));
+ if(dnsException)
+ {
+ checkFailure(clientMetrics, "EndpointLookup", m1->id, "Ice::DNSException", 2);
+ }
- c = Connect(prx);
+ c = Connect(prx);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint",
- "tcp -h localhost -p 12010", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint",
+ "tcp -h localhost -p 12010", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "false", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "false", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c);
- cout << "ok" << endl;
+ cout << "ok" << endl;
#endif
+ }
cout << "testing dispatch metrics... " << flush;
@@ -763,17 +802,27 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
catch(const Ice::UnknownException&)
{
}
- try
- {
- metrics->fail();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
+ if(!collocated)
{
+ try
+ {
+ metrics->fail();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
}
map = toMap(serverMetrics->getMetricsView("View", timestamp)["Dispatch"]);
- test(map.size() == 6);
+ if(!collocated)
+ {
+ test(map.size() == 6);
+ }
+ else
+ {
+ test(map.size() == 5);
+ }
IceMX::DispatchMetricsPtr dm1 = IceMX::DispatchMetricsPtr::dynamicCast(map["op"]);
test(dm1->current <= 1 && dm1->total == 1 && dm1->failures == 0 && dm1->userException == 0);
@@ -802,26 +851,29 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -h 127.0.0.1 -p 12010", op);
- //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op);
-
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "false", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op);
-
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "true", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op);
- //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op);
+ if(!collocated)
+ {
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -h 127.0.0.1 -p 12010", op);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "false", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "true", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op);
+ }
testAttribute(serverMetrics, serverProps, update, "Dispatch", "operation", "op", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "identity", "metrics", op);
@@ -838,6 +890,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
props["IceMX.Metrics.View.Map.Invocation.GroupBy"] = "operation";
props["IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy"] = "localPort";
+ props["IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy"] = "parent";
updateProps(clientProps, serverProps, update, props, "Invocation");
test(serverMetrics->getMetricsView("View", timestamp)["Invocation"].empty());
@@ -932,73 +985,83 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
cb->waitForResponse();
// Fail
- try
- {
- metrics->fail();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- try
- {
- metrics->end_fail(metrics->begin_fail());
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
+ if(!collocated)
{
+ try
+ {
+ metrics->fail();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ try
+ {
+ metrics->end_fail(metrics->begin_fail());
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ metrics->begin_fail(newCallback_Metrics_fail(cb, &Callback::response, &Callback::exception));
+ cb->waitForResponse();
}
- metrics->begin_fail(newCallback_Metrics_fail(cb, &Callback::response, &Callback::exception));
- cb->waitForResponse();
-
map = toMap(clientMetrics->getMetricsView("View", timestamp)["Invocation"]);
- test(map.size() == 6);
+ test(!collocated ? (map.size() == 6) : (map.size() == 5));
IceMX::InvocationMetricsPtr im1;
- IceMX::RemoteMetricsPtr rim1;
+ IceMX::ChildInvocationMetricsPtr rim1;
im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["op"]);
- test(im1->current <= 1 && im1->total == 3 && im1->failures == 0 && im1->retry == 0 && im1->remotes.size() == 1);
- rim1 = IceMX::RemoteMetricsPtr::dynamicCast(im1->remotes[0]);
+ test(im1->current <= 1 && im1->total == 3 && im1->failures == 0 && im1->retry == 0);
+ test(!collocated ? (im1->remotes.size() == 1) : (im1->collocated.size() == 1));
+ rim1 = IceMX::ChildInvocationMetricsPtr::dynamicCast(!collocated ? im1->remotes[0] : im1->collocated[0]);
test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0);
test(rim1->size == 63 && rim1->replySize == 21);
im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["opWithUserException"]);
- test(im1->current <= 1 && im1->total == 3 && im1->failures == 0 && im1->retry == 0 && im1->remotes.size() == 1);
- rim1 = IceMX::RemoteMetricsPtr::dynamicCast(im1->remotes[0]);
+ test(im1->current <= 1 && im1->total == 3 && im1->failures == 0 && im1->retry == 0);
+ test(!collocated ? (im1->remotes.size() == 1) : (im1->collocated.size() == 1));
+ rim1 = IceMX::ChildInvocationMetricsPtr::dynamicCast(!collocated ? im1->remotes[0] : im1->collocated[0]);
test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0);
test(rim1->size == 114 && rim1->replySize == 69);
test(im1->userException == 3);
im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["opWithLocalException"]);
- test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 0 && im1->remotes.size() == 1);
- rim1 = IceMX::RemoteMetricsPtr::dynamicCast(im1->remotes[0]);
+ test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 0);
+ test(!collocated ? (im1->remotes.size() == 1) : (im1->collocated.size() == 1));
+ rim1 = IceMX::ChildInvocationMetricsPtr::dynamicCast(!collocated ? im1->remotes[0] : im1->collocated[0]);
test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0);
test(rim1->size == 117 && rim1->replySize > 7);
checkFailure(clientMetrics, "Invocation", im1->id, "Ice::UnknownLocalException", 3);
im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["opWithRequestFailedException"]);
- test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 0 && im1->remotes.size() == 1);
- rim1 = IceMX::RemoteMetricsPtr::dynamicCast(im1->remotes[0]);
+ test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 0);
+ test(!collocated ? (im1->remotes.size() == 1) : (im1->collocated.size() == 1));
+ rim1 = IceMX::ChildInvocationMetricsPtr::dynamicCast(!collocated ? im1->remotes[0] : im1->collocated[0]);
test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0);
test(rim1->size == 141 && rim1->replySize == 120);
checkFailure(clientMetrics, "Invocation", im1->id, "Ice::ObjectNotExistException", 3);
im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["opWithUnknownException"]);
- test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 0 && im1->remotes.size() == 1);
- rim1 = IceMX::RemoteMetricsPtr::dynamicCast(im1->remotes[0]);
+ test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 0);
+ test(!collocated ? (im1->remotes.size() == 1) : (im1->collocated.size() == 1));
+ rim1 = IceMX::ChildInvocationMetricsPtr::dynamicCast(!collocated ? im1->remotes[0] : im1->collocated[0]);
test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0);
test(rim1->size == 123 && rim1->replySize == 69);
checkFailure(clientMetrics, "Invocation", im1->id, "Ice::UnknownException", 3);
- im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["fail"]);
- test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 3 && im1->remotes.size() == 6);
- test(im1->remotes[0]->current == 0 && im1->remotes[0]->total == 1 && im1->remotes[0]->failures == 1);
- test(im1->remotes[1]->current == 0 && im1->remotes[1]->total == 1 && im1->remotes[1]->failures == 1);
- test(im1->remotes[2]->current == 0 && im1->remotes[2]->total == 1 && im1->remotes[2]->failures == 1);
- test(im1->remotes[3]->current == 0 && im1->remotes[3]->total == 1 && im1->remotes[3]->failures == 1);
- test(im1->remotes[4]->current == 0 && im1->remotes[4]->total == 1 && im1->remotes[4]->failures == 1);
- test(im1->remotes[5]->current == 0 && im1->remotes[5]->total == 1 && im1->remotes[5]->failures == 1);
- checkFailure(clientMetrics, "Invocation", im1->id, "Ice::ConnectionLostException", 3);
+ if(!collocated)
+ {
+ im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["fail"]);
+ test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 3 && im1->remotes.size() == 6);
+ test(im1->remotes[0]->current == 0 && im1->remotes[0]->total == 1 && im1->remotes[0]->failures == 1);
+ test(im1->remotes[1]->current == 0 && im1->remotes[1]->total == 1 && im1->remotes[1]->failures == 1);
+ test(im1->remotes[2]->current == 0 && im1->remotes[2]->total == 1 && im1->remotes[2]->failures == 1);
+ test(im1->remotes[3]->current == 0 && im1->remotes[3]->total == 1 && im1->remotes[3]->failures == 1);
+ test(im1->remotes[4]->current == 0 && im1->remotes[4]->total == 1 && im1->remotes[4]->failures == 1);
+ test(im1->remotes[5]->current == 0 && im1->remotes[5]->total == 1 && im1->remotes[5]->failures == 1);
+ checkFailure(clientMetrics, "Invocation", im1->id, "Ice::ConnectionLostException", 3);
+ }
testAttribute(clientMetrics, clientProps, update, "Invocation", "parent", "Communicator", op);
testAttribute(clientMetrics, clientProps, update, "Invocation", "id", "metrics -t -e 1.1 [op]", op);
@@ -1052,41 +1115,70 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
cout << "testing instrumentation observer delegate... " << flush;
test(obsv->threadObserver->getTotal() > 0);
- test(obsv->connectionObserver->getTotal() > 0);
- test(obsv->connectionEstablishmentObserver->getTotal() > 0);
+ if(!collocated)
+ {
+ test(obsv->connectionObserver->getTotal() > 0);
+ test(obsv->connectionEstablishmentObserver->getTotal() > 0);
#ifndef ICE_OS_WINRT
- test(obsv->endpointLookupObserver->getTotal() > 0);
+ test(obsv->endpointLookupObserver->getTotal() > 0);
#endif
+ test(obsv->invocationObserver->remoteObserver->getTotal() > 0);
+ }
+ else
+ {
+ test(obsv->invocationObserver->collocatedObserver->getTotal() > 0);
+ }
test(obsv->dispatchObserver->getTotal() > 0);
test(obsv->invocationObserver->getTotal() > 0);
- test(obsv->invocationObserver->remoteObserver->getTotal() > 0);
test(obsv->threadObserver->getCurrent() > 0);
- test(obsv->connectionObserver->getCurrent() > 0);
- test(obsv->connectionEstablishmentObserver->getCurrent() == 0);
+ if(!collocated)
+ {
+ test(obsv->connectionObserver->getCurrent() > 0);
+ test(obsv->connectionEstablishmentObserver->getCurrent() == 0);
#ifndef ICE_OS_WINRT
- test(obsv->endpointLookupObserver->getCurrent() == 0);
+ test(obsv->endpointLookupObserver->getCurrent() == 0);
#endif
+ test(obsv->invocationObserver->remoteObserver->getCurrent() == 0);
+ }
+ else
+ {
+ test(obsv->invocationObserver->collocatedObserver->getCurrent() == 0);
+ }
test(obsv->dispatchObserver->getCurrent() == 0);
test(obsv->invocationObserver->getCurrent() == 0);
- test(obsv->invocationObserver->remoteObserver->getCurrent() == 0);
test(obsv->threadObserver->getFailedCount() == 0);
- test(obsv->connectionObserver->getFailedCount() > 0);
- test(obsv->connectionEstablishmentObserver->getFailedCount() > 0);
+ if(!collocated)
+ {
+ test(obsv->connectionObserver->getFailedCount() > 0);
+ test(obsv->connectionEstablishmentObserver->getFailedCount() > 0);
#ifndef ICE_OS_WINRT
- test(obsv->endpointLookupObserver->getFailedCount() > 0);
+ test(obsv->endpointLookupObserver->getFailedCount() > 0);
#endif
+ }
//test(obsv->dispatchObserver->getFailedCount() > 0);
test(obsv->invocationObserver->getFailedCount() > 0);
- test(obsv->invocationObserver->remoteObserver->getFailedCount() > 0);
-
- test(obsv->threadObserver->states > 0);
- test(obsv->connectionObserver->received > 0 && obsv->connectionObserver->sent > 0);
+ if(!collocated)
+ {
+ test(obsv->invocationObserver->remoteObserver->getFailedCount() > 0);
+ test(obsv->threadObserver->states > 0);
+ }
+ if(!collocated)
+ {
+ test(obsv->connectionObserver->received > 0 && obsv->connectionObserver->sent > 0);
+ }
//test(obsv->dispatchObserver->userExceptionCount > 0);
- test(obsv->invocationObserver->userExceptionCount > 0 && obsv->invocationObserver->retriedCount > 0);
- test(obsv->invocationObserver->remoteObserver->replySize > 0);
-
+ test(obsv->invocationObserver->userExceptionCount > 0);
+ if(!collocated)
+ {
+ test(obsv->invocationObserver->retriedCount > 0);
+ test(obsv->invocationObserver->remoteObserver->replySize > 0);
+ }
+ else
+ {
+ test(obsv->invocationObserver->collocatedObserver->replySize > 0);
+ }
cout << "ok" << endl;
return metrics;
diff --git a/cpp/test/Ice/metrics/Collocated.cpp b/cpp/test/Ice/metrics/Collocated.cpp
new file mode 100644
index 00000000000..8b9943fe2b8
--- /dev/null
+++ b/cpp/test/Ice/metrics/Collocated.cpp
@@ -0,0 +1,81 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 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.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestCommon.h>
+#include <TestI.h>
+#include <InstrumentationI.h>
+
+DEFINE_TEST("client")
+
+using namespace std;
+using namespace Test;
+
+int
+run(int, char**, const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& observer)
+{
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
+ Ice::ObjectPtr object = new MetricsI;
+ adapter->add(object, communicator->stringToIdentity("metrics"));
+ //adapter->activate();
+
+ communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
+ controllerAdapter->add(new ControllerI(adapter), communicator->stringToIdentity("controller"));
+ //controllerAdapter->activate();
+
+ MetricsPrx allTests(const Ice::CommunicatorPtr&, const CommunicatorObserverIPtr&);
+ MetricsPrx metrics = allTests(communicator, observer);
+ metrics->shutdown();
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ int status;
+ Ice::CommunicatorPtr communicator;
+
+ try
+ {
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties->setProperty("Ice.Admin.InstanceName", "client");
+ initData.properties->setProperty("Ice.Admin.DelayCreation", "1");
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
+ initData.properties->setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties->setProperty("Ice.MessageSizeMax", "50000");
+ CommunicatorObserverIPtr observer = new CommunicatorObserverI();
+ initData.observer = observer;
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator, observer);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+
+ if(communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ }
+
+ return status;
+}
diff --git a/cpp/test/Ice/metrics/InstrumentationI.h b/cpp/test/Ice/metrics/InstrumentationI.h
index beb0993a3c8..15b074820b6 100644
--- a/cpp/test/Ice/metrics/InstrumentationI.h
+++ b/cpp/test/Ice/metrics/InstrumentationI.h
@@ -155,7 +155,7 @@ public:
Ice::Int replySize;
};
-class RemoteObserverI : public Ice::Instrumentation::RemoteObserver, public ObserverI
+class ChildInvocationObserverI : virtual public Ice::Instrumentation::ChildInvocationObserver, public ObserverI
{
public:
@@ -177,6 +177,14 @@ public:
Ice::Int replySize;
};
+class RemoteObserverI : public Ice::Instrumentation::RemoteObserver, public ChildInvocationObserverI
+{
+};
+
+class CollocatedObserverI : public Ice::Instrumentation::CollocatedObserver, public ChildInvocationObserverI
+{
+};
+
class InvocationObserverI : public Ice::Instrumentation::InvocationObserver, public ObserverI
{
public:
@@ -187,6 +195,10 @@ public:
ObserverI::reset();
retriedCount = 0;
userExceptionCount = 0;
+ if(collocatedObserver)
+ {
+ collocatedObserver->reset();
+ }
if(remoteObserver)
{
remoteObserver->reset();
@@ -219,22 +231,23 @@ public:
return remoteObserver;
}
- virtual Ice::Instrumentation::RemoteObserverPtr
- getCollocatedObserver(Ice::Int, Ice::Int)
+ virtual Ice::Instrumentation::CollocatedObserverPtr
+ getCollocatedObserver(const Ice::ObjectAdapterPtr&, Ice::Int, Ice::Int)
{
IceUtil::Mutex::Lock sync(*this);
- if(!remoteObserver)
+ if(!collocatedObserver)
{
- remoteObserver = new RemoteObserverI();
- remoteObserver->reset();
+ collocatedObserver = new CollocatedObserverI();
+ collocatedObserver->reset();
}
- return remoteObserver;
+ return collocatedObserver;
}
Ice::Int userExceptionCount;
Ice::Int retriedCount;
IceUtil::Handle<RemoteObserverI> remoteObserver;
+ IceUtil::Handle<CollocatedObserverI> collocatedObserver;
};
class CommunicatorObserverI : public Ice::Instrumentation::CommunicatorObserver, public IceUtil::Mutex
diff --git a/cpp/test/Ice/metrics/Makefile b/cpp/test/Ice/metrics/Makefile
index a9e7de64731..85d411b1853 100644
--- a/cpp/test/Ice/metrics/Makefile
+++ b/cpp/test/Ice/metrics/Makefile
@@ -12,8 +12,9 @@ top_srcdir = ../../..
CLIENT = $(call mktestname,client)
SERVER = $(call mktestname,server)
SERVERAMD = $(call mktestname,serveramd)
+COLLOCATED = $(call mktestname,collocated)
-TARGETS = $(CLIENT) $(SERVER) $(SERVERAMD)
+TARGETS = $(CLIENT) $(SERVER) $(SERVERAMD) $(COLLOCATED)
COBJS = Test.o \
Client.o \
@@ -27,10 +28,15 @@ SAMDOBJS = TestAMD.o \
TestAMDI.o \
ServerAMD.o
+COLOBJS = Test.o \
+ Collocated.o \
+ AllTests.o \
+ TestI.o
SRCS = $(COBJS:.o=.cpp) \
$(SOBJS:.o=.cpp) \
- $(SAMDOBJS:.o=.cpp)
+ $(SAMDOBJS:.o=.cpp) \
+ $(COLOBJS:.o=.cpp)
SLICE_SRCS = Test.ice TestAMD.ice
@@ -50,4 +56,8 @@ $(SERVERAMD): $(SAMDOBJS)
rm -f $@
$(call mktest,$@,$(SAMDOBJS),$(LIBS))
+$(COLLOCATED): $(COLOBJS)
+ rm -f $@
+ $(call mktest,$@,$(COLOBJS),$(LIBS))
+
include .depend
diff --git a/cpp/test/Ice/metrics/Makefile.mak b/cpp/test/Ice/metrics/Makefile.mak
index 2a5a4df57a9..e37adabe808 100644
--- a/cpp/test/Ice/metrics/Makefile.mak
+++ b/cpp/test/Ice/metrics/Makefile.mak
@@ -20,8 +20,9 @@ EXT = .dll
CLIENT = $(NAME_PREFIX)client
SERVER = $(NAME_PREFIX)server
SERVERAMD = $(NAME_PREFIX)serveramd
+COLLOCATED = $(NAME_PREFIX)collocated
-TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT)
+TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT) $(COLLOCATED)$(EXT)
COBJS = Test.obj \
Client.obj \
@@ -35,6 +36,11 @@ SAMDOBJS = TestAMD.obj \
TestAMDI.obj \
ServerAMD.obj
+COLOBJS = Test.obj \
+ TestI.obj \
+ AllTests.obj \
+ Collocated.obj
+
SRCS = $(COBJS:.obj=.cpp) \
$(SOBJS:.obj=.cpp) \
$(SAMDOBJS:.obj=.cpp)
@@ -52,6 +58,8 @@ LD_TESTFLAGS = $(LD_DLLFLAGS) /export:dllMain
!if "$(GENERATE_PDB)" == "yes"
CPDBFLAGS = /pdb:$(CLIENT).pdb
SPDBFLAGS = /pdb:$(SERVER).pdb
+SAPDBFLAGS = /pdb:$(SERVERAMD).pdb
+COPDBFLAGS = /pdb:$(COLLOCATED).pdb
!endif
$(CLIENT)$(EXT): $(COBJS)
@@ -69,6 +77,10 @@ $(SERVERAMD)$(EXT): $(SAMDOBJS)
@if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
$(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+$(COLLOCATED)$(EXT): $(COLOBJS)
+ $(LINK) $(LD_TESTFLAGS) $(COPDBFLAGS) $(COLOBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
clean::
del /q Test.cpp Test.h
del /q TestAMD.cpp TestAMD.h
diff --git a/cpp/test/Ice/metrics/run.py b/cpp/test/Ice/metrics/run.py
index 0d1fb0757df..b6187895bf3 100755
--- a/cpp/test/Ice/metrics/run.py
+++ b/cpp/test/Ice/metrics/run.py
@@ -24,3 +24,5 @@ print("tests with regular server.")
TestUtil.clientServerTest()
print("tests with AMD server.")
TestUtil.clientServerTest(server = "serveramd")
+print("tests with collocated server.")
+TestUtil.collocatedTest()
diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp
index 6f11847a2f7..840a6defa81 100644
--- a/cpp/test/Ice/operations/Collocated.cpp
+++ b/cpp/test/Ice/operations/Collocated.cpp
@@ -22,9 +22,11 @@ run(int, char**, const Ice::CommunicatorPtr& communicator,
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
communicator->getProperties()->setProperty("TestAdapter.AdapterId", "test");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
- adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test"));
+ Ice::ObjectPrx prx = adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test"));
adapter->activate();
+ test(!prx->ice_getConnection());
+
Test::MyClassPrx allTests(const Ice::CommunicatorPtr&);
allTests(communicator);
diff --git a/cpp/test/Ice/retry/InstrumentationI.cpp b/cpp/test/Ice/retry/InstrumentationI.cpp
index 5a61c6cb3ef..a39a2804b38 100644
--- a/cpp/test/Ice/retry/InstrumentationI.cpp
+++ b/cpp/test/Ice/retry/InstrumentationI.cpp
@@ -76,8 +76,8 @@ public:
return 0;
}
- virtual ::Ice::Instrumentation::RemoteObserverPtr
- getCollocatedObserver(::Ice::Int, ::Ice::Int)
+ virtual ::Ice::Instrumentation::CollocatedObserverPtr
+ getCollocatedObserver(const Ice::ObjectAdapterPtr&, ::Ice::Int, ::Ice::Int)
{
return 0;
}
diff --git a/cs/src/Ice/CollocatedRequestHandler.cs b/cs/src/Ice/CollocatedRequestHandler.cs
index d46bca94d2f..b87c5ff7cec 100644
--- a/cs/src/Ice/CollocatedRequestHandler.cs
+++ b/cs/src/Ice/CollocatedRequestHandler.cs
@@ -264,7 +264,7 @@ namespace IceInternal
}
}
- @out.attachCollocatedObserver(requestId);
+ @out.attachCollocatedObserver(_adapter, requestId);
if(_reference.getInvocationTimeout() > 0)
{
@@ -304,7 +304,7 @@ namespace IceInternal
}
}
- outAsync.attachCollocatedObserver__(requestId);
+ outAsync.attachCollocatedObserver__(_adapter, requestId);
_adapter.getThreadPool().dispatch(
delegate()
@@ -352,7 +352,7 @@ namespace IceInternal
}
}
- @out.attachCollocatedObserver(0);
+ @out.attachCollocatedObserver(_adapter, 0);
if(invokeNum > 0)
{
@@ -412,7 +412,7 @@ namespace IceInternal
}
}
- outAsync.attachCollocatedObserver__(0);
+ outAsync.attachCollocatedObserver__(_adapter, 0);
if(invokeNum > 0)
{
diff --git a/cs/src/Ice/InstrumentationI.cs b/cs/src/Ice/InstrumentationI.cs
index 8706c521cfc..02e0e295a55 100644
--- a/cs/src/Ice/InstrumentationI.cs
+++ b/cs/src/Ice/InstrumentationI.cs
@@ -748,9 +748,9 @@ namespace IceInternal
private Ice.EndpointInfo _endpointInfo;
};
- public class CollocatedInvocationHelper : MetricsHelper<RemoteMetrics>
+ public class CollocatedInvocationHelper : MetricsHelper<CollocatedMetrics>
{
- class AttributeResolverI : MetricsHelper<RemoteMetrics>.AttributeResolver
+ class AttributeResolverI : MetricsHelper<CollocatedMetrics>.AttributeResolver
{
public AttributeResolverI()
{
@@ -769,24 +769,21 @@ namespace IceInternal
};
static AttributeResolver _attributes = new AttributeResolverI();
- public CollocatedInvocationHelper(int requestId, int size) :
+ public CollocatedInvocationHelper(Ice.ObjectAdapter adapter, int requestId, int size) :
base(_attributes)
{
+ _id = adapter.getName();
_requestId = requestId;
_size = size;
}
- override public void initMetrics(RemoteMetrics v)
+ override public void initMetrics(CollocatedMetrics v)
{
v.size += _size;
}
public string getId()
{
- if(_id == null)
- {
- _id = _requestId.ToString();
- }
return _id;
}
@@ -802,7 +799,7 @@ namespace IceInternal
readonly private int _size;
readonly private int _requestId;
- private string _id;
+ readonly private string _id;
};
public class ObserverWithDelegateI : ObserverWithDelegate<Metrics, Ice.Instrumentation.Observer>
@@ -891,6 +888,21 @@ namespace IceInternal
}
}
+ public class CollocatedObserverI : ObserverWithDelegate<CollocatedMetrics, Ice.Instrumentation.CollocatedObserver>,
+ Ice.Instrumentation.CollocatedObserver
+ {
+ public void reply(int size)
+ {
+ forEach((CollocatedMetrics v) => {
+ v.replySize += size;
+ });
+ if(delegate_ != null)
+ {
+ delegate_.reply(size);
+ }
+ }
+ }
+
public class InvocationObserverI : ObserverWithDelegate<InvocationMetrics, Ice.Instrumentation.InvocationObserver>,
Ice.Instrumentation.InvocationObserver
{
@@ -928,16 +940,18 @@ namespace IceInternal
del);
}
- public Ice.Instrumentation.RemoteObserver getCollocatedObserver(int requestId, int size)
+ public Ice.Instrumentation.CollocatedObserver getCollocatedObserver(Ice.ObjectAdapter adapter,
+ int requestId,
+ int size)
{
- Ice.Instrumentation.RemoteObserver del = null;
+ Ice.Instrumentation.CollocatedObserver del = null;
if(delegate_ != null)
{
- del = delegate_.getCollocatedObserver(requestId, size);
+ del = delegate_.getCollocatedObserver(adapter, requestId, size);
}
- return getObserver<RemoteMetrics, RemoteObserverI,
- Ice.Instrumentation.RemoteObserver>("Remote",
- new CollocatedInvocationHelper(requestId, size),
+ return getObserver<CollocatedMetrics, CollocatedObserverI,
+ Ice.Instrumentation.CollocatedObserver>("Collocated",
+ new CollocatedInvocationHelper(adapter, requestId, size),
del);
}
@@ -1028,7 +1042,9 @@ namespace IceInternal
try
{
- _invocations.registerSubMap<RemoteMetrics>("Remote", typeof(InvocationMetrics).GetField("remotes"));
+ Type cl = typeof(InvocationMetrics);
+ _invocations.registerSubMap<RemoteMetrics>("Remote", cl.GetField("remotes"));
+ _invocations.registerSubMap<CollocatedMetrics>("Collocated", cl.GetField("collocated"));
}
catch(Exception)
{
diff --git a/cs/src/Ice/Outgoing.cs b/cs/src/Ice/Outgoing.cs
index 9781d48c2ef..48f333c879c 100644
--- a/cs/src/Ice/Outgoing.cs
+++ b/cs/src/Ice/Outgoing.cs
@@ -245,10 +245,10 @@ namespace IceInternal
{
if(_proxy.reference__().getMode() != Reference.Mode.ModeTwoway)
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.detach();
+ _childObserver = null;
}
_state = StateOK;
}
@@ -270,11 +270,11 @@ namespace IceInternal
Debug.Assert(_state <= StateInProgress);
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.reply(istr.size() - Protocol.headerSize - 4);
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.reply(istr.size() - Protocol.headerSize - 4);
+ _childObserver.detach();
+ _childObserver = null;
}
if(_is == null)
@@ -437,11 +437,11 @@ namespace IceInternal
_m.Notify();
}
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
+ _childObserver = null;
}
_state = StateFailed;
_exception = ex;
@@ -531,22 +531,23 @@ namespace IceInternal
{
if(_observer != null)
{
- _remoteObserver = _observer.getRemoteObserver(info, endpt, requestId, sz);
- if(_remoteObserver != null)
+ _childObserver = _observer.getRemoteObserver(info, endpt, requestId, sz);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
- public void attachCollocatedObserver(int requestId)
+ public void attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId)
{
if(_observer != null)
{
- _remoteObserver = _observer.getCollocatedObserver(requestId, _os.size() - Protocol.headerSize - 4);
- if(_remoteObserver != null)
+ _childObserver = _observer.getCollocatedObserver(adapter, requestId,
+ _os.size() - Protocol.headerSize - 4);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
@@ -669,7 +670,7 @@ namespace IceInternal
private int _state;
private InvocationObserver _observer;
- private RemoteObserver _remoteObserver;
+ private ChildInvocationObserver _childObserver;
private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
@@ -826,10 +827,10 @@ namespace IceInternal
_m.Lock();
try
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.detach();
+ _childObserver = null;
}
_sent = true;
_m.Notify();
@@ -843,10 +844,10 @@ namespace IceInternal
public void finished(Ice.Exception ex, bool sent)
{
_m.Lock();
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
}
try
{
@@ -868,22 +869,23 @@ namespace IceInternal
{
if(_observer != null)
{
- _remoteObserver = _observer.getRemoteObserver(info, endpt, 0, size);
- if(_remoteObserver != null)
+ _childObserver = _observer.getRemoteObserver(info, endpt, 0, size);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
- public void attachCollocatedObserver(int requestId)
+ public void attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId)
{
if(_observer != null)
{
- _remoteObserver = _observer.getCollocatedObserver(requestId, _os.size() - Protocol.headerSize - 4);
- if(_remoteObserver != null)
+ _childObserver = _observer.getCollocatedObserver(adapter, requestId,
+ _os.size() - Protocol.headerSize - 4);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
@@ -895,7 +897,7 @@ namespace IceInternal
private Ice.Exception _exception;
private InvocationObserver _observer;
- private Observer _remoteObserver;
+ private Observer _childObserver;
private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs
index 41ea2aae602..e06d04e389f 100644
--- a/cs/src/Ice/OutgoingAsync.cs
+++ b/cs/src/Ice/OutgoingAsync.cs
@@ -540,23 +540,24 @@ namespace IceInternal
{
if(observer_ != null)
{
- remoteObserver_ = observer_.getRemoteObserver(info, endpt, requestId, sz);
- if(remoteObserver_ != null)
+ childObserver_ = observer_.getRemoteObserver(info, endpt, requestId, sz);
+ if(childObserver_ != null)
{
- remoteObserver_.attach();
+ childObserver_.attach();
}
}
}
- virtual public void attachCollocatedObserver__(int requestId)
+ virtual public void attachCollocatedObserver__(Ice.ObjectAdapter adapter, int requestId)
{
if(observer_ != null)
{
- remoteObserver_ = observer_.getCollocatedObserver(requestId,
+ childObserver_ = observer_.getCollocatedObserver(adapter,
+ requestId,
os_.size() - IceInternal.Protocol.headerSize - 4);
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.attach();
+ childObserver_.attach();
}
}
}
@@ -831,7 +832,7 @@ namespace IceInternal
protected EventWaitHandle waitHandle_;
protected Ice.Instrumentation.InvocationObserver observer_;
- protected Ice.Instrumentation.RemoteObserver remoteObserver_;
+ protected Ice.Instrumentation.ChildInvocationObserver childObserver_;
protected Ice.AsyncCallback completedCallback_;
protected Ice.AsyncCallback sentCallback_;
@@ -950,10 +951,10 @@ namespace IceInternal
Debug.Assert((state_ & Done) == 0);
if(!proxy_.ice_isTwoway())
{
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.detach();
- remoteObserver_ = null;
+ childObserver_.detach();
+ childObserver_ = null;
}
if(timeoutRequestHandler_ != null)
{
@@ -987,11 +988,11 @@ namespace IceInternal
try
{
Debug.Assert((state_ & Done) == 0);
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.failed(exc.ice_name());
- remoteObserver_.detach();
- remoteObserver_ = null;
+ childObserver_.failed(exc.ice_name());
+ childObserver_.detach();
+ childObserver_ = null;
}
if(timeoutRequestHandler_ != null)
{
@@ -1038,11 +1039,11 @@ namespace IceInternal
Debug.Assert(exception_ == null && (state_ & Done) == 0);
Debug.Assert(is_ != null);
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.reply(is_.size() - Protocol.headerSize - 4);
- remoteObserver_.detach();
- remoteObserver_ = null;
+ childObserver_.reply(is_.size() - Protocol.headerSize - 4);
+ childObserver_.detach();
+ childObserver_ = null;
}
if(timeoutRequestHandler_ != null)
@@ -1557,10 +1558,10 @@ namespace IceInternal
Debug.Assert((state_ & (Done | OK | Sent)) == 0);
state_ |= (Done | OK | Sent);
//_os.resize(0, false); // Don't clear the buffer now, it's needed for the collocation optimization
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.detach();
- remoteObserver_ = null;
+ childObserver_.detach();
+ childObserver_ = null;
}
if(timeoutRequestHandler_ != null)
{
@@ -1587,11 +1588,11 @@ namespace IceInternal
virtual public void finished__(Ice.Exception exc, bool sent)
{
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.failed(exc.ice_name());
- remoteObserver_.detach();
- remoteObserver_ = null;
+ childObserver_.failed(exc.ice_name());
+ childObserver_.detach();
+ childObserver_ = null;
}
if(timeoutRequestHandler_ != null)
{
@@ -1817,10 +1818,10 @@ namespace IceInternal
override public Ice.AsyncCallback sent__()
{
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.detach();
- remoteObserver_ = null;
+ childObserver_.detach();
+ childObserver_ = null;
}
_outAsync.check(false);
return null;
@@ -1828,11 +1829,11 @@ namespace IceInternal
override public void finished__(Ice.Exception ex, bool sent)
{
- if(remoteObserver_ != null)
+ if(childObserver_ != null)
{
- remoteObserver_.failed(ex.ice_name());
- remoteObserver_.detach();
- remoteObserver_ = null;
+ childObserver_.failed(ex.ice_name());
+ childObserver_.detach();
+ childObserver_ = null;
}
_outAsync.check(false);
}
@@ -1842,10 +1843,10 @@ namespace IceInternal
{
if(_outAsync.observer_ != null)
{
- remoteObserver_ = _outAsync.observer_.getRemoteObserver(info, endpt, requestId, sz);
- if(remoteObserver_ != null)
+ childObserver_ = _outAsync.observer_.getRemoteObserver(info, endpt, requestId, sz);
+ if(childObserver_ != null)
{
- remoteObserver_.attach();
+ childObserver_.attach();
}
}
}
diff --git a/cs/test/Ice/metrics/AllTests.cs b/cs/test/Ice/metrics/AllTests.cs
index d010705e899..a3bd5467385 100644
--- a/cs/test/Ice/metrics/AllTests.cs
+++ b/cs/test/Ice/metrics/AllTests.cs
@@ -317,8 +317,24 @@ public class AllTests : TestCommon.TestApp
Dictionary<string, string> props,
string map)
{
- cprops.setProperties(getClientProps(cprops, props, map));
- sprops.setProperties(getServerProps(sprops, props, map));
+ if(sprops.ice_getConnection() != null)
+ {
+ cprops.setProperties(getClientProps(cprops, props, map));
+ sprops.setProperties(getServerProps(sprops, props, map));
+ }
+ else
+ {
+ Dictionary<string, string> clientProps = getClientProps(cprops, props, map);
+ Dictionary<string, string> serverProps = getClientProps(sprops, props, map);
+ foreach(KeyValuePair<string, string> p in clientProps)
+ {
+ if(!serverProps.ContainsKey(p.Key))
+ {
+ serverProps.Add(p.Key, p.Value);
+ }
+ }
+ cprops.setProperties(serverProps);
+ }
callback.waitForUpdate();
}
@@ -383,7 +399,8 @@ public class AllTests : TestCommon.TestApp
#endif
{
MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010"));
-
+ bool collocated = metrics.ice_getConnection() == null;
+
Write("testing metrics admin facet checkedCast... ");
Flush();
Ice.ObjectPrx admin = communicator.getAdmin();
@@ -410,7 +427,11 @@ public class AllTests : TestCommon.TestApp
updateProps(clientProps, serverProps, update, props, "");
long timestamp;
Dictionary<string, IceMX.Metrics[]> view = clientMetrics.getMetricsView("View", out timestamp);
- test(view["Connection"].Length == 1 && view["Connection"][0].current == 1 && view["Connection"][0].total == 1);
+ if(!collocated)
+ {
+ test(view["Connection"].Length == 1 && view["Connection"][0].current == 1 &&
+ view["Connection"][0].total == 1);
+ }
test(view["Thread"].Length == 1 && view["Thread"][0].current == 4 && view["Thread"][0].total == 4);
WriteLine("ok");
@@ -428,308 +449,328 @@ public class AllTests : TestCommon.TestApp
view = clientMetrics.getMetricsView("View", out timestamp);
test(view["Thread"].Length == 4);
- test(view["Connection"].Length == 2);
+ if(!collocated)
+ {
+ test(view["Connection"].Length == 2);
+ }
test(view["Invocation"].Length == 1);
IceMX.InvocationMetrics invoke = (IceMX.InvocationMetrics)view["Invocation"][0];
test(invoke.id.IndexOf("[ice_ping]") > 0 && invoke.current == 0 && invoke.total == 5);
- test(invoke.remotes.Length == 2);
- test(invoke.remotes[0].total >= 2 && invoke.remotes[1].total >= 2);
- test((invoke.remotes[0].total + invoke.remotes[1].total) == 5);
+ if(!collocated)
+ {
+ test(invoke.remotes.Length == 2);
+ test(invoke.remotes[0].total >= 2 && invoke.remotes[1].total >= 2);
+ test((invoke.remotes[0].total + invoke.remotes[1].total) == 5);
+ }
+ else
+ {
+ test(invoke.collocated.Length == 1);
+ test(invoke.collocated[0].total == 5);
+ }
view = serverMetrics.getMetricsView("View", out timestamp);
// With Ice for .NET, a new dispatching thread isn't necessarily created.
//test(view["Thread"].Length > 4);
- test(view["Connection"].Length == 2);
+ if(!collocated)
+ {
+ test(view["Connection"].Length == 2);
+ }
test(view["Dispatch"].Length == 1);
test(view["Dispatch"][0].current <= 1 && view["Dispatch"][0].total == 5);
test(view["Dispatch"][0].id.IndexOf("[ice_ping]") > 0);
- metrics.ice_getConnection().close(false);
- metrics.ice_connectionId("Con1").ice_getConnection().close(false);
+ if(!collocated)
+ {
+ metrics.ice_getConnection().close(false);
+ metrics.ice_connectionId("Con1").ice_getConnection().close(false);
- waitForCurrent(clientMetrics, "View", "Connection", 0);
- waitForCurrent(serverMetrics, "View", "Connection", 0);
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
+ }
clearView(clientProps, serverProps, update);
WriteLine("ok");
- Write("testing connection metrics... ");
- Flush();
+ Dictionary<string, IceMX.Metrics> map;
- props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
- updateProps(clientProps, serverProps, update, props, "Connection");
+ if(!collocated)
+ {
+ Write("testing connection metrics... ");
+ Flush();
+
+ props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
+ updateProps(clientProps, serverProps, update, props, "Connection");
- test(clientMetrics.getMetricsView("View", out timestamp)["Connection"].Length == 0);
- test(serverMetrics.getMetricsView("View", out timestamp)["Connection"].Length == 0);
+ test(clientMetrics.getMetricsView("View", out timestamp)["Connection"].Length == 0);
+ test(serverMetrics.getMetricsView("View", out timestamp)["Connection"].Length == 0);
- metrics.ice_ping();
+ metrics.ice_ping();
- IceMX.ConnectionMetrics cm1, sm1, cm2, sm2;
- cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
- sm1 = getServerConnectionMetrics(serverMetrics, 25);
+ IceMX.ConnectionMetrics cm1, sm1, cm2, sm2;
+ cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
+ sm1 = getServerConnectionMetrics(serverMetrics, 25);
- metrics.ice_ping();
+ metrics.ice_ping();
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
- sm2 = getServerConnectionMetrics(serverMetrics, 50);
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
+ sm2 = getServerConnectionMetrics(serverMetrics, 50);
- test(cm2.sentBytes - cm1.sentBytes == 45); // 45 for ice_ping request
- test(cm2.receivedBytes - cm1.receivedBytes == 25); // 25 bytes for ice_ping response
- test(sm2.receivedBytes - sm1.receivedBytes == 45);
- test(sm2.sentBytes - sm1.sentBytes == 25);
+ test(cm2.sentBytes - cm1.sentBytes == 45); // 45 for ice_ping request
+ test(cm2.receivedBytes - cm1.receivedBytes == 25); // 25 bytes for ice_ping response
+ test(sm2.receivedBytes - sm1.receivedBytes == 45);
+ test(sm2.sentBytes - sm1.sentBytes == 25);
- cm1 = cm2;
- sm1 = sm2;
+ cm1 = cm2;
+ sm1 = sm2;
- byte[] bs = new byte[0];
- metrics.opByteS(bs);
+ byte[] bs = new byte[0];
+ metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
- sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + cm2.receivedBytes - cm1.receivedBytes);
- long requestSz = cm2.sentBytes - cm1.sentBytes;
- long replySz = cm2.receivedBytes - cm1.receivedBytes;
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + cm2.receivedBytes - cm1.receivedBytes);
+ long requestSz = cm2.sentBytes - cm1.sentBytes;
+ long replySz = cm2.receivedBytes - cm1.receivedBytes;
- cm1 = cm2;
- sm1 = sm2;
+ cm1 = cm2;
+ sm1 = sm2;
- bs = new byte[456];
- metrics.opByteS(bs);
+ bs = new byte[456];
+ metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
- sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
- test(cm2.sentBytes - cm1.sentBytes == requestSz + bs.Length + 4); // 4 is for the seq variable size
- test(cm2.receivedBytes - cm1.receivedBytes == replySz);
- test(sm2.receivedBytes - sm1.receivedBytes == requestSz + bs.Length + 4);
- test(sm2.sentBytes - sm1.sentBytes == replySz);
+ test(cm2.sentBytes - cm1.sentBytes == requestSz + bs.Length + 4); // 4 is for the seq variable size
+ test(cm2.receivedBytes - cm1.receivedBytes == replySz);
+ test(sm2.receivedBytes - sm1.receivedBytes == requestSz + bs.Length + 4);
+ test(sm2.sentBytes - sm1.sentBytes == replySz);
- cm1 = cm2;
- sm1 = sm2;
+ cm1 = cm2;
+ sm1 = sm2;
- bs = new byte[1024 * 1024 * 10]; // Try with large amount of data which should be sent in several chunks
- metrics.opByteS(bs);
+ bs = new byte[1024 * 1024 * 10]; // Try with large amount of data which should be sent in several chunks
+ metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
- sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
- test((cm2.sentBytes - cm1.sentBytes) == (requestSz + bs.Length + 4)); // 4 is for the seq variable size
- test((cm2.receivedBytes - cm1.receivedBytes) == replySz);
- test((sm2.receivedBytes - sm1.receivedBytes) == (requestSz + bs.Length + 4));
- test((sm2.sentBytes - sm1.sentBytes) == replySz);
+ test((cm2.sentBytes - cm1.sentBytes) == (requestSz + bs.Length + 4)); // 4 is for the seq variable size
+ test((cm2.receivedBytes - cm1.receivedBytes) == replySz);
+ test((sm2.receivedBytes - sm1.receivedBytes) == (requestSz + bs.Length + 4));
+ test((sm2.sentBytes - sm1.sentBytes) == replySz);
- props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "state";
- updateProps(clientProps, serverProps, update, props, "Connection");
+ props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "state";
+ updateProps(clientProps, serverProps, update, props, "Connection");
- Dictionary<string, IceMX.Metrics> map =
- toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
+ map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
- test(map["active"].current == 1);
+ test(map["active"].current == 1);
- ControllerPrx controller = ControllerPrxHelper.checkedCast(
- communicator.stringToProxy("controller:default -p 12011"));
- controller.hold();
+ ControllerPrx controller = ControllerPrxHelper.checkedCast(
+ communicator.stringToProxy("controller:default -p 12011"));
+ controller.hold();
- map = toMap(clientMetrics.getMetricsView("View", out timestamp)["Connection"]);
- test(map["active"].current == 1);
- map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
- test(map["holding"].current == 1);
+ map = toMap(clientMetrics.getMetricsView("View", out timestamp)["Connection"]);
+ test(map["active"].current == 1);
+ map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
+ test(map["holding"].current == 1);
- metrics.ice_getConnection().close(false);
+ metrics.ice_getConnection().close(false);
- map = toMap(clientMetrics.getMetricsView("View", out timestamp)["Connection"]);
- test(map["closing"].current == 1);
- map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
- test(map["holding"].current == 1);
+ map = toMap(clientMetrics.getMetricsView("View", out timestamp)["Connection"]);
+ test(map["closing"].current == 1);
+ map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
+ test(map["holding"].current == 1);
- controller.resume();
+ controller.resume();
- map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
- test(map["holding"].current == 0);
+ map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Connection"]);
+ test(map["holding"].current == 0);
- props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
- updateProps(clientProps, serverProps, update, props, "Connection");
+ props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
+ updateProps(clientProps, serverProps, update, props, "Connection");
- metrics.ice_getConnection().close(false);
+ metrics.ice_getConnection().close(false);
- metrics.ice_timeout(500).ice_ping();
- controller.hold();
- try
- {
- ((MetricsPrx)metrics.ice_timeout(500)).opByteS(new byte[10000000]);
- test(false);
- }
- catch(Ice.TimeoutException)
- {
- }
- controller.resume();
+ metrics.ice_timeout(500).ice_ping();
+ controller.hold();
+ try
+ {
+ ((MetricsPrx)metrics.ice_timeout(500)).opByteS(new byte[10000000]);
+ test(false);
+ }
+ catch(Ice.TimeoutException)
+ {
+ }
+ controller.resume();
- cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
- while(true)
- {
- sm1 = (IceMX.ConnectionMetrics)serverMetrics.getMetricsView("View", out timestamp)["Connection"][0];
- if(sm1.failures >= 2)
+ cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", out timestamp)["Connection"][0];
+ while(true)
{
- break;
+ sm1 = (IceMX.ConnectionMetrics)serverMetrics.getMetricsView("View", out timestamp)["Connection"][0];
+ if(sm1.failures >= 2)
+ {
+ break;
+ }
+ System.Threading.Thread.Sleep(10);
}
- System.Threading.Thread.Sleep(10);
- }
- test(cm1.failures == 2 && sm1.failures >= 2);
-
- checkFailure(clientMetrics, "Connection", cm1.id, "Ice::TimeoutException", 1);
- checkFailure(clientMetrics, "Connection", cm1.id, "Ice::ConnectTimeoutException", 1);
- checkFailure(serverMetrics, "Connection", sm1.id, "Ice::ConnectionLostException", 0);
-
- MetricsPrx m = (MetricsPrx)metrics.ice_timeout(500).ice_connectionId("Con1");
- m.ice_ping();
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator");
- //testAttribute(clientMetrics, clientProps, update, "Connection", "id", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint",
- "tcp -h 127.0.0.1 -p 12010 -t 500");
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "False");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "False");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "False");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010");
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "False");
- testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1");
- //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010");
- testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "");
+ test(cm1.failures == 2 && sm1.failures >= 2);
+
+ checkFailure(clientMetrics, "Connection", cm1.id, "Ice::TimeoutException", 1);
+ checkFailure(clientMetrics, "Connection", cm1.id, "Ice::ConnectTimeoutException", 1);
+ checkFailure(serverMetrics, "Connection", sm1.id, "Ice::ConnectionLostException", 0);
+
+ MetricsPrx m = (MetricsPrx)metrics.ice_timeout(500).ice_connectionId("Con1");
+ m.ice_ping();
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator");
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "id", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint",
+ "tcp -h 127.0.0.1 -p 12010 -t 500");
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "False");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "False");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "False");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010");
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "False");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1");
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "");
- m.ice_getConnection().close(false);
+ m.ice_getConnection().close(false);
- waitForCurrent(clientMetrics, "View", "Connection", 0);
- waitForCurrent(serverMetrics, "View", "Connection", 0);
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
- WriteLine("ok");
+ WriteLine("ok");
- Write("testing connection establishment metrics... ");
- Flush();
+ Write("testing connection establishment metrics... ");
+ Flush();
- props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
- updateProps(clientProps, serverProps, update, props, "ConnectionEstablishment");
- test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 0);
+ props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
+ updateProps(clientProps, serverProps, update, props, "ConnectionEstablishment");
+ test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 0);
- metrics.ice_ping();
+ metrics.ice_ping();
- test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1);
- IceMX.Metrics m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0];
- test(m1.current == 0 && m1.total == 1 && m1.id.Equals("127.0.0.1:12010"));
+ test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1);
+ IceMX.Metrics m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0];
+ test(m1.current == 0 && m1.total == 1 && m1.id.Equals("127.0.0.1:12010"));
- metrics.ice_getConnection().close(false);
- controller.hold();
- try
- {
- communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping();
- test(false);
- }
- catch(Ice.ConnectTimeoutException)
- {
- }
- catch(Ice.LocalException)
- {
- test(false);
- }
- controller.resume();
- test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1);
- m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0];
- test(m1.id.Equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2);
+ metrics.ice_getConnection().close(false);
+ controller.hold();
+ try
+ {
+ communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectTimeoutException)
+ {
+ }
+ catch(Ice.LocalException)
+ {
+ test(false);
+ }
+ controller.resume();
+ test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1);
+ m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0];
+ test(m1.id.Equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2);
- checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "Ice::ConnectTimeoutException", 2);
+ checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "Ice::ConnectTimeoutException", 2);
#if COMPACT
- Ice.VoidAction c = () => { connect(metrics); };
+ Ice.VoidAction c = () => { connect(metrics); };
#else
- System.Action c = () => { connect(metrics); };
+ System.Action c = () => { connect(metrics); };
#endif
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
- "tcp -h 127.0.0.1 -p 12010", c);
-
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "False", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "False", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "False", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c);
-
- WriteLine("ok");
-
- Write("testing endpoint lookup metrics... ");
- Flush();
-
- props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
- updateProps(clientProps, serverProps, update, props, "EndpointLookup");
- test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 0);
-
- Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost");
- prx.ice_ping();
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
+ "tcp -h 127.0.0.1 -p 12010", c);
+
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "False", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "False", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "False", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c);
+
+ WriteLine("ok");
+
+ Write("testing endpoint lookup metrics... ");
+ Flush();
+
+ props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
+ updateProps(clientProps, serverProps, update, props, "EndpointLookup");
+ test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 0);
+
+ Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost");
+ prx.ice_ping();
- test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 1);
- m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0];
- test(m1.current <= 1 && m1.total == 1 && m1.id.Equals("tcp -h localhost -p 12010"));
+ test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 1);
+ m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0];
+ test(m1.current <= 1 && m1.total == 1 && m1.id.Equals("tcp -h localhost -p 12010"));
- prx.ice_getConnection().close(false);
+ prx.ice_getConnection().close(false);
- bool dnsException = false;
- try
- {
- communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping();
- test(false);
- }
- catch(Ice.DNSException)
- {
- dnsException = true;
- }
- catch(Ice.LocalException)
- {
- // Some DNS servers don't fail on unknown DNS names.
- }
- test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 2);
- m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0];
- if(!m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500"))
- {
- m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][1];
- }
- test(m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 &&
- (!dnsException || m1.failures == 2));
- if(dnsException)
- {
- checkFailure(clientMetrics, "EndpointLookup", m1.id, "Ice::DNSException", 2);
- }
-
- c = () => { connect(prx); };
+ bool dnsException = false;
+ try
+ {
+ communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping();
+ test(false);
+ }
+ catch(Ice.DNSException)
+ {
+ dnsException = true;
+ }
+ catch(Ice.LocalException)
+ {
+ // Some DNS servers don't fail on unknown DNS names.
+ }
+ test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 2);
+ m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0];
+ if(!m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500"))
+ {
+ m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][1];
+ }
+ test(m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 &&
+ (!dnsException || m1.failures == 2));
+ if(dnsException)
+ {
+ checkFailure(clientMetrics, "EndpointLookup", m1.id, "Ice::DNSException", 2);
+ }
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010",
- c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint",
- "tcp -h localhost -p 12010", c);
+ c = () => { connect(prx); };
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "False", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "False", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "False", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010",
+ c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint",
+ "tcp -h localhost -p 12010", c);
- WriteLine("ok");
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "False", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "False", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "False", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c);
+ WriteLine("ok");
+ }
Write("testing dispatch metrics... ");
Flush();
@@ -770,17 +811,20 @@ public class AllTests : TestCommon.TestApp
catch(Ice.UnknownException)
{
}
- try
- {
- metrics.fail();
- test(false);
- }
- catch(Ice.ConnectionLostException)
+ if(!collocated)
{
+ try
+ {
+ metrics.fail();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException)
+ {
+ }
}
map = toMap(serverMetrics.getMetricsView("View", out timestamp)["Dispatch"]);
- test(map.Count == 6);
+ test(!collocated ? map.Count == 6 : map.Count == 5);
IceMX.DispatchMetrics dm1;
dm1 = (IceMX.DispatchMetrics)map["op"];
@@ -814,37 +858,41 @@ public class AllTests : TestCommon.TestApp
testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint",
- "tcp -h 127.0.0.1 -p 12010", op);
- //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op);
-
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "False", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "False", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "False", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op);
-
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "True", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op);
- //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op);
+ if(!collocated)
+ {
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint",
+ "tcp -h 127.0.0.1 -p 12010", op);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "False", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "False", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "False", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "True", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op);
+ }
+
testAttribute(serverMetrics, serverProps, update, "Dispatch", "operation", "op", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "identity", "metrics", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "facet", "", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "mode", "twoway", op);
-
+
testAttribute(serverMetrics, serverProps, update, "Dispatch", "context.entry1", "test", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "context.entry2", "", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "context.entry3", "", op);
-
+
WriteLine("ok");
Write("testing invocation metrics... ");
@@ -852,6 +900,7 @@ public class AllTests : TestCommon.TestApp
props["IceMX.Metrics.View.Map.Invocation.GroupBy"] = "operation";
props["IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy"] = "localPort";
+ props["IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy"] = "id";
updateProps(clientProps, serverProps, update, props, "Invocation");
test(serverMetrics.getMetricsView("View", out timestamp)["Invocation"].Length == 0);
@@ -938,73 +987,84 @@ public class AllTests : TestCommon.TestApp
metrics.begin_opWithUnknownException().whenCompleted(cb.response, cb.exception);
cb.waitForResponse();
- try
- {
- metrics.fail();
- test(false);
- }
- catch(Ice.ConnectionLostException)
- {
- }
- try
- {
- metrics.end_fail(metrics.begin_fail());
- test(false);
- }
- catch(Ice.ConnectionLostException)
+ if(!collocated)
{
+ try
+ {
+ metrics.fail();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException)
+ {
+ }
+ try
+ {
+ metrics.end_fail(metrics.begin_fail());
+ test(false);
+ }
+ catch(Ice.ConnectionLostException)
+ {
+ }
+ metrics.begin_fail().whenCompleted(cb.response, cb.exception);
+ cb.waitForResponse();
}
- metrics.begin_fail().whenCompleted(cb.response, cb.exception);
- cb.waitForResponse();
map = toMap(clientMetrics.getMetricsView("View", out timestamp)["Invocation"]);
- test(map.Count == 6);
+ test(map.Count == (!collocated ? 6 : 5));
IceMX.InvocationMetrics im1;
- IceMX.RemoteMetrics rim1;
+ IceMX.ChildInvocationMetrics rim1;
im1 = (IceMX.InvocationMetrics)map["op"];
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0 && im1.remotes.Length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
+ test(!collocated ? im1.remotes.Length == 1 : im1.collocated.Length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 63 && rim1.replySize == 21);
im1 = (IceMX.InvocationMetrics)map["opWithUserException"];
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0 && im1.remotes.Length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
+ test(!collocated ? im1.remotes.Length == 1 : im1.collocated.Length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 114 && rim1.replySize == 69);
test(im1.userException == 3);
im1 = (IceMX.InvocationMetrics)map["opWithLocalException"];
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0 && im1.remotes.Length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.Length == 1 : im1.collocated.Length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 117 && rim1.replySize > 7);
checkFailure(clientMetrics, "Invocation", im1.id, "Ice::UnknownLocalException", 3);
im1 = (IceMX.InvocationMetrics)map["opWithRequestFailedException"];
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0 && im1.remotes.Length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.Length == 1 : im1.collocated.Length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 141 && rim1.replySize == 120);
checkFailure(clientMetrics, "Invocation", im1.id, "Ice::ObjectNotExistException", 3);
im1 = (IceMX.InvocationMetrics)map["opWithUnknownException"];
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0 && im1.remotes.Length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.Length == 1 : im1.collocated.Length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 123 && rim1.replySize > 7);
checkFailure(clientMetrics, "Invocation", im1.id, "Ice::UnknownException", 3);
- im1 = (IceMX.InvocationMetrics)map["fail"];
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.Length == 6);
- test(im1.remotes[0].current == 0 && im1.remotes[0].total == 1 && im1.remotes[0].failures == 1);
- test(im1.remotes[1].current == 0 && im1.remotes[1].total == 1 && im1.remotes[1].failures == 1);
- test(im1.remotes[2].current == 0 && im1.remotes[2].total == 1 && im1.remotes[2].failures == 1);
- test(im1.remotes[3].current == 0 && im1.remotes[3].total == 1 && im1.remotes[3].failures == 1);
- test(im1.remotes[4].current == 0 && im1.remotes[4].total == 1 && im1.remotes[4].failures == 1);
- test(im1.remotes[5].current == 0 && im1.remotes[5].total == 1 && im1.remotes[5].failures == 1);
- checkFailure(clientMetrics, "Invocation", im1.id, "Ice::ConnectionLostException", 3);
+ if(!collocated)
+ {
+ im1 = (IceMX.InvocationMetrics)map["fail"];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.Length == 6);
+ test(im1.remotes[0].current == 0 && im1.remotes[0].total == 1 && im1.remotes[0].failures == 1);
+ test(im1.remotes[1].current == 0 && im1.remotes[1].total == 1 && im1.remotes[1].failures == 1);
+ test(im1.remotes[2].current == 0 && im1.remotes[2].total == 1 && im1.remotes[2].failures == 1);
+ test(im1.remotes[3].current == 0 && im1.remotes[3].total == 1 && im1.remotes[3].failures == 1);
+ test(im1.remotes[4].current == 0 && im1.remotes[4].total == 1 && im1.remotes[4].failures == 1);
+ test(im1.remotes[5].current == 0 && im1.remotes[5].total == 1 && im1.remotes[5].failures == 1);
+ checkFailure(clientMetrics, "Invocation", im1.id, "Ice::ConnectionLostException", 3);
+ }
testAttribute(clientMetrics, clientProps, update, "Invocation", "parent", "Communicator", op);
testAttribute(clientMetrics, clientProps, update, "Invocation", "id", "metrics -t -e 1.1 [op]", op);
@@ -1060,34 +1120,60 @@ public class AllTests : TestCommon.TestApp
Flush();
test(obsv.threadObserver.getTotal() > 0);
- test(obsv.connectionObserver.getTotal() > 0);
- test(obsv.connectionEstablishmentObserver.getTotal() > 0);
- test(obsv.endpointLookupObserver.getTotal() > 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getTotal() > 0);
+ test(obsv.connectionEstablishmentObserver.getTotal() > 0);
+ test(obsv.endpointLookupObserver.getTotal() > 0);
+ test(obsv.invocationObserver.remoteObserver.getTotal() > 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.getTotal() > 0);
+ }
+
test(obsv.dispatchObserver.getTotal() > 0);
test(obsv.invocationObserver.getTotal() > 0);
- test(obsv.invocationObserver.remoteObserver.getTotal() > 0);
test(obsv.threadObserver.getCurrent() > 0);
- test(obsv.connectionObserver.getCurrent() > 0);
- test(obsv.connectionEstablishmentObserver.getCurrent() == 0);
- test(obsv.endpointLookupObserver.getCurrent() == 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getCurrent() > 0);
+ test(obsv.connectionEstablishmentObserver.getCurrent() == 0);
+ test(obsv.endpointLookupObserver.getCurrent() == 0);
+ test(obsv.invocationObserver.remoteObserver.getCurrent() == 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.getCurrent() == 0);
+ }
test(obsv.dispatchObserver.getCurrent() == 0);
test(obsv.invocationObserver.getCurrent() == 0);
- test(obsv.invocationObserver.remoteObserver.getCurrent() == 0);
test(obsv.threadObserver.getFailedCount() == 0);
- test(obsv.connectionObserver.getFailedCount() > 0);
- test(obsv.connectionEstablishmentObserver.getFailedCount() > 0);
- test(obsv.endpointLookupObserver.getFailedCount() > 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getFailedCount() > 0);
+ test(obsv.connectionEstablishmentObserver.getFailedCount() > 0);
+ test(obsv.endpointLookupObserver.getFailedCount() > 0);
+ test(obsv.invocationObserver.remoteObserver.getFailedCount() > 0);
+ }
//test(obsv.dispatchObserver.getFailedCount() > 0);
test(obsv.invocationObserver.getFailedCount() > 0);
- test(obsv.invocationObserver.remoteObserver.getFailedCount() > 0);
- test(obsv.threadObserver.states > 0);
- test(obsv.connectionObserver.received > 0 && obsv.connectionObserver.sent > 0);
+ if(!collocated)
+ {
+ test(obsv.threadObserver.states > 0);
+ test(obsv.connectionObserver.received > 0 && obsv.connectionObserver.sent > 0);
+ test(obsv.invocationObserver.retriedCount > 0);
+ test(obsv.invocationObserver.remoteObserver.replySize > 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.replySize > 0);
+ }
//test(obsv.dispatchObserver.userExceptionCount > 0);
- test(obsv.invocationObserver.userExceptionCount > 0 && obsv.invocationObserver.retriedCount > 0);
- test(obsv.invocationObserver.remoteObserver.replySize > 0);
+ test(obsv.invocationObserver.userExceptionCount > 0);
WriteLine("ok");
diff --git a/cs/test/Ice/metrics/Collocated.cs b/cs/test/Ice/metrics/Collocated.cs
new file mode 100644
index 00000000000..5259afb5e50
--- /dev/null
+++ b/cs/test/Ice/metrics/Collocated.cs
@@ -0,0 +1,93 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 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.
+//
+// **********************************************************************
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Collocated
+{
+ private static int run(string[] args, Ice.Communicator communicator)
+ {
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MetricsI(), communicator.stringToIdentity("metrics"));
+ //adapter.activate();
+
+ communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), communicator.stringToIdentity("controller"));
+ //controllerAdapter.activate();
+
+ Test.MetricsPrx metrics = AllTests.allTests(communicator, _observer);
+ metrics.shutdown();
+ return 0;
+ }
+
+ public static int Main(string[] args)
+ {
+ int status = 0;
+ Ice.Communicator communicator = null;
+
+#if !COMPACT
+ Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
+
+ try
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(ref args);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ initData.properties.setProperty("Ice.FactoryAssemblies", "collocated");
+#endif
+ initData.observer = _observer;
+ communicator = Ice.Util.initialize(ref args, initData);
+ status = run(args, communicator);
+ }
+ catch(System.Exception ex)
+ {
+ Console.Error.WriteLine(ex);
+ status = 1;
+ }
+
+ if(communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ Console.Error.WriteLine(ex);
+ status = 1;
+ }
+ }
+
+ return status;
+ }
+
+ static CommunicatorObserverI _observer = new CommunicatorObserverI();
+}
diff --git a/cs/test/Ice/metrics/InstrumentationI.cs b/cs/test/Ice/metrics/InstrumentationI.cs
index e0d67432a04..28061dc9f65 100644
--- a/cs/test/Ice/metrics/InstrumentationI.cs
+++ b/cs/test/Ice/metrics/InstrumentationI.cs
@@ -84,7 +84,7 @@ public class ObserverI : Ice.Instrumentation.Observer
public int failedCount;
};
-public class RemoteObserverI : ObserverI, Ice.Instrumentation.RemoteObserver
+public class ChildInvocationObserverI : ObserverI, Ice.Instrumentation.ChildInvocationObserver
{
override public void
reset()
@@ -108,6 +108,14 @@ public class RemoteObserverI : ObserverI, Ice.Instrumentation.RemoteObserver
public int replySize;
};
+public class RemoteObserverI : ChildInvocationObserverI, Ice.Instrumentation.RemoteObserver
+{
+};
+
+public class CollocatedObserverI : ChildInvocationObserverI, Ice.Instrumentation.CollocatedObserver
+{
+};
+
public class InvocationObserverI : ObserverI , Ice.Instrumentation.InvocationObserver
{
override public void
@@ -122,6 +130,10 @@ public class InvocationObserverI : ObserverI , Ice.Instrumentation.InvocationObs
{
remoteObserver.reset();
}
+ if(collocatedObserver != null)
+ {
+ collocatedObserver.reset();
+ }
}
}
@@ -157,17 +169,17 @@ public class InvocationObserverI : ObserverI , Ice.Instrumentation.InvocationObs
}
}
- public Ice.Instrumentation.RemoteObserver
- getCollocatedObserver(int a, int b)
+ public Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(Ice.ObjectAdapter adapter, int a, int b)
{
lock(this)
{
- if(remoteObserver == null)
+ if(collocatedObserver == null)
{
- remoteObserver = new RemoteObserverI();
- remoteObserver.reset();
+ collocatedObserver = new CollocatedObserverI();
+ collocatedObserver.reset();
}
- return remoteObserver;
+ return collocatedObserver;
}
}
@@ -175,6 +187,7 @@ public class InvocationObserverI : ObserverI , Ice.Instrumentation.InvocationObs
public int retriedCount;
public RemoteObserverI remoteObserver = null;
+ public CollocatedObserverI collocatedObserver = null;
};
public class DispatchObserverI : ObserverI , Ice.Instrumentation.DispatchObserver
diff --git a/cs/test/Ice/metrics/Makefile b/cs/test/Ice/metrics/Makefile
index da6e2f60991..97194faa250 100644
--- a/cs/test/Ice/metrics/Makefile
+++ b/cs/test/Ice/metrics/Makefile
@@ -9,11 +9,12 @@
top_srcdir = ../../..
-TARGETS = client.exe server.exe serveramd.exe
+TARGETS = client.exe server.exe serveramd.exe collocated.exe
C_SRCS = AllTests.cs Client.cs InstrumentationI.cs ../../TestCommon/TestApp.cs
S_SRCS = MetricsI.cs Server.cs
SAMD_SRCS = MetricsAMDI.cs Server.cs
+COL_SRCS = AllTests.cs Collocated.cs InstrumentationI.cs ../../TestCommon/TestApp.cs MetricsI.cs
SLICE_SRCS = $(SDIR)/Test.ice
SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice
@@ -37,4 +38,7 @@ server.exe: $(S_SRCS) $(GEN_SRCS)
serveramd.exe: $(SAMD_SRCS) $(GEN_AMD_SRCS)
$(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^)
+collocated.exe: $(COL_SRCS) $(GEN_SRCS)
+ $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^)
+
include .depend
diff --git a/cs/test/Ice/metrics/Makefile.mak b/cs/test/Ice/metrics/Makefile.mak
index bb615d4b396..96bc4ef1b7b 100644
--- a/cs/test/Ice/metrics/Makefile.mak
+++ b/cs/test/Ice/metrics/Makefile.mak
@@ -9,11 +9,12 @@
top_srcdir = ..\..\..
-TARGETS = client.exe server.exe serveramd.exe
+TARGETS = client.exe server.exe serveramd.exe collocated.exe
C_SRCS = AllTests.cs Client.cs InstrumentationI.cs ..\..\TestCommon\TestApp.cs
S_SRCS = MetricsI.cs Server.cs
SAMD_SRCS = MetricsAMDI.cs Server.cs
+COL_SRCS = AllTests.cs Collocated.cs InstrumentationI.cs ..\..\TestCommon\TestApp.cs MetricsI.cs
GEN_SRCS = $(GDIR)\Test.cs
GEN_AMD_SRCS = $(GDIR)\TestAMD.cs
@@ -35,4 +36,7 @@ server.exe: $(S_SRCS) $(GEN_SRCS)
serveramd.exe: $(SAMD_SRCS) $(GEN_AMD_SRCS)
$(MCS) $(MCSFLAGS) -out:$@ -r:"$(refdir)\Ice.dll" $(SAMD_SRCS) $(GEN_AMD_SRCS)
+collocated.exe: $(COL_SRCS) $(GEN_SRCS)
+ $(MCS) $(MCSFLAGS) -out:$@ -r:"$(refdir)\Ice.dll" $(COL_SRCS) $(GEN_SRCS)
+
!include .depend.mak
diff --git a/cs/test/Ice/metrics/collocated.exe.config b/cs/test/Ice/metrics/collocated.exe.config
new file mode 100644
index 00000000000..d3fa65b4563
--- /dev/null
+++ b/cs/test/Ice/metrics/collocated.exe.config
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<configuration>
+ <runtime>
+ <developmentMode developerInstallation="true"/>
+ </runtime>
+</configuration>
diff --git a/cs/test/Ice/metrics/run.py b/cs/test/Ice/metrics/run.py
index 0d1fb0757df..b6187895bf3 100755
--- a/cs/test/Ice/metrics/run.py
+++ b/cs/test/Ice/metrics/run.py
@@ -24,3 +24,5 @@ print("tests with regular server.")
TestUtil.clientServerTest()
print("tests with AMD server.")
TestUtil.clientServerTest(server = "serveramd")
+print("tests with collocated server.")
+TestUtil.collocatedTest()
diff --git a/cs/test/Ice/operations/Collocated.cs b/cs/test/Ice/operations/Collocated.cs
index 09ca29ba338..4d45b036b83 100644
--- a/cs/test/Ice/operations/Collocated.cs
+++ b/cs/test/Ice/operations/Collocated.cs
@@ -24,9 +24,14 @@ public class Collocated
communicator.getProperties().setProperty("TestAdapter.AdapterId", "test");
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
+ Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
adapter.activate();
+ if(prx.ice_getConnection() != null)
+ {
+ throw new System.Exception();
+ }
+
AllTests.allTests(communicator);
return 0;
diff --git a/cs/test/Ice/retry/Instrumentation.cs b/cs/test/Ice/retry/Instrumentation.cs
index c4dcef51f9b..169dc8e95fb 100644
--- a/cs/test/Ice/retry/Instrumentation.cs
+++ b/cs/test/Ice/retry/Instrumentation.cs
@@ -59,8 +59,8 @@ public class Instrumentation
return null;
}
- public Ice.Instrumentation.RemoteObserver
- getCollocatedObserver(int i , int j)
+ public Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(Ice.ObjectAdapter adapter, int i , int j)
{
return null;
}
diff --git a/java/resources/metrics.cfg b/java/resources/metrics.cfg
index d8cd1f870e1..f52598ce9d7 100644
--- a/java/resources/metrics.cfg
+++ b/java/resources/metrics.cfg
@@ -61,7 +61,7 @@ IceGridGUI.Metrics.Dispatch.failures.columnName = Failures
#
# Invocation fields
#
-IceGridGUI.Metrics.Invocation.fields = id current total remotes average averageLifetime userException failures
+IceGridGUI.Metrics.Invocation.fields = id current total remotes collocated average averageLifetime userException failures
IceGridGUI.Metrics.Invocation.id.columnName = Id
IceGridGUI.Metrics.Invocation.id.columnToolTip = Identity
@@ -109,6 +109,41 @@ IceGridGUI.Metrics.Invocation.remotes.columnName = Remotes
IceGridGUI.Metrics.Invocation.remotes.replySize.columnToolTip = <html>Average invocation reply size (bytes)<br><br><p style="width: 300px;">The size of the reply is the size of the reply data: the reply status byte and the encapsulation for the request output parameters.</p></html>
IceGridGUI.Metrics.Invocation.remotes.replySize.scaleFactor = 1000.0d
+IceGridGUI.Metrics.Invocation.collocated.fieldClass = IceGridGUI.LiveDeployment.MetricsViewEditor$SubMetricsField
+IceGridGUI.Metrics.Invocation.collocated.columnName = Collocated
+
+ #
+ # Collocated sub metric
+ #
+ IceGridGUI.Metrics.Invocation.collocated.fields = id current total failures average averageLifetime size replySize
+ IceGridGUI.Metrics.Invocation.collocated.id.columnName = Id
+ IceGridGUI.Metrics.Invocation.collocated.id.columnToolTip = Identity
+ IceGridGUI.Metrics.Invocation.collocated.current.columnName = Current
+ IceGridGUI.Metrics.Invocation.collocated.total.columnName = Total
+ IceGridGUI.Metrics.Invocation.collocated.failures.fieldClass = IceGridGUI.LiveDeployment.MetricsViewEditor$FailuresMetricsField
+ IceGridGUI.Metrics.Invocation.collocated.failures.columnName = Failures
+ IceGridGUI.Metrics.Invocation.collocated.average.fieldClass = IceGridGUI.LiveDeployment.MetricsViewEditor$DeltaAverageMetricsField
+ IceGridGUI.Metrics.Invocation.collocated.average.dataField = total
+ IceGridGUI.Metrics.Invocation.collocated.average.columnName = Avg Cnt
+ IceGridGUI.Metrics.Invocation.collocated.average.columnToolTip = Average collocated count (count/s)
+ IceGridGUI.Metrics.Invocation.collocated.average.scaleFactor = 1000.0d
+
+ IceGridGUI.Metrics.Invocation.collocated.averageLifetime.fieldClass = IceGridGUI.LiveDeployment.MetricsViewEditor$AverageLifetimeMetricsField
+ IceGridGUI.Metrics.Invocation.collocated.averageLifetime.scaleFactor = 1000.0d
+ IceGridGUI.Metrics.Invocation.collocated.averageLifetime.columnName = Avg LfT
+ IceGridGUI.Metrics.Invocation.collocated.averageLifetime.columnToolTip = <html>Average remote invocation lifetime (ms)<br><br><p style="width: 300px;">The lifetime starts when the marshalled invocation is passed to the Ice connection for sending and ends when the Ice connection either sent the invocation (for oneway) or received the response (for twoway). This time doesn't include the marshalling of the invocation or un-marshalling of the response.</p></html>
+
+ IceGridGUI.Metrics.Invocation.collocated.size.fieldClass = IceGridGUI.LiveDeployment.MetricsViewEditor$DeltaAverageMetricsField
+ IceGridGUI.Metrics.Invocation.collocated.size.dataField = size
+ IceGridGUI.Metrics.Invocation.collocated.size.columnName = Avg Sz
+ IceGridGUI.Metrics.Invocation.collocated.size.columnToolTip = <html>Average invocation size (bytes)<br><br><p style="width: 300px;">The size of an invocation is the size of the request data: object identity, facet name, operation name, mode, context and encapsulation for the request input parameters.</p></html>
+ IceGridGUI.Metrics.Invocation.collocated.size.scaleFactor = 1000.0d
+
+ IceGridGUI.Metrics.Invocation.collocated.replySize.fieldClass = IceGridGUI.LiveDeployment.MetricsViewEditor$DeltaAverageMetricsField
+ IceGridGUI.Metrics.Invocation.collocated.replySize.dataField = replySize
+ IceGridGUI.Metrics.Invocation.collocated.replySize.columnName = Avg ReplySz
+ IceGridGUI.Metrics.Invocation.collocated.replySize.columnToolTip = <html>Average invocation reply size (bytes)<br><br><p style="width: 300px;">The size of the reply is the size of the reply data: the reply status byte and the encapsulation for the request output parameters.</p></html>
+ IceGridGUI.Metrics.Invocation.collocated.replySize.scaleFactor = 1000.0d
IceGridGUI.Metrics.Invocation.average.fieldClass = IceGridGUI.LiveDeployment.MetricsViewEditor$DeltaAverageMetricsField
IceGridGUI.Metrics.Invocation.average.dataField = total
diff --git a/java/src/Ice/AsyncResult.java b/java/src/Ice/AsyncResult.java
index bf636fa6872..706616fe32f 100644
--- a/java/src/Ice/AsyncResult.java
+++ b/java/src/Ice/AsyncResult.java
@@ -334,23 +334,24 @@ public class AsyncResult
{
if(_observer != null)
{
- _remoteObserver = _observer.getRemoteObserver(info, endpt, requestId, size);
- if(_remoteObserver != null)
+ _childObserver = _observer.getRemoteObserver(info, endpt, requestId, size);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
- public void __attachCollocatedObserver(int requestId)
+ public void __attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId)
{
if(_observer != null)
{
- _remoteObserver = _observer.getCollocatedObserver(requestId,
+ _childObserver = _observer.getCollocatedObserver(adapter,
+ requestId,
_os.size() - IceInternal.Protocol.headerSize - 4);
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
@@ -535,7 +536,7 @@ public class AsyncResult
protected Ice.Exception _exception;
protected Ice.Instrumentation.InvocationObserver _observer;
- protected Ice.Instrumentation.RemoteObserver _remoteObserver;
+ protected Ice.Instrumentation.ChildInvocationObserver _childObserver;
private IceInternal.CallbackBase _callback;
}
diff --git a/java/src/IceInternal/BatchOutgoing.java b/java/src/IceInternal/BatchOutgoing.java
index b60e29268aa..8647e89ccde 100644
--- a/java/src/IceInternal/BatchOutgoing.java
+++ b/java/src/IceInternal/BatchOutgoing.java
@@ -172,10 +172,10 @@ public final class BatchOutgoing implements OutgoingMessageCallback
synchronized public void
sent()
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.detach();
+ _childObserver = null;
}
_sent = true;
notify();
@@ -184,11 +184,11 @@ public final class BatchOutgoing implements OutgoingMessageCallback
public synchronized void
finished(Ice.Exception ex, boolean sent)
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
+ _childObserver = null;
}
_exception = ex;
notify();
@@ -205,22 +205,23 @@ public final class BatchOutgoing implements OutgoingMessageCallback
{
if(_observer != null)
{
- _remoteObserver = _observer.getRemoteObserver(info, endpt, 0, size);
- if(_remoteObserver != null)
+ _childObserver = _observer.getRemoteObserver(info, endpt, 0, size);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
- public void attachCollocatedObserver(int requestId)
+ public void
+ attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId)
{
if(_observer != null)
{
- _remoteObserver = _observer.getCollocatedObserver(requestId, _os.size() - Protocol.headerSize - 4);
- if(_remoteObserver != null)
+ _childObserver = _observer.getCollocatedObserver(adapter, requestId, _os.size() - Protocol.headerSize - 4);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
@@ -232,6 +233,6 @@ public final class BatchOutgoing implements OutgoingMessageCallback
private Ice.Exception _exception;
private InvocationObserver _observer;
- private Observer _remoteObserver;
+ private Observer _childObserver;
}
diff --git a/java/src/IceInternal/BatchOutgoingAsync.java b/java/src/IceInternal/BatchOutgoingAsync.java
index 6153624c88e..ad289e019fb 100644
--- a/java/src/IceInternal/BatchOutgoingAsync.java
+++ b/java/src/IceInternal/BatchOutgoingAsync.java
@@ -35,10 +35,10 @@ public class BatchOutgoingAsync extends Ice.AsyncResult implements OutgoingAsync
{
_state |= Done | OK | Sent;
//_os.resize(0, false); // Don't clear the buffer now, it's needed for the collocation optimization
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.detach();
+ _childObserver = null;
}
if(_timeoutRequestHandler != null)
{
@@ -59,11 +59,11 @@ public class BatchOutgoingAsync extends Ice.AsyncResult implements OutgoingAsync
public void
__finished(Ice.Exception exc, boolean sent)
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.failed(exc.ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.failed(exc.ice_name());
+ _childObserver.detach();
+ _childObserver = null;
}
if(_timeoutRequestHandler != null)
{
diff --git a/java/src/IceInternal/CollocatedObserverI.java b/java/src/IceInternal/CollocatedObserverI.java
new file mode 100644
index 00000000000..e2355935dca
--- /dev/null
+++ b/java/src/IceInternal/CollocatedObserverI.java
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 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.
+//
+// **********************************************************************
+
+package IceInternal;
+
+public class CollocatedObserverI
+ extends IceMX.ObserverWithDelegate<IceMX.CollocatedMetrics, Ice.Instrumentation.CollocatedObserver>
+ implements Ice.Instrumentation.CollocatedObserver
+{
+ public void
+ reply(final int size)
+ {
+ forEach(new MetricsUpdate<IceMX.CollocatedMetrics>()
+ {
+ public void
+ update(IceMX.CollocatedMetrics v)
+ {
+ v.replySize += size;
+ }
+ });
+ if(_delegate != null)
+ {
+ _delegate.reply(size);
+ }
+ }
+}
diff --git a/java/src/IceInternal/CollocatedRequestHandler.java b/java/src/IceInternal/CollocatedRequestHandler.java
index 13965c3c10b..245d714a64b 100644
--- a/java/src/IceInternal/CollocatedRequestHandler.java
+++ b/java/src/IceInternal/CollocatedRequestHandler.java
@@ -315,7 +315,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler
}
}
- out.attachCollocatedObserver(requestId);
+ out.attachCollocatedObserver(_adapter, requestId);
if(_reference.getInvocationTimeout() > 0)
{
@@ -348,7 +348,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler
}
}
- outAsync.__attachCollocatedObserver(requestId);
+ outAsync.__attachCollocatedObserver(_adapter, requestId);
_adapter.getThreadPool().execute(new InvokeAllAsync(outAsync, outAsync.__getOs(), requestId, 1, false));
@@ -395,7 +395,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler
}
}
- out.attachCollocatedObserver(0);
+ out.attachCollocatedObserver(_adapter, 0);
if(invokeNum > 0)
{
@@ -454,7 +454,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler
}
}
- outAsync.__attachCollocatedObserver(0);
+ outAsync.__attachCollocatedObserver(_adapter, 0);
if(invokeNum > 0)
{
diff --git a/java/src/IceInternal/CommunicatorBatchOutgoingAsync.java b/java/src/IceInternal/CommunicatorBatchOutgoingAsync.java
index ea0a8d26177..8f7f2707a7f 100644
--- a/java/src/IceInternal/CommunicatorBatchOutgoingAsync.java
+++ b/java/src/IceInternal/CommunicatorBatchOutgoingAsync.java
@@ -50,10 +50,10 @@ public class CommunicatorBatchOutgoingAsync extends Ice.AsyncResult
public boolean
__sent()
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.detach();
+ _childObserver = null;
}
check(false);
return false;
@@ -62,11 +62,11 @@ public class CommunicatorBatchOutgoingAsync extends Ice.AsyncResult
public void
__finished(Ice.LocalException ex, boolean sent)
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
+ _childObserver = null;
}
check(false);
}
@@ -76,11 +76,11 @@ public class CommunicatorBatchOutgoingAsync extends Ice.AsyncResult
{
if(CommunicatorBatchOutgoingAsync.this._observer != null)
{
- _remoteObserver = CommunicatorBatchOutgoingAsync.this._observer.getRemoteObserver(info, endpt,
+ _childObserver = CommunicatorBatchOutgoingAsync.this._observer.getRemoteObserver(info, endpt,
requestId, size);
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
diff --git a/java/src/IceInternal/CommunicatorObserverI.java b/java/src/IceInternal/CommunicatorObserverI.java
index bf23296294a..d0451465955 100644
--- a/java/src/IceInternal/CommunicatorObserverI.java
+++ b/java/src/IceInternal/CommunicatorObserverI.java
@@ -617,6 +617,8 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb
{
_invocations.registerSubMap("Remote", RemoteMetrics.class,
InvocationMetrics.class.getDeclaredField("remotes"));
+ _invocations.registerSubMap("Collocated", CollocatedMetrics.class,
+ InvocationMetrics.class.getDeclaredField("collocated"));
}
catch(Exception ex)
{
diff --git a/java/src/IceInternal/InvocationObserverI.java b/java/src/IceInternal/InvocationObserverI.java
index 7997a22d9d0..6745c281ef8 100644
--- a/java/src/IceInternal/InvocationObserverI.java
+++ b/java/src/IceInternal/InvocationObserverI.java
@@ -114,7 +114,7 @@ public class InvocationObserverI
private Ice.EndpointInfo _endpointInfo;
};
- static public final class CollocatedInvocationHelper extends MetricsHelper<RemoteMetrics>
+ static public final class CollocatedInvocationHelper extends MetricsHelper<CollocatedMetrics>
{
static private final AttributeResolver _attributes = new AttributeResolver()
{
@@ -134,15 +134,16 @@ public class InvocationObserverI
}
};
- CollocatedInvocationHelper(int requestId, int size)
+ CollocatedInvocationHelper(Ice.ObjectAdapter adapter, int requestId, int size)
{
super(_attributes);
+ _id = adapter.getName();
_requestId = requestId;
_size = size;
}
public void
- initMetrics(RemoteMetrics v)
+ initMetrics(CollocatedMetrics v)
{
v.size += _size;
}
@@ -150,10 +151,6 @@ public class InvocationObserverI
public String
getId()
{
- if(_id == null)
- {
- _id = Integer.toString(_requestId);
- }
return _id;
}
@@ -171,7 +168,7 @@ public class InvocationObserverI
final private int _requestId;
final private int _size;
- private String _id;
+ final private String _id;
};
public void
@@ -209,19 +206,20 @@ public class InvocationObserverI
delegate);
}
- public Ice.Instrumentation.RemoteObserver
- getCollocatedObserver(int requestId, int sz)
+ public Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(Ice.ObjectAdapter adapter, int requestId, int sz)
{
- Ice.Instrumentation.RemoteObserver delegate = null;
+ Ice.Instrumentation.CollocatedObserver delegate = null;
if(_delegate != null)
{
- delegate = _delegate.getCollocatedObserver(requestId, sz);
+ delegate = _delegate.getCollocatedObserver(adapter, requestId, sz);
}
- return (Ice.Instrumentation.RemoteObserver)getObserver("Collocated",
- new CollocatedInvocationHelper(requestId, sz),
- RemoteMetrics.class,
- RemoteObserverI.class,
- delegate);
+ return (Ice.Instrumentation.CollocatedObserver)getObserver(
+ "Collocated",
+ new CollocatedInvocationHelper(adapter, requestId, sz),
+ CollocatedMetrics.class,
+ CollocatedObserverI.class,
+ delegate);
}
final MetricsUpdate<InvocationMetrics> _incrementRetry = new MetricsUpdate<InvocationMetrics>()
diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java
index ac06172ce72..3a14e835110 100644
--- a/java/src/IceInternal/Outgoing.java
+++ b/java/src/IceInternal/Outgoing.java
@@ -9,7 +9,7 @@
package IceInternal;
-import Ice.Instrumentation.RemoteObserver;
+import Ice.Instrumentation.ChildInvocationObserver;
import Ice.Instrumentation.InvocationObserver;
public final class Outgoing implements OutgoingMessageCallback
@@ -255,10 +255,10 @@ public final class Outgoing implements OutgoingMessageCallback
{
if(_proxy.__reference().getMode() != Reference.ModeTwoway)
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.detach();
+ _childObserver = null;
}
_state = StateOK;
}
@@ -273,11 +273,11 @@ public final class Outgoing implements OutgoingMessageCallback
assert(_state <= StateInProgress);
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.reply(is.size() - Protocol.headerSize - 4);
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.reply(is.size() - Protocol.headerSize - 4);
+ _childObserver.detach();
+ _childObserver = null;
}
if(_is == null)
@@ -418,11 +418,11 @@ public final class Outgoing implements OutgoingMessageCallback
finished(Ice.Exception ex, boolean sent)
{
assert(_state <= StateInProgress);
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.failed(ex.ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.failed(ex.ice_name());
+ _childObserver.detach();
+ _childObserver = null;
}
_state = StateFailed;
_exception = ex;
@@ -520,23 +520,23 @@ public final class Outgoing implements OutgoingMessageCallback
{
if(_observer != null)
{
- _remoteObserver = _observer.getRemoteObserver(info, endpt, requestId, size);
- if(_remoteObserver != null)
+ _childObserver = _observer.getRemoteObserver(info, endpt, requestId, size);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
public void
- attachCollocatedObserver(int requestId)
+ attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId)
{
if(_observer != null)
{
- _remoteObserver = _observer.getCollocatedObserver(requestId, _os.size() - Protocol.headerSize - 4);
- if(_remoteObserver != null)
+ _childObserver = _observer.getCollocatedObserver(adapter, requestId, _os.size() - Protocol.headerSize - 4);
+ if(_childObserver != null)
{
- _remoteObserver.attach();
+ _childObserver.attach();
}
}
}
@@ -659,7 +659,7 @@ public final class Outgoing implements OutgoingMessageCallback
private int _state;
private InvocationObserver _observer;
- private RemoteObserver _remoteObserver;
+ private ChildInvocationObserver _childObserver;
public Outgoing next; // For use by Ice.ObjectPrxHelperBase
diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java
index 41c56076a94..9d18c397d6a 100644
--- a/java/src/IceInternal/OutgoingAsync.java
+++ b/java/src/IceInternal/OutgoingAsync.java
@@ -124,10 +124,10 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
if(!_proxy.ice_isTwoway())
{
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.detach();
+ _childObserver = null;
}
if(_timeoutRequestHandler != null)
{
@@ -154,11 +154,11 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
synchronized(_monitor)
{
assert((_state & Done) == 0);
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.failed(exc.ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.failed(exc.ice_name());
+ _childObserver.detach();
+ _childObserver = null;
}
if(_timeoutRequestHandler != null)
{
@@ -197,11 +197,11 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
synchronized(_monitor)
{
assert(_exception == null && (_state & Done) == 0);
- if(_remoteObserver != null)
+ if(_childObserver != null)
{
- _remoteObserver.reply(is.size() - Protocol.headerSize - 4);
- _remoteObserver.detach();
- _remoteObserver = null;
+ _childObserver.reply(is.size() - Protocol.headerSize - 4);
+ _childObserver.detach();
+ _childObserver = null;
}
if(_timeoutRequestHandler != null)
diff --git a/java/test/Ice/metrics/AllTests.java b/java/test/Ice/metrics/AllTests.java
index 796b650cad3..0f056a3857f 100644
--- a/java/test/Ice/metrics/AllTests.java
+++ b/java/test/Ice/metrics/AllTests.java
@@ -336,8 +336,18 @@ public class AllTests
Map<String, String> props,
String map)
{
- cprops.setProperties(getClientProps(cprops, props, map));
- sprops.setProperties(getServerProps(sprops, props, map));
+ if(sprops.ice_getConnection() != null)
+ {
+ cprops.setProperties(getClientProps(cprops, props, map));
+ sprops.setProperties(getServerProps(sprops, props, map));
+ }
+ else
+ {
+ Map<String, String> clientProps = getClientProps(cprops, props, map);
+ Map<String, String> serverProps = getServerProps(sprops, props, map);
+ serverProps.putAll(clientProps);
+ cprops.setProperties(serverProps);
+ }
callback.waitForUpdate();
}
@@ -401,7 +411,8 @@ public class AllTests
throws IceMX.UnknownMetricsView
{
MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010"));
-
+ boolean collocated = metrics.ice_getConnection() == null;
+
out.print("testing metrics admin facet checkedCast... ");
out.flush();
Ice.ObjectPrx admin = communicator.getAdmin();
@@ -428,8 +439,11 @@ public class AllTests
updateProps(clientProps, serverProps, update, props, "");
Ice.LongHolder timestamp = new Ice.LongHolder();
Map<String, IceMX.Metrics[]> view = clientMetrics.getMetricsView("View", timestamp);
- test(view.get("Connection").length == 1 && view.get("Connection")[0].current == 1 &&
- view.get("Connection")[0].total == 1);
+ if(!collocated)
+ {
+ test(view.get("Connection").length == 1 && view.get("Connection")[0].current == 1 &&
+ view.get("Connection")[0].total == 1);
+ }
test(view.get("Thread").length == 1 && view.get("Thread")[0].current == 3 && view.get("Thread")[0].total == 3);
out.println("ok");
@@ -447,312 +461,332 @@ public class AllTests
view = clientMetrics.getMetricsView("View", timestamp);
test(view.get("Thread").length == 3);
- test(view.get("Connection").length == 2);
+ if(!collocated)
+ {
+ test(view.get("Connection").length == 2);
+ }
test(view.get("Invocation").length == 1);
IceMX.InvocationMetrics invoke = (IceMX.InvocationMetrics)view.get("Invocation")[0];
test(invoke.id.indexOf("[ice_ping]") > 0 && invoke.current == 0 && invoke.total == 5);
- test(invoke.remotes.length == 2);
- test(invoke.remotes[0].total >= 2 && invoke.remotes[1].total >= 2);
- test((invoke.remotes[0].total + invoke.remotes[1].total) == 5);
-
+ if(!collocated)
+ {
+ test(invoke.remotes.length == 2);
+ test(invoke.remotes[0].total >= 2 && invoke.remotes[1].total >= 2);
+ test((invoke.remotes[0].total + invoke.remotes[1].total) == 5);
+ }
+ else
+ {
+ test(invoke.collocated.length == 1);
+ test(invoke.collocated[0].total == 5);
+ }
view = serverMetrics.getMetricsView("View", timestamp);
- test(view.get("Thread").length > 3);
- test(view.get("Connection").length == 2);
+ if(!collocated)
+ {
+ test(view.get("Thread").length > 3);
+ test(view.get("Connection").length == 2);
+ }
test(view.get("Dispatch").length == 1);
test(view.get("Dispatch")[0].current <= 1 && view.get("Dispatch")[0].total == 5);
test(view.get("Dispatch")[0].id.indexOf("[ice_ping]") > 0);
- metrics.ice_getConnection().close(false);
- metrics.ice_connectionId("Con1").ice_getConnection().close(false);
-
- waitForCurrent(clientMetrics, "View", "Connection", 0);
- waitForCurrent(serverMetrics, "View", "Connection", 0);
+ if(!collocated)
+ {
+ metrics.ice_getConnection().close(false);
+ metrics.ice_connectionId("Con1").ice_getConnection().close(false);
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
+ }
clearView(clientProps, serverProps, update);
out.println("ok");
- out.print("testing connection metrics... ");
- out.flush();
+ Map<String, IceMX.Metrics> map;
+
+ if(!collocated)
+ {
+ out.print("testing connection metrics... ");
+ out.flush();
- props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
- updateProps(clientProps, serverProps, update, props, "Connection");
+ props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
+ updateProps(clientProps, serverProps, update, props, "Connection");
- test(clientMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
- test(serverMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
+ test(clientMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
+ test(serverMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
- metrics.ice_ping();
+ metrics.ice_ping();
- IceMX.ConnectionMetrics cm1, sm1, cm2, sm2;
- cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
- sm1 = getServerConnectionMetrics(serverMetrics, 25);
- test(cm1.total == 1 && sm1.total == 1);
+ IceMX.ConnectionMetrics cm1, sm1, cm2, sm2;
+ cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm1 = getServerConnectionMetrics(serverMetrics, 25);
+ test(cm1.total == 1 && sm1.total == 1);
- metrics.ice_ping();
+ metrics.ice_ping();
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
- sm2 = getServerConnectionMetrics(serverMetrics, 50);
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, 50);
- test(cm2.sentBytes - cm1.sentBytes == 45); // 45 for ice_ping request
- test(cm2.receivedBytes - cm1.receivedBytes == 25); // 25 bytes for ice_ping response
- test(sm2.receivedBytes - sm1.receivedBytes == 45);
- test(sm2.sentBytes - sm1.sentBytes == 25);
+ test(cm2.sentBytes - cm1.sentBytes == 45); // 45 for ice_ping request
+ test(cm2.receivedBytes - cm1.receivedBytes == 25); // 25 bytes for ice_ping response
+ test(sm2.receivedBytes - sm1.receivedBytes == 45);
+ test(sm2.sentBytes - sm1.sentBytes == 25);
- cm1 = cm2;
- sm1 = sm2;
+ cm1 = cm2;
+ sm1 = sm2;
- byte[] bs = new byte[0];
- metrics.opByteS(bs);
+ byte[] bs = new byte[0];
+ metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
- sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + cm2.receivedBytes - cm1.receivedBytes);
- long requestSz = cm2.sentBytes - cm1.sentBytes;
- long replySz = cm2.receivedBytes - cm1.receivedBytes;
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + cm2.receivedBytes - cm1.receivedBytes);
+ long requestSz = cm2.sentBytes - cm1.sentBytes;
+ long replySz = cm2.receivedBytes - cm1.receivedBytes;
- cm1 = cm2;
- sm1 = sm2;
+ cm1 = cm2;
+ sm1 = sm2;
- bs = new byte[456];
- metrics.opByteS(bs);
+ bs = new byte[456];
+ metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
- sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
- test(cm2.sentBytes - cm1.sentBytes == requestSz + bs.length + 4); // 4 is for the seq variable size
- test(cm2.receivedBytes - cm1.receivedBytes == replySz);
- test(sm2.receivedBytes - sm1.receivedBytes == requestSz + bs.length + 4);
- test(sm2.sentBytes - sm1.sentBytes == replySz);
+ test(cm2.sentBytes - cm1.sentBytes == requestSz + bs.length + 4); // 4 is for the seq variable size
+ test(cm2.receivedBytes - cm1.receivedBytes == replySz);
+ test(sm2.receivedBytes - sm1.receivedBytes == requestSz + bs.length + 4);
+ test(sm2.sentBytes - sm1.sentBytes == replySz);
- cm1 = cm2;
- sm1 = sm2;
+ cm1 = cm2;
+ sm1 = sm2;
- bs = new byte[1024 * 1024 * 10]; // Try with large amount of data which should be sent in several chunks
- metrics.opByteS(bs);
+ bs = new byte[1024 * 1024 * 10]; // Try with large amount of data which should be sent in several chunks
+ metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
- sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
- test((cm2.sentBytes - cm1.sentBytes) == (requestSz + bs.length + 4)); // 4 is for the seq variable size
- test((cm2.receivedBytes - cm1.receivedBytes) == replySz);
- test((sm2.receivedBytes - sm1.receivedBytes) == (requestSz + bs.length + 4));
- test((sm2.sentBytes - sm1.sentBytes) == replySz);
+ test((cm2.sentBytes - cm1.sentBytes) == (requestSz + bs.length + 4)); // 4 is for the seq variable size
+ test((cm2.receivedBytes - cm1.receivedBytes) == replySz);
+ test((sm2.receivedBytes - sm1.receivedBytes) == (requestSz + bs.length + 4));
+ test((sm2.sentBytes - sm1.sentBytes) == replySz);
- props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "state");
- updateProps(clientProps, serverProps, update, props, "Connection");
+ props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "state");
+ updateProps(clientProps, serverProps, update, props, "Connection");
- Map<String, IceMX.Metrics> map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
- test(map.get("active").current == 1);
+ test(map.get("active").current == 1);
- ControllerPrx controller = ControllerPrxHelper.checkedCast(
- communicator.stringToProxy("controller:default -p 12011"));
- controller.hold();
+ ControllerPrx controller = ControllerPrxHelper.checkedCast(
+ communicator.stringToProxy("controller:default -p 12011"));
+ controller.hold();
- map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
- test(map.get("active").current == 1);
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
- test(map.get("holding").current == 1);
+ map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("active").current == 1);
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("holding").current == 1);
- metrics.ice_getConnection().close(false);
+ metrics.ice_getConnection().close(false);
- map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
- test(map.get("closing").current == 1);
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
- test(map.get("holding").current == 1);
+ map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("closing").current == 1);
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("holding").current == 1);
- controller.resume();
+ controller.resume();
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
- test(map.get("holding").current == 0);
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("holding").current == 0);
- props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
- updateProps(clientProps, serverProps, update, props, "Connection");
+ props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
+ updateProps(clientProps, serverProps, update, props, "Connection");
- metrics.ice_getConnection().close(false);
+ metrics.ice_getConnection().close(false);
- metrics.ice_timeout(500).ice_ping();
- controller.hold();
- try
- {
- ((MetricsPrx)metrics.ice_timeout(500)).opByteS(new byte[10000000]);
- test(false);
- }
- catch(Ice.TimeoutException ex)
- {
- }
- controller.resume();
-
- cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
- while(true)
- {
- sm1 = (IceMX.ConnectionMetrics)serverMetrics.getMetricsView("View", timestamp).get("Connection")[0];
- if(sm1.failures >= 2)
+ metrics.ice_timeout(500).ice_ping();
+ controller.hold();
+ try
{
- break;
+ ((MetricsPrx)metrics.ice_timeout(500)).opByteS(new byte[10000000]);
+ test(false);
}
- try
+ catch(Ice.TimeoutException ex)
{
- Thread.sleep(10);
}
- catch(InterruptedException ex)
+ controller.resume();
+
+ cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ while(true)
{
+ sm1 = (IceMX.ConnectionMetrics)serverMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ if(sm1.failures >= 2)
+ {
+ break;
+ }
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException ex)
+ {
+ }
}
- }
- test(cm1.failures == 2 && sm1.failures >= 2);
-
- checkFailure(clientMetrics, "Connection", cm1.id, "Ice::TimeoutException", 1, out);
- checkFailure(clientMetrics, "Connection", cm1.id, "Ice::ConnectTimeoutException", 1, out);
- checkFailure(serverMetrics, "Connection", sm1.id, "Ice::ConnectionLostException", 0, out);
-
- MetricsPrx m = (MetricsPrx)metrics.ice_timeout(500).ice_connectionId("Con1");
- m.ice_ping();
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator", out);
- //testAttribute(clientMetrics, clientProps, update, "Connection", "id", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint",
- "tcp -h 127.0.0.1 -p 12010 -t 500", out);
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "false", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "false", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010", out);
-
- testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "false", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1", out);
- //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "", out);
- testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "", out);
+ test(cm1.failures == 2 && sm1.failures >= 2);
+
+ checkFailure(clientMetrics, "Connection", cm1.id, "Ice::TimeoutException", 1, out);
+ checkFailure(clientMetrics, "Connection", cm1.id, "Ice::ConnectTimeoutException", 1, out);
+ checkFailure(serverMetrics, "Connection", sm1.id, "Ice::ConnectionLostException", 0, out);
+
+ MetricsPrx m = (MetricsPrx)metrics.ice_timeout(500).ice_connectionId("Con1");
+ m.ice_ping();
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator", out);
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "id", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint",
+ "tcp -h 127.0.0.1 -p 12010 -t 500", out);
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "false", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "false", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010", out);
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "false", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1", out);
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "", out);
- m.ice_getConnection().close(false);
+ m.ice_getConnection().close(false);
- waitForCurrent(clientMetrics, "View", "Connection", 0);
- waitForCurrent(serverMetrics, "View", "Connection", 0);
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
- out.println("ok");
+ out.println("ok");
- out.print("testing connection establishment metrics... ");
- out.flush();
+ out.print("testing connection establishment metrics... ");
+ out.flush();
- props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
- updateProps(clientProps, serverProps, update, props, "ConnectionEstablishment");
- test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 0);
+ props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
+ updateProps(clientProps, serverProps, update, props, "ConnectionEstablishment");
+ test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 0);
- metrics.ice_ping();
+ metrics.ice_ping();
- test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
- IceMX.Metrics m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
- test(m1.current == 0 && m1.total == 1 && m1.id.equals("127.0.0.1:12010"));
-
- metrics.ice_getConnection().close(false);
- controller.hold();
- try
- {
- communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping();
- test(false);
- }
- catch(Ice.ConnectTimeoutException ex)
- {
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- controller.resume();
- test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
- m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
- test(m1.id.equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2);
-
- checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "Ice::ConnectTimeoutException", 2, out);
-
- Connect c = new Connect(metrics);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c, out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c, out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
- "tcp -h 127.0.0.1 -p 12010", c, out);
-
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c, out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false", c,
- out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "false", c,
- out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c, out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c,
- out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c,
- out);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c,
- out);
+ test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
+ IceMX.Metrics m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
+ test(m1.current == 0 && m1.total == 1 && m1.id.equals("127.0.0.1:12010"));
- out.println("ok");
-
- out.print("testing endpoint lookup metrics... ");
- out.flush();
-
- props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
- updateProps(clientProps, serverProps, update, props, "EndpointLookup");
- test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 0);
-
- Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost");
- prx.ice_ping();
+ metrics.ice_getConnection().close(false);
+ controller.hold();
+ try
+ {
+ communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectTimeoutException ex)
+ {
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ controller.resume();
+ test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
+ test(m1.id.equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2);
+
+ checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "Ice::ConnectTimeoutException", 2, out);
+
+ Connect c = new Connect(metrics);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c, out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c, out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
+ "tcp -h 127.0.0.1 -p 12010", c, out);
+
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c, out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "false", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c, out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c,
+ out);
+
+ out.println("ok");
+
+ out.print("testing endpoint lookup metrics... ");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
+ updateProps(clientProps, serverProps, update, props, "EndpointLookup");
+ test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 0);
+
+ Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost");
+ prx.ice_ping();
- test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 1);
- m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
- test(m1.current <= 1 && m1.total == 1 && m1.id.equals("tcp -h localhost -p 12010"));
+ test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 1);
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
+ test(m1.current <= 1 && m1.total == 1 && m1.id.equals("tcp -h localhost -p 12010"));
- prx.ice_getConnection().close(false);
+ prx.ice_getConnection().close(false);
- boolean dnsException = false;
- try
- {
- communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping();
- test(false);
- }
- catch(Ice.DNSException ex)
- {
- dnsException = true;
- }
- catch(Ice.LocalException ex)
- {
- // Some DNS servers don't fail on unknown DNS names.
- }
- test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 2);
- m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
- if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500"))
- {
- m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[1];
- }
- test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 &&
- (!dnsException || m1.failures == 2));
- if(dnsException)
- {
- checkFailure(clientMetrics, "EndpointLookup", m1.id, "Ice::DNSException", 2, out);
- }
+ boolean dnsException = false;
+ try
+ {
+ communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping();
+ test(false);
+ }
+ catch(Ice.DNSException ex)
+ {
+ dnsException = true;
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Some DNS servers don't fail on unknown DNS names.
+ }
+ test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 2);
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
+ if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500"))
+ {
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[1];
+ }
+ test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 &&
+ (!dnsException || m1.failures == 2));
+ if(dnsException)
+ {
+ checkFailure(clientMetrics, "EndpointLookup", m1.id, "Ice::DNSException", 2, out);
+ }
- c = new Connect(prx);
+ c = new Connect(prx);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c,
- out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint",
- "tcp -h localhost -p 12010", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint",
+ "tcp -h localhost -p 12010", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "false", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c, out);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "false", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c, out);
- out.println("ok");
+ out.println("ok");
+ }
out.print("testing dispatch metrics... ");
out.flush();
@@ -794,17 +828,19 @@ public class AllTests
catch(Ice.UnknownException ex)
{
}
- try
+ if(!collocated)
{
+ try
+ {
metrics.fail();
test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
}
- catch(Ice.ConnectionLostException ex)
- {
- }
-
map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Dispatch"));
- test(map.size() == 6);
+ test(map.size() == (!collocated ? 6 : 5));
IceMX.DispatchMetrics dm1 = (IceMX.DispatchMetrics)map.get("op");
test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 0 && dm1.userException == 0);
@@ -833,27 +869,30 @@ public class AllTests
testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op, out);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint",
- "tcp -h 127.0.0.1 -p 12010", op, out);
- //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op);
-
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "false", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op, out);
-
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "true", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op, out);
- //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op, out);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op, out);
+ if(!collocated)
+ {
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint",
+ "tcp -h 127.0.0.1 -p 12010", op, out);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "false", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op, out);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "true", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op, out);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op, out);
+ }
testAttribute(serverMetrics, serverProps, update, "Dispatch", "operation", "op", op, out);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "identity", "metrics", op, out);
@@ -871,6 +910,7 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.Invocation.GroupBy", "operation");
props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort");
+ props.put("IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy", "id");
updateProps(clientProps, serverProps, update, props, "Invocation");
test(serverMetrics.getMetricsView("View", timestamp).get("Invocation").length == 0);
@@ -957,77 +997,88 @@ public class AllTests
metrics.begin_opWithUnknownException(cb);
cb.waitForResponse();
- try
- {
- metrics.fail();
- test(false);
- }
- catch(Ice.ConnectionLostException ex)
- {
- }
- try
- {
- metrics.end_fail(metrics.begin_fail());
- test(false);
- }
- catch(Ice.ConnectionLostException ex)
+ if(!collocated)
{
+ try
+ {
+ metrics.fail();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ try
+ {
+ metrics.end_fail(metrics.begin_fail());
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ metrics.begin_fail(cb);
+ cb.waitForResponse();
}
- metrics.begin_fail(cb);
- cb.waitForResponse();
map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Invocation"));
- test(map.size() == 6);
+ test(map.size() == (!collocated ? 6 : 5));
IceMX.InvocationMetrics im1;
- IceMX.RemoteMetrics rim1;
+ IceMX.ChildInvocationMetrics rim1;
im1 = (IceMX.InvocationMetrics)map.get("op");
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0 && im1.remotes.length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 63 && rim1.replySize == 21);
im1 = (IceMX.InvocationMetrics)map.get("opWithUserException");
- test(im1.current == 0 && im1.total == 3 && im1.failures == 0 && im1.retry == 0 && im1.remotes.length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current == 0 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 114 && rim1.replySize == 69);
test(im1.userException == 3);
im1 = (IceMX.InvocationMetrics)map.get("opWithLocalException");
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0 && im1.remotes.length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 117 && rim1.replySize > 7);
checkFailure(clientMetrics, "Invocation", im1.id, "Ice::UnknownLocalException", 3, out);
im1 = (IceMX.InvocationMetrics)map.get("opWithRequestFailedException");
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0 && im1.remotes.length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 141 && rim1.replySize == 120);
checkFailure(clientMetrics, "Invocation", im1.id, "Ice::ObjectNotExistException", 3, out);
im1 = (IceMX.InvocationMetrics)map.get("opWithUnknownException");
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0 && im1.remotes.length == 1);
- rim1 = (IceMX.RemoteMetrics)im1.remotes[0];
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 123 && rim1.replySize > 7);
checkFailure(clientMetrics, "Invocation", im1.id, "Ice::UnknownException", 3, out);
- im1 = (IceMX.InvocationMetrics)map.get("fail");
- test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.length == 6);
- test(im1.remotes[0].current == 0 && im1.remotes[0].total == 1 && im1.remotes[0].failures == 1);
- test(im1.remotes[1].current == 0 && im1.remotes[1].total == 1 && im1.remotes[1].failures == 1);
- test(im1.remotes[2].current == 0 && im1.remotes[2].total == 1 && im1.remotes[2].failures == 1);
- test(im1.remotes[3].current == 0 && im1.remotes[3].total == 1 && im1.remotes[3].failures == 1);
- test(im1.remotes[4].current == 0 && im1.remotes[4].total == 1 && im1.remotes[4].failures == 1);
- test(im1.remotes[5].current == 0 && im1.remotes[5].total == 1 && im1.remotes[5].failures == 1);
- checkFailure(clientMetrics, "Invocation", im1.id, "Ice::ConnectionLostException", 3, out);
+ if(!collocated)
+ {
+ im1 = (IceMX.InvocationMetrics)map.get("fail");
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.length == 6);
+ test(im1.remotes[0].current == 0 && im1.remotes[0].total == 1 && im1.remotes[0].failures == 1);
+ test(im1.remotes[1].current == 0 && im1.remotes[1].total == 1 && im1.remotes[1].failures == 1);
+ test(im1.remotes[2].current == 0 && im1.remotes[2].total == 1 && im1.remotes[2].failures == 1);
+ test(im1.remotes[3].current == 0 && im1.remotes[3].total == 1 && im1.remotes[3].failures == 1);
+ test(im1.remotes[4].current == 0 && im1.remotes[4].total == 1 && im1.remotes[4].failures == 1);
+ test(im1.remotes[5].current == 0 && im1.remotes[5].total == 1 && im1.remotes[5].failures == 1);
+ checkFailure(clientMetrics, "Invocation", im1.id, "Ice::ConnectionLostException", 3, out);
+ }
testAttribute(clientMetrics, clientProps, update, "Invocation", "parent", "Communicator", op, out);
testAttribute(clientMetrics, clientProps, update, "Invocation", "id", "metrics -t -e 1.1 [op]", op, out);
-
+
testAttribute(clientMetrics, clientProps, update, "Invocation", "operation", "op", op, out);
testAttribute(clientMetrics, clientProps, update, "Invocation", "identity", "metrics", op, out);
testAttribute(clientMetrics, clientProps, update, "Invocation", "facet", "", op, out);
@@ -1079,34 +1130,59 @@ public class AllTests
out.flush();
test(obsv.threadObserver.getTotal() > 0);
- test(obsv.connectionObserver.getTotal() > 0);
- test(obsv.connectionEstablishmentObserver.getTotal() > 0);
- test(obsv.endpointLookupObserver.getTotal() > 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getTotal() > 0);
+ test(obsv.connectionEstablishmentObserver.getTotal() > 0);
+ test(obsv.endpointLookupObserver.getTotal() > 0);
+ test(obsv.invocationObserver.remoteObserver.getTotal() > 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.getTotal() > 0);
+ }
test(obsv.dispatchObserver.getTotal() > 0);
test(obsv.invocationObserver.getTotal() > 0);
- test(obsv.invocationObserver.remoteObserver.getTotal() > 0);
test(obsv.threadObserver.getCurrent() > 0);
- test(obsv.connectionObserver.getCurrent() > 0);
- test(obsv.connectionEstablishmentObserver.getCurrent() == 0);
- test(obsv.endpointLookupObserver.getCurrent() == 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getCurrent() > 0);
+ test(obsv.connectionEstablishmentObserver.getCurrent() == 0);
+ test(obsv.endpointLookupObserver.getCurrent() == 0);
+ test(obsv.invocationObserver.remoteObserver.getCurrent() == 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.getCurrent() == 0);
+ }
test(obsv.dispatchObserver.getCurrent() == 0);
test(obsv.invocationObserver.getCurrent() == 0);
- test(obsv.invocationObserver.remoteObserver.getCurrent() == 0);
test(obsv.threadObserver.getFailedCount() == 0);
- test(obsv.connectionObserver.getFailedCount() > 0);
- test(obsv.connectionEstablishmentObserver.getFailedCount() > 0);
- test(obsv.endpointLookupObserver.getFailedCount() > 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getFailedCount() > 0);
+ test(obsv.connectionEstablishmentObserver.getFailedCount() > 0);
+ test(obsv.endpointLookupObserver.getFailedCount() > 0);
+ test(obsv.invocationObserver.remoteObserver.getFailedCount() > 0);
+ }
//test(obsv.dispatchObserver.getFailedCount() > 0);
test(obsv.invocationObserver.getFailedCount() > 0);
- test(obsv.invocationObserver.remoteObserver.getFailedCount() > 0);
- test(obsv.threadObserver.states > 0);
- test(obsv.connectionObserver.received > 0 && obsv.connectionObserver.sent > 0);
+ if(!collocated)
+ {
+ test(obsv.threadObserver.states > 0);
+ test(obsv.connectionObserver.received > 0 && obsv.connectionObserver.sent > 0);
+ test(obsv.invocationObserver.retriedCount > 0);
+ test(obsv.invocationObserver.remoteObserver.replySize > 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.replySize > 0);
+ }
//test(obsv.dispatchObserver.userExceptionCount > 0);
- test(obsv.invocationObserver.userExceptionCount > 0 && obsv.invocationObserver.retriedCount > 0);
- test(obsv.invocationObserver.remoteObserver.replySize > 0);
+ test(obsv.invocationObserver.userExceptionCount > 0);
out.println("ok");
diff --git a/java/test/Ice/metrics/ChildInvocationObserverI.java b/java/test/Ice/metrics/ChildInvocationObserverI.java
new file mode 100644
index 00000000000..8215cef34dd
--- /dev/null
+++ b/java/test/Ice/metrics/ChildInvocationObserverI.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 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.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class ChildInvocationObserverI extends ObserverI implements Ice.Instrumentation.ChildInvocationObserver
+{
+ public synchronized void
+ reset()
+ {
+ super.reset();
+ replySize = 0;
+ }
+
+ public synchronized void
+ reply(int s)
+ {
+ replySize += s;
+ }
+
+ int replySize;
+};
+
diff --git a/java/test/Ice/metrics/Collocated.java b/java/test/Ice/metrics/Collocated.java
new file mode 100644
index 00000000000..47056dc8841
--- /dev/null
+++ b/java/test/Ice/metrics/Collocated.java
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 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.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+import test.Ice.metrics.Test.MetricsPrx;
+
+public class Collocated extends test.Util.Application
+{
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MetricsI(), communicator.stringToIdentity("metrics"));
+ //adapter.activate();
+
+ communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), communicator.stringToIdentity("controller"));
+ //controllerAdapter.activate();
+
+ try
+ {
+ MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer);
+ metrics.shutdown();
+ }
+ catch(Ice.UserException ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ return 1;
+ }
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ initData.observer = _observer;
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+
+ private CommunicatorObserverI _observer = new CommunicatorObserverI();
+}
diff --git a/java/test/Ice/metrics/CollocatedObserverI.java b/java/test/Ice/metrics/CollocatedObserverI.java
new file mode 100644
index 00000000000..607da015366
--- /dev/null
+++ b/java/test/Ice/metrics/CollocatedObserverI.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 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.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class CollocatedObserverI extends ChildInvocationObserverI implements Ice.Instrumentation.CollocatedObserver
+{
+};
+
diff --git a/java/test/Ice/metrics/InvocationObserverI.java b/java/test/Ice/metrics/InvocationObserverI.java
index 2eee2947704..5457f85aff0 100644
--- a/java/test/Ice/metrics/InvocationObserverI.java
+++ b/java/test/Ice/metrics/InvocationObserverI.java
@@ -21,6 +21,10 @@ class InvocationObserverI extends ObserverI implements Ice.Instrumentation.Invoc
{
remoteObserver.reset();
}
+ if(collocatedObserver != null)
+ {
+ collocatedObserver.reset();
+ }
}
public synchronized void
@@ -46,19 +50,21 @@ class InvocationObserverI extends ObserverI implements Ice.Instrumentation.Invoc
return remoteObserver;
}
- public synchronized Ice.Instrumentation.RemoteObserver
- getCollocatedObserver(int a, int b)
+
+ public synchronized Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(Ice.ObjectAdapter adapter, int a, int b)
{
- if(remoteObserver == null)
+ if(collocatedObserver == null)
{
- remoteObserver = new RemoteObserverI();
- remoteObserver.reset();
+ collocatedObserver = new CollocatedObserverI();
+ collocatedObserver.reset();
}
- return remoteObserver;
+ return collocatedObserver;
}
int userExceptionCount;
int retriedCount;
RemoteObserverI remoteObserver = null;
+ CollocatedObserverI collocatedObserver = null;
};
diff --git a/java/test/Ice/metrics/RemoveObserverI.java b/java/test/Ice/metrics/RemoveObserverI.java
index d5e183fe2ec..6a5ad4817db 100644
--- a/java/test/Ice/metrics/RemoveObserverI.java
+++ b/java/test/Ice/metrics/RemoveObserverI.java
@@ -9,21 +9,7 @@
package test.Ice.metrics;
-class RemoteObserverI extends ObserverI implements Ice.Instrumentation.RemoteObserver
+class RemoteObserverI extends ChildInvocationObserverI implements Ice.Instrumentation.RemoteObserver
{
- public synchronized void
- reset()
- {
- super.reset();
- replySize = 0;
- }
-
- public synchronized void
- reply(int s)
- {
- replySize += s;
- }
-
- int replySize;
};
diff --git a/java/test/Ice/metrics/run.py b/java/test/Ice/metrics/run.py
index b38fb7eb4de..208d9fce41e 100755
--- a/java/test/Ice/metrics/run.py
+++ b/java/test/Ice/metrics/run.py
@@ -24,3 +24,5 @@ print("tests with regular server.")
TestUtil.clientServerTest()
print("tests with AMD server.")
TestUtil.clientServerTest(server="test.Ice.metrics.AMDServer")
+print("tests with collocated server.")
+TestUtil.collocatedTest()
diff --git a/java/test/Ice/operations/Collocated.java b/java/test/Ice/operations/Collocated.java
index 45aa29a6a30..451b098cd64 100644
--- a/java/test/Ice/operations/Collocated.java
+++ b/java/test/Ice/operations/Collocated.java
@@ -16,9 +16,14 @@ public class Collocated extends test.Util.Application
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
java.io.PrintWriter out = getWriter();
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new MyDerivedClassI(), communicator().stringToIdentity("test"));
+ Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), communicator().stringToIdentity("test"));
adapter.activate();
+ if(prx.ice_getConnection() != null)
+ {
+ throw new RuntimeException();
+ }
+
AllTests.allTests(this, out);
return 0;
diff --git a/java/test/Ice/retry/Instrumentation.java b/java/test/Ice/retry/Instrumentation.java
index 05916a2293d..ba8094e9db0 100644
--- a/java/test/Ice/retry/Instrumentation.java
+++ b/java/test/Ice/retry/Instrumentation.java
@@ -65,8 +65,8 @@ public class Instrumentation
return null;
}
- public Ice.Instrumentation.RemoteObserver
- getCollocatedObserver(int i , int j)
+ public Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(Ice.ObjectAdapter adapter, int i , int j)
{
return null;
}
diff --git a/py/demo/Ice/metrics/Metrics.py b/py/demo/Ice/metrics/Metrics.py
index 4c3a9b13e66..90104dc4840 100755
--- a/py/demo/Ice/metrics/Metrics.py
+++ b/py/demo/Ice/metrics/Metrics.py
@@ -72,6 +72,15 @@ maps = {
("replySize", "RepSz", '>', 5),
("averageLifetime", "Avg (ms)", '>', 8)
],
+ "Collocated" : [
+ ("id", "Invocations", '>', 39),
+ ("current", "#", '>', 3),
+ ("total", "Total", '>', 5),
+ ("", "", '>', 5),
+ ("size", "Sz", '>', 5),
+ ("replySize", "RepSz", '>', 5),
+ ("averageLifetime", "Avg (ms)", '>', 8)
+ ],
"Session" : [
("id", "Sessions", '<', 15),
("current", "#", '>', 3),
@@ -180,6 +189,8 @@ def printMetricsMap(admin, viewName, mapName, map):
printMetrics(mapName, metricsField(o))
for so in o.remotes:
printMetrics("Remote", metricsField(so))
+ for co in o.collocated:
+ printMetrics("Collocated", metricsField(so))
#
# Print the table footer.
diff --git a/py/modules/IcePy/Communicator.cpp b/py/modules/IcePy/Communicator.cpp
index ed5c237967e..593988ce462 100644
--- a/py/modules/IcePy/Communicator.cpp
+++ b/py/modules/IcePy/Communicator.cpp
@@ -186,13 +186,6 @@ communicatorInit(CommunicatorObject* self, PyObject* args, PyObject* /*kwds*/)
}
//
- // Disable collocation optimization, otherwise a Python invocation on
- // a collocated servant results in a CollocationOptimizationException
- // (because Python uses the blobject API).
- //
- data.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-
- //
// Remaining command line options are passed to the communicator
// as an argument vector in case they contain plug-in properties.
//
diff --git a/py/modules/IcePy/Proxy.cpp b/py/modules/IcePy/Proxy.cpp
index 1143d6d1fad..6d6b8fe7cba 100644
--- a/py/modules/IcePy/Proxy.cpp
+++ b/py/modules/IcePy/Proxy.cpp
@@ -1595,7 +1595,62 @@ proxyIceTimeout(ProxyObject* self, PyObject* args)
return createProxy(newProxy, *self->communicator, reinterpret_cast<PyObject*>(Py_TYPE(self)));
}
-// NOTE: ice_collocationOptimized is not currently supported.
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
+proxyIceIsCollocationOptimized(ProxyObject* self)
+{
+ assert(self->proxy);
+
+ PyObject* b;
+ try
+ {
+ b = (*self->proxy)->ice_isCollocationOptimized() ? getTrue() : getFalse();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return 0;
+ }
+
+ Py_INCREF(b);
+ return b;
+}
+
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
+proxyIceCollocationOptimized(ProxyObject* self, PyObject* args)
+{
+ PyObject* flag;
+ if(!PyArg_ParseTuple(args, STRCAST("O"), &flag))
+ {
+ return 0;
+ }
+
+ int n = PyObject_IsTrue(flag);
+ if(n < 0)
+ {
+ return 0;
+ }
+
+ assert(self->proxy);
+
+ Ice::ObjectPrx newProxy;
+ try
+ {
+ newProxy = (*self->proxy)->ice_collocationOptimized(n == 1);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return 0;
+ }
+
+ return createProxy(newProxy, *self->communicator, reinterpret_cast<PyObject*>(Py_TYPE(self)));
+}
#ifdef WIN32
extern "C"
@@ -2295,6 +2350,10 @@ static PyMethodDef ProxyMethods[] =
METH_NOARGS, PyDoc_STR(STRCAST("ice_getInvocationTimeout() -> int")) },
{ STRCAST("ice_getConnectionId"), reinterpret_cast<PyCFunction>(proxyIceGetConnectionId),
METH_NOARGS, PyDoc_STR(STRCAST("ice_getConnectionId() -> string")) },
+ { STRCAST("ice_isCollocationOptimized"), reinterpret_cast<PyCFunction>(proxyIceIsCollocationOptimized), METH_NOARGS,
+ PyDoc_STR(STRCAST("ice_isCollocationOptimized() -> bool")) },
+ { STRCAST("ice_collocationOptimized"), reinterpret_cast<PyCFunction>(proxyIceCollocationOptimized), METH_VARARGS,
+ PyDoc_STR(STRCAST("ice_collocationOptimized(bool) -> Ice.ObjectPrx")) },
{ STRCAST("ice_locatorCacheTimeout"), reinterpret_cast<PyCFunction>(proxyIceLocatorCacheTimeout), METH_VARARGS,
PyDoc_STR(STRCAST("ice_locatorCacheTimeout(int) -> Ice.ObjectPrx")) },
{ STRCAST("ice_invocationTimeout"), reinterpret_cast<PyCFunction>(proxyIceInvocationTimeout), METH_VARARGS,
diff --git a/py/test/Ice/info/AllTests.py b/py/test/Ice/info/AllTests.py
index 69fea27a039..c42e2c1bffe 100644
--- a/py/test/Ice/info/AllTests.py
+++ b/py/test/Ice/info/AllTests.py
@@ -13,7 +13,7 @@ def test(b):
if not b:
raise RuntimeError('test assertion failed')
-def allTests(communicator, collocated):
+def allTests(communicator):
sys.stdout.write("testing proxy endpoint information... ")
sys.stdout.flush()
diff --git a/py/test/Ice/info/Client.py b/py/test/Ice/info/Client.py
index a2efb8ce606..b83618aa613 100755
--- a/py/test/Ice/info/Client.py
+++ b/py/test/Ice/info/Client.py
@@ -24,7 +24,7 @@ def test(b):
raise RuntimeError('test assertion failed')
def run(args, communicator):
- AllTests.allTests(communicator, False)
+ AllTests.allTests(communicator)
return True
try:
diff --git a/py/test/Ice/location/AllTests.py b/py/test/Ice/location/AllTests.py
index b9e023fff3f..cbd28b7dcd5 100644
--- a/py/test/Ice/location/AllTests.py
+++ b/py/test/Ice/location/AllTests.py
@@ -9,6 +9,10 @@
import Ice, Test, sys
+class HelloI(Test.Hello):
+ def sayHello(self, current=None):
+ pass
+
def test(b):
if not b:
raise RuntimeError('test assertion failed')
@@ -18,6 +22,9 @@ def allTests(communicator, ref):
locator = communicator.getDefaultLocator()
test(manager)
+ registry = Test.TestLocatorRegistryPrx.checkedCast(locator.getRegistry());
+ test(registry);
+
sys.stdout.write("testing stringToProxy... ")
sys.stdout.flush()
base = communicator.stringToProxy("test @ TestAdapter")
@@ -189,7 +196,7 @@ def allTests(communicator, ref):
sys.stdout.flush()
hello = Test.HelloPrx.checkedCast(communicator.stringToProxy("hello"))
obj.migrateHello()
- hello.ice_getConnection().close(false);
+ hello.ice_getConnection().close(False);
hello.sayHello()
obj.migrateHello()
hello.sayHello()
@@ -222,9 +229,25 @@ def allTests(communicator, ref):
print("ok")
#
- # Collocated invocations are not supported in Python.
+ # Set up test for calling a collocated object through an indirect, adapterless reference.
#
- #sys.stdout.write("testing indirect references to collocated objects... ")
+ sys.stdout.write("testing indirect references to collocated objects... ")
+ sys.stdout.flush()
+ properties = communicator.getProperties();
+ properties.setProperty("Ice.PrintAdapterReady", "0");
+ adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default");
+ adapter.setLocator(locator);
+
+ id = Ice.Identity();
+ id.name = Ice.generateUUID();
+ registry.addObject(adapter.add(HelloI(), id));
+ adapter.activate();
+
+ helloPrx = Test.HelloPrx.checkedCast(communicator.stringToProxy(communicator.identityToString(id)));
+ test(not helloPrx.ice_getConnection());
+
+ adapter.deactivate();
+ print("ok")
sys.stdout.write("shutdown server manager... ")
sys.stdout.flush()
diff --git a/py/test/Ice/objects/AllTests.py b/py/test/Ice/objects/AllTests.py
index 5a57b7d6b2c..2799a020338 100644
--- a/py/test/Ice/objects/AllTests.py
+++ b/py/test/Ice/objects/AllTests.py
@@ -9,12 +9,6 @@
import Ice, Test, TestI, sys
-#
-# Ice for Python behaves differently than Ice for C++, because
-# collocated invocations are still sent "over the wire". Therefore
-# we always need to install the factories, even for the collocated
-# case.
-#
class MyObjectFactory(Ice.ObjectFactory):
def create(self, type):
if type == '::Test::B':
@@ -43,7 +37,7 @@ def test(b):
if not b:
raise RuntimeError('test assertion failed')
-def allTests(communicator, collocated):
+def allTests(communicator):
factory = MyObjectFactory()
communicator.addObjectFactory(factory, '::Test::B')
communicator.addObjectFactory(factory, '::Test::C')
@@ -204,7 +198,10 @@ def allTests(communicator, collocated):
pass
print("ok")
- if not collocated:
+ # Don't run this test with collocation, this should work with collocation
+ # but the test isn't written to support it (we'd need support for the
+ # streaming interface)
+ if initial.ice_getConnection():
sys.stdout.write("testing UnexpectedObjectException... ")
sys.stdout.flush()
ref = "uoet:default -p 12010"
diff --git a/py/test/Ice/objects/Client.py b/py/test/Ice/objects/Client.py
index 978c61735a2..26fdba850b9 100755
--- a/py/test/Ice/objects/Client.py
+++ b/py/test/Ice/objects/Client.py
@@ -16,7 +16,7 @@ Ice.loadSlice('ClientPrivate.ice')
import AllTests
def run(args, communicator):
- initial = AllTests.allTests(communicator, False)
+ initial = AllTests.allTests(communicator)
initial.shutdown()
return True
diff --git a/py/test/Ice/objects/Collocated.py b/py/test/Ice/objects/Collocated.py
index 1ca94c49a18..8b477ce563e 100755
--- a/py/test/Ice/objects/Collocated.py
+++ b/py/test/Ice/objects/Collocated.py
@@ -24,7 +24,7 @@ def run(args, communicator):
adapter.add(uoet, communicator.stringToIdentity("uoet"))
adapter.activate()
- AllTests.allTests(communicator, True)
+ AllTests.allTests(communicator)
# We must call shutdown even in the collocated case for cyclic dependency cleanup
initial.shutdown()
diff --git a/py/test/Ice/operations/AllTests.py b/py/test/Ice/operations/AllTests.py
index 10dffa0caa7..8958121f919 100644
--- a/py/test/Ice/operations/AllTests.py
+++ b/py/test/Ice/operations/AllTests.py
@@ -13,7 +13,7 @@ def test(b):
if not b:
raise RuntimeError('test assertion failed')
-def allTests(communicator, collocated):
+def allTests(communicator):
ref = "test:default -p 12010"
base = communicator.stringToProxy(ref)
cl = Test.MyClassPrx.checkedCast(base)
@@ -31,31 +31,30 @@ def allTests(communicator, collocated):
Oneways.oneways(communicator, cl)
print("ok")
- if not collocated:
- sys.stdout.write("testing twoway operations with AMI... ")
- sys.stdout.flush()
- TwowaysAMI.twowaysAMI(communicator, cl)
- print("ok")
-
- sys.stdout.write("testing twoway operations with new AMI mapping... ")
- sys.stdout.flush()
- TwowaysNewAMI.twowaysNewAMI(communicator, cl)
- print("ok")
-
- sys.stdout.write("testing oneway operations with AMI... ")
- sys.stdout.flush()
- OnewaysAMI.onewaysAMI(communicator, cl)
- print("ok")
-
- sys.stdout.write("testing oneway operations with new AMI mapping... ")
- sys.stdout.flush()
- OnewaysNewAMI.onewaysNewAMI(communicator, cl)
- print("ok")
-
- sys.stdout.write("testing batch oneway operations... ")
- sys.stdout.flush()
- BatchOneways.batchOneways(cl)
- BatchOneways.batchOneways(derived)
- print("ok")
-
+ sys.stdout.write("testing twoway operations with AMI... ")
+ sys.stdout.flush()
+ TwowaysAMI.twowaysAMI(communicator, cl)
+ print("ok")
+
+ sys.stdout.write("testing twoway operations with new AMI mapping... ")
+ sys.stdout.flush()
+ TwowaysNewAMI.twowaysNewAMI(communicator, cl)
+ print("ok")
+
+ sys.stdout.write("testing oneway operations with AMI... ")
+ sys.stdout.flush()
+ OnewaysAMI.onewaysAMI(communicator, cl)
+ print("ok")
+
+ sys.stdout.write("testing oneway operations with new AMI mapping... ")
+ sys.stdout.flush()
+ OnewaysNewAMI.onewaysNewAMI(communicator, cl)
+ print("ok")
+
+ sys.stdout.write("testing batch oneway operations... ")
+ sys.stdout.flush()
+ BatchOneways.batchOneways(cl)
+ BatchOneways.batchOneways(derived)
+ print("ok")
+
return cl
diff --git a/py/test/Ice/operations/BatchOneways.py b/py/test/Ice/operations/BatchOneways.py
index 39e390ba0b8..c5e80c9bdd6 100644
--- a/py/test/Ice/operations/BatchOneways.py
+++ b/py/test/Ice/operations/BatchOneways.py
@@ -59,36 +59,37 @@ def batchOneways(p):
except Ice.MemoryLimitException:
test(False)
- batch.ice_getConnection().flushBatchRequests()
+ if p.ice_getConnection():
+ batch.ice_getConnection().flushBatchRequests()
- batch2 = Test.MyClassPrx.uncheckedCast(p.ice_batchOneway())
+ batch2 = Test.MyClassPrx.uncheckedCast(p.ice_batchOneway())
- batch.ice_ping()
- batch2.ice_ping()
- batch.ice_flushBatchRequests()
- batch.ice_getConnection().close(False)
- batch.ice_ping()
- batch2.ice_ping()
+ batch.ice_ping()
+ batch2.ice_ping()
+ batch.ice_flushBatchRequests()
+ batch.ice_getConnection().close(False)
+ batch.ice_ping()
+ batch2.ice_ping()
+
+ batch.ice_getConnection()
+ batch2.ice_getConnection()
+
+ batch.ice_ping()
+ batch.ice_getConnection().close(False)
+ try:
+ batch.ice_ping()
+ test(False)
+ except Ice.CloseConnectionException:
+ pass
- batch.ice_getConnection()
- batch2.ice_getConnection()
+ try:
+ batch2.ice_ping()
+ test(False)
+ except Ice.CloseConnectionException:
+ pass
- batch.ice_ping()
- batch.ice_getConnection().close(False)
- try:
batch.ice_ping()
- test(False)
- except Ice.CloseConnectionException:
- pass
-
- try:
batch2.ice_ping()
- test(False)
- except Ice.CloseConnectionException:
- pass
-
- batch.ice_ping()
- batch2.ice_ping()
identity = Ice.Identity()
identity.name = "invalid";
diff --git a/py/test/Ice/operations/Client.py b/py/test/Ice/operations/Client.py
index b7e7e7aa870..e9eaf2797bb 100755
--- a/py/test/Ice/operations/Client.py
+++ b/py/test/Ice/operations/Client.py
@@ -25,7 +25,7 @@ def test(b):
raise RuntimeError('test assertion failed')
def run(args, communicator):
- myClass = AllTests.allTests(communicator, False)
+ myClass = AllTests.allTests(communicator)
sys.stdout.write("testing server shutdown... ")
sys.stdout.flush()
diff --git a/py/test/Ice/operations/Collocated.py b/py/test/Ice/operations/Collocated.py
index 19268c4863f..33aac07e2a3 100755
--- a/py/test/Ice/operations/Collocated.py
+++ b/py/test/Ice/operations/Collocated.py
@@ -22,16 +22,27 @@ import Test, TestI, AllTests
def run(args, communicator):
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010")
adapter = communicator.createObjectAdapter("TestAdapter")
- adapter.add(TestI.MyDerivedClassI(), communicator.stringToIdentity("test"))
+ prx = adapter.add(TestI.MyDerivedClassI(), communicator.stringToIdentity("test"))
adapter.activate()
- AllTests.allTests(communicator, True)
+ if prx.ice_getConnection():
+ raise RuntimeError("collocation doesn't work")
+
+ cl = AllTests.allTests(communicator)
return True
try:
initData = Ice.InitializationData()
initData.properties = Ice.createProperties(sys.argv)
+
+ #
+ # We must set MessageSizeMax to an explicit values, because
+ # we run tests to check whether Ice.MemoryLimitException is
+ # raised as expected.
+ #
+ initData.properties.setProperty("Ice.MessageSizeMax", "100")
+
communicator = Ice.initialize(sys.argv, initData)
status = run(sys.argv, communicator)
except:
diff --git a/py/test/Ice/proxy/AllTests.py b/py/test/Ice/proxy/AllTests.py
index b28fbcb807f..cb5c2276d5b 100644
--- a/py/test/Ice/proxy/AllTests.py
+++ b/py/test/Ice/proxy/AllTests.py
@@ -280,17 +280,12 @@ def allTests(communicator, collocated):
b1 = communicator.propertyToProxy(propertyPrefix)
test(b1.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered)
prop.setProperty(property, "")
-
- #
- # isCollocationOptimized is not implemented because the
- # collocation optimization is permanently disabled with IcePy.
- #
- #property = propertyPrefix + ".CollocationOptimized"
- #test(b1.ice_isCollocationOptimized())
- #prop.setProperty(property, "0")
- #b1 = communicator.propertyToProxy(propertyPrefix)
- #test(not b1.ice_isCollocationOptimized())
- #prop.setProperty(property, "")
+ property = propertyPrefix + ".CollocationOptimized"
+ test(b1.ice_isCollocationOptimized())
+ prop.setProperty(property, "0")
+ b1 = communicator.propertyToProxy(propertyPrefix)
+ test(not b1.ice_isCollocationOptimized())
+ prop.setProperty(property, "")
print("ok")
@@ -298,7 +293,7 @@ def allTests(communicator, collocated):
sys.stdout.flush()
b1 = communicator.stringToProxy("test")
- #b1 = b1.ice_collocationOptimized(True)
+ b1 = b1.ice_collocationOptimized(True)
b1 = b1.ice_connectionCached(True)
b1 = b1.ice_preferSecure(False)
b1 = b1.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)
@@ -307,7 +302,7 @@ def allTests(communicator, collocated):
b1 = b1.ice_encodingVersion(Ice.EncodingVersion(1, 0))
router = communicator.stringToProxy("router")
- #router = router.ice_collocationOptimized(False)
+ router = router.ice_collocationOptimized(False)
router = router.ice_connectionCached(True)
router = router.ice_preferSecure(True)
router = router.ice_endpointSelection(Ice.EndpointSelectionType.Random)
@@ -315,7 +310,7 @@ def allTests(communicator, collocated):
router = router.ice_invocationTimeout(1500);
locator = communicator.stringToProxy("locator")
- #locator = locator.ice_collocationOptimized(True)
+ locator = locator.ice_collocationOptimized(True)
locator = locator.ice_connectionCached(False)
locator = locator.ice_preferSecure(True)
locator = locator.ice_endpointSelection(Ice.EndpointSelectionType.Random)
@@ -329,7 +324,7 @@ def allTests(communicator, collocated):
test(len(proxyProps) == 21)
test(proxyProps["Test"] == "test -t -e 1.0")
- #test(proxyProps["Test.CollocationOptimized"] == "1")
+ test(proxyProps["Test.CollocationOptimized"] == "1")
test(proxyProps["Test.ConnectionCached"] == "1")
test(proxyProps["Test.PreferSecure"] == "0")
test(proxyProps["Test.EndpointSelection"] == "Ordered")
@@ -337,7 +332,7 @@ def allTests(communicator, collocated):
test(proxyProps["Test.InvocationTimeout"] == "1234");
test(proxyProps["Test.Locator"] == "locator -t -e " + Ice.encodingVersionToString(Ice.currentEncoding()))
- #test(proxyProps["Test.Locator.CollocationOptimized"] == "1")
+ test(proxyProps["Test.Locator.CollocationOptimized"] == "1")
test(proxyProps["Test.Locator.ConnectionCached"] == "0")
test(proxyProps["Test.Locator.PreferSecure"] == "1")
test(proxyProps["Test.Locator.EndpointSelection"] == "Random")
@@ -345,7 +340,7 @@ def allTests(communicator, collocated):
test(proxyProps["Test.Locator.InvocationTimeout"] == "1500");
test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice.encodingVersionToString(Ice.currentEncoding()))
- #test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0")
+ test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0")
test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1")
test(proxyProps["Test.Locator.Router.PreferSecure"] == "1")
test(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random")
@@ -374,8 +369,8 @@ def allTests(communicator, collocated):
test(base.ice_batchDatagram().ice_isBatchDatagram())
test(base.ice_secure(True).ice_isSecure())
test(not base.ice_secure(False).ice_isSecure())
- #test(base.ice_collocationOptimized(True)->ice_isCollocationOptimized())
- #test(!base.ice_collocationOptimized(False)->ice_isCollocationOptimized())
+ test(base.ice_collocationOptimized(True).ice_isCollocationOptimized())
+ test(not base.ice_collocationOptimized(False).ice_isCollocationOptimized())
test(base.ice_preferSecure(True).ice_isPreferSecure())
test(not base.ice_preferSecure(False).ice_isPreferSecure())
test(base.ice_encodingVersion(Ice.Encoding_1_0).ice_getEncodingVersion() == Ice.Encoding_1_0)
@@ -408,10 +403,10 @@ def allTests(communicator, collocated):
test(compObj.ice_secure(False) < compObj.ice_secure(True))
test(not (compObj.ice_secure(True) < compObj.ice_secure(False)))
- #test(compObj.ice_collocationOptimized(True) == compObj.ice_collocationOptimized(True))
- #test(compObj.ice_collocationOptimized(False) != compObj.ice_collocationOptimized(True))
- #test(compObj.ice_collocationOptimized(False) < compObj.ice_collocationOptimized(True))
- #test(!(compObj.ice_collocationOptimized(True) < compObj.ice_collocationOptimized(False)))
+ test(compObj.ice_collocationOptimized(True) == compObj.ice_collocationOptimized(True))
+ test(compObj.ice_collocationOptimized(False) != compObj.ice_collocationOptimized(True))
+ test(compObj.ice_collocationOptimized(False) < compObj.ice_collocationOptimized(True))
+ test(not (compObj.ice_collocationOptimized(True) < compObj.ice_collocationOptimized(False)))
test(compObj.ice_connectionCached(True) == compObj.ice_connectionCached(True))
test(compObj.ice_connectionCached(False) != compObj.ice_connectionCached(True))
diff --git a/py/test/Ice/servantLocator/AllTests.py b/py/test/Ice/servantLocator/AllTests.py
index 673012906a5..5355242a5db 100644
--- a/py/test/Ice/servantLocator/AllTests.py
+++ b/py/test/Ice/servantLocator/AllTests.py
@@ -19,10 +19,9 @@ def testExceptions(obj, collocated):
obj.requestFailedException()
test(False)
except Ice.ObjectNotExistException as ex:
- if not collocated:
- test(ex.id == obj.ice_getIdentity())
- test(ex.facet == obj.ice_getFacet())
- test(ex.operation == "requestFailedException")
+ test(ex.id == obj.ice_getIdentity())
+ test(ex.facet == obj.ice_getFacet())
+ test(ex.operation == "requestFailedException")
except:
test(False)
diff --git a/py/test/Ice/timeout/AllTests.py b/py/test/Ice/timeout/AllTests.py
index b5df795245a..2759da27f74 100644
--- a/py/test/Ice/timeout/AllTests.py
+++ b/py/test/Ice/timeout/AllTests.py
@@ -45,7 +45,7 @@ class Callback(CallbackBase):
test(isinstance(ex, Ice.TimeoutException))
self.called()
-def allTests(communicator, collocated):
+def allTests(communicator):
sref = "timeout:default -p 12010"
obj = communicator.stringToProxy(sref)
test(obj != None)
diff --git a/py/test/Ice/timeout/Client.py b/py/test/Ice/timeout/Client.py
index 71113828f45..6b6e1b6445e 100755
--- a/py/test/Ice/timeout/Client.py
+++ b/py/test/Ice/timeout/Client.py
@@ -23,7 +23,7 @@ def test(b):
raise RuntimeError('test assertion failed')
def run(args, communicator):
- timeout = AllTests.allTests(communicator, False)
+ timeout = AllTests.allTests(communicator)
timeout.shutdown()
return True
diff --git a/slice/Ice/Instrumentation.ice b/slice/Ice/Instrumentation.ice
index ffc198fd37d..ce9aba5d2b2 100644
--- a/slice/Ice/Instrumentation.ice
+++ b/slice/Ice/Instrumentation.ice
@@ -222,11 +222,11 @@ local interface DispatchObserver extends Observer
/**
*
- * The remote invocation observer to instrument invocations that go
- * over the wire.
+ * The child invocation observer to instrument remote or collocated
+ * invocations.
*
**/
-local interface RemoteObserver extends Observer
+local interface ChildInvocationObserver extends Observer
{
/**
*
@@ -238,22 +238,25 @@ local interface RemoteObserver extends Observer
void reply(int size);
};
+
/**
*
- * The collocated invocation observer to instrument invocations that
- * are collocated
+ * The remote observer to instrument invocations that are sent over
+ * the wire.
*
- **/
-local interface CollocatedObserver extends Observer
+ **/
+local interface RemoteObserver extends ChildInvocationObserver
+{
+};
+
+/**
+ *
+ * The collocated observer to instrument invocations that are
+ * collocated.
+ *
+ **/
+local interface CollocatedObserver extends ChildInvocationObserver
{
- /**
- *
- * Reply notification.
- *
- * @param size The size of the reply.
- *
- **/
- void reply(int size);
};
/**
@@ -301,6 +304,8 @@ local interface InvocationObserver extends Observer
*
* Get a collocated observer for this invocation.
*
+ * @param adapter The object adapter hosting the collocated Ice object.
+ *
* @param requestId The ID of the invocation.
*
* @param size The size of the invocation.
@@ -308,7 +313,7 @@ local interface InvocationObserver extends Observer
* @return The observer to instrument the collocated invocation.
*
**/
- RemoteObserver getCollocatedObserver(int requestId, int size);
+ CollocatedObserver getCollocatedObserver(ObjectAdapter adapter, int requestId, int size);
};
/**
diff --git a/slice/Ice/Metrics.ice b/slice/Ice/Metrics.ice
index fe60b5417a3..4ac744647de 100644
--- a/slice/Ice/Metrics.ice
+++ b/slice/Ice/Metrics.ice
@@ -304,12 +304,14 @@ class DispatchMetrics extends Metrics
/**
*
- * Provides information on invocations that are specifically sent over
- * Ice connections. Remote metrics are embedded within {@link
+ * Provides information on child invocations. A child invocation is
+ * either remote (sent over an Ice connection) or collocated. An
+ * invocation can have multiple child invocation if it is
+ * retried. Child invocation metrics are embedded within {@link
* InvocationMetrics}.
*
**/
-class RemoteMetrics extends Metrics
+class ChildInvocationMetrics extends Metrics
{
/**
*
@@ -330,10 +332,29 @@ class RemoteMetrics extends Metrics
/**
*
+ * Provides information on invocations that are collocated. Collocated
+ * metrics are embedded within {@link InvocationMetrics}.
+ *
+ **/
+class CollocatedMetrics extends ChildInvocationMetrics
+{
+};
+
+/**
+ *
+ * Provides information on invocations that are specifically sent over
+ * Ice connections. Remote metrics are embedded within {@link
+ * InvocationMetrics}.
+ *
+ **/
+class RemoteMetrics extends ChildInvocationMetrics
+{
+};
+
+/**
+ *
* Provide measurements for proxy invocations. Proxy invocations can
- * either be sent over the wire or be collocated. The metrics for
- * invocations sent over the wire are specifically measured with
- * {@link RemoteMetrics}.
+ * either be sent over the wire or be collocated.
*
**/
class InvocationMetrics extends Metrics
@@ -360,6 +381,15 @@ class InvocationMetrics extends Metrics
*
**/
MetricsMap remotes;
+
+ /**
+ *
+ * The collocated invocation metrics map.
+ *
+ * @see CollocatedMetrics
+ *
+ **/
+ MetricsMap collocated;
};
/**