From 344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Tue, 1 Jul 2014 17:42:04 +0200 Subject: IceMX and Python support for the new collocation optimization --- java/src/IceInternal/InvocationObserverI.java | 32 +++++++++++++-------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'java/src/IceInternal/InvocationObserverI.java') 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 + static public final class CollocatedInvocationHelper extends MetricsHelper { 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 _incrementRetry = new MetricsUpdate() -- cgit v1.2.3