summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/InvocationObserverI.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-06-27 10:31:41 +0200
committerBenoit Foucher <benoit@zeroc.com>2014-06-27 10:31:41 +0200
commita4f93259dc3494d98addf38e69b87eb557d432b3 (patch)
treed2b78bb5cea24e33dc1b46be22dba6167e96c9ed /java/src/IceInternal/InvocationObserverI.java
parentFix for ICE-5515 (ice_staticId on proxies) in Java, C#, Python, Ruby and PHP ... (diff)
downloadice-a4f93259dc3494d98addf38e69b87eb557d432b3.tar.bz2
ice-a4f93259dc3494d98addf38e69b87eb557d432b3.tar.xz
ice-a4f93259dc3494d98addf38e69b87eb557d432b3.zip
Better collocation optimization, fix for ICE-5489, ICE-5484
Diffstat (limited to 'java/src/IceInternal/InvocationObserverI.java')
-rw-r--r--java/src/IceInternal/InvocationObserverI.java133
1 files changed, 104 insertions, 29 deletions
diff --git a/java/src/IceInternal/InvocationObserverI.java b/java/src/IceInternal/InvocationObserverI.java
index e47f6670df3..7997a22d9d0 100644
--- a/java/src/IceInternal/InvocationObserverI.java
+++ b/java/src/IceInternal/InvocationObserverI.java
@@ -18,24 +18,24 @@ public class InvocationObserverI
static public final class RemoteInvocationHelper extends MetricsHelper<RemoteMetrics>
{
static private final AttributeResolver _attributes = new AttributeResolver()
- {
+ {
+ {
+ try
{
- try
- {
- Class<?> cl = RemoteInvocationHelper.class;
- add("parent", cl.getDeclaredMethod("getParent"));
- add("id", cl.getDeclaredMethod("getId"));
- add("requestId", cl.getDeclaredMethod("getRequestId"));
- CommunicatorObserverI.addConnectionAttributes(this, RemoteInvocationHelper.class);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- assert(false);
- }
+ Class<?> cl = RemoteInvocationHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+ add("requestId", cl.getDeclaredMethod("getRequestId"));
+ CommunicatorObserverI.addConnectionAttributes(this, RemoteInvocationHelper.class);
}
- };
-
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
RemoteInvocationHelper(Ice.ConnectionInfo con, Ice.Endpoint endpt, int requestId, int size)
{
super(_attributes);
@@ -114,6 +114,66 @@ public class InvocationObserverI
private Ice.EndpointInfo _endpointInfo;
};
+ static public final class CollocatedInvocationHelper extends MetricsHelper<RemoteMetrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ Class<?> cl = CollocatedInvocationHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+ add("requestId", cl.getDeclaredMethod("getRequestId"));
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ CollocatedInvocationHelper(int requestId, int size)
+ {
+ super(_attributes);
+ _requestId = requestId;
+ _size = size;
+ }
+
+ public void
+ initMetrics(RemoteMetrics v)
+ {
+ v.size += _size;
+ }
+
+ public String
+ getId()
+ {
+ if(_id == null)
+ {
+ _id = Integer.toString(_requestId);
+ }
+ return _id;
+ }
+
+ int
+ getRequestId()
+ {
+ return _requestId;
+ }
+
+ public String
+ getParent()
+ {
+ return "Communicator";
+ }
+
+ final private int _requestId;
+ final private int _size;
+ private String _id;
+ };
+
public void
userException()
{
@@ -149,21 +209,36 @@ public class InvocationObserverI
delegate);
}
+ public Ice.Instrumentation.RemoteObserver
+ getCollocatedObserver(int requestId, int sz)
+ {
+ Ice.Instrumentation.RemoteObserver delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getCollocatedObserver(requestId, sz);
+ }
+ return (Ice.Instrumentation.RemoteObserver)getObserver("Collocated",
+ new CollocatedInvocationHelper(requestId, sz),
+ RemoteMetrics.class,
+ RemoteObserverI.class,
+ delegate);
+ }
+
final MetricsUpdate<InvocationMetrics> _incrementRetry = new MetricsUpdate<InvocationMetrics>()
+ {
+ public void
+ update(InvocationMetrics v)
{
- public void
- update(InvocationMetrics v)
- {
- ++v.retry;
- }
- };
+ ++v.retry;
+ }
+ };
final MetricsUpdate<InvocationMetrics> _userException = new MetricsUpdate<InvocationMetrics>()
+ {
+ public void
+ update(InvocationMetrics v)
{
- public void
- update(InvocationMetrics v)
- {
- ++v.userException;
- }
- };
-} \ No newline at end of file
+ ++v.userException;
+ }
+ };
+}