summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-07-01 17:42:04 +0200
committerBenoit Foucher <benoit@zeroc.com>2014-07-01 17:42:04 +0200
commit344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8 (patch)
treebd06f4919e5a5827f60e2a536e43e47a4fbed6d2 /java
parentFixed ICE-5569: IceStorm IceMX debug iterator assert (diff)
downloadice-344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8.tar.bz2
ice-344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8.tar.xz
ice-344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8.zip
IceMX and Python support for the new collocation optimization
Diffstat (limited to 'java')
-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
20 files changed, 700 insertions, 444 deletions
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;
}