Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2015-08-04 20:45:58 +0000
committerslewis2015-08-04 20:45:58 +0000
commitdeadf47a0555767f285a2af630eed08f6e21274f (patch)
treec6c91ff51602994c5a90d9d0547806e62d582f5d /protocols/bundles/ch.ethz.iks.r_osgi.remote
parentdb6d57f6f677c55ed191bbb277cb37d5086207ab (diff)
downloadorg.eclipse.ecf-deadf47a0555767f285a2af630eed08f6e21274f.tar.gz
org.eclipse.ecf-deadf47a0555767f285a2af630eed08f6e21274f.tar.xz
org.eclipse.ecf-deadf47a0555767f285a2af630eed08f6e21274f.zip
Added timing/tracing of sendMessage call in CnannelEndpointImpl.
Diffstat (limited to 'protocols/bundles/ch.ethz.iks.r_osgi.remote')
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
index a9e5cfdbb..aede23476 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
@@ -981,6 +981,24 @@ public final class ChannelEndpointImpl implements ChannelEndpoint {
}
}
+ private long startTime;
+
+ public static final boolean TRACE_TIME = new Boolean(System.getProperty("ch.ethz.iks.r_osgi.traceSendMessageTime","false")).booleanValue();
+
+ void startTiming(String message) {
+ if (TRACE_TIME) {
+ startTime = System.currentTimeMillis();
+ System.out.println("TIMING.START;"+(message==null?"":message)+";startTime="+startTime);
+ }
+ }
+
+ void stopTiming(String message, Throwable exception) {
+ if (TRACE_TIME) {
+ System.out.println("TIMING.END;"+(message==null?"":message)+";duration="+(System.currentTimeMillis()-startTime));
+ startTime = 0;
+ }
+ }
+
/**
* send a message.
*
@@ -996,6 +1014,9 @@ public final class ChannelEndpointImpl implements ChannelEndpoint {
msg.setXID(RemoteOSGiServiceImpl.nextXid());
}
+ Throwable t = null;
+ startTiming("sendMessage");
+
try {
try {
networkChannel.sendMessage(msg);
@@ -1014,11 +1035,15 @@ public final class ChannelEndpointImpl implements ChannelEndpoint {
}
}
} catch (final NotSerializableException nse) {
- throw new RemoteOSGiException("Error sending " + msg, nse); //$NON-NLS-1$
+ t = new RemoteOSGiException("Error sending " + msg, nse); //$NON-NLS-1$
+ throw ((RemoteOSGiException) t);
} catch (final IOException ioe) {
// failed to reconnect...
dispose();
- throw new RemoteOSGiException("Network error", ioe); //$NON-NLS-1$
+ t = new RemoteOSGiException("Network error", ioe); //$NON-NLS-1$
+ throw ((RemoteOSGiException) t);
+ } finally {
+ stopTiming("sendMessage",t);
}
}

Back to the top