Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2016-04-01 16:03:31 +0000
committerslewis2016-04-01 16:03:31 +0000
commit75375fd80f47454aa064880633d33f1337280cde (patch)
tree064d8a44ce79525350139df4e982dde3c12cbd3d /framework
parent609320fc563dc1d5f7f8df39e227d2a3a3f2fbed (diff)
downloadorg.eclipse.ecf-75375fd80f47454aa064880633d33f1337280cde.tar.gz
org.eclipse.ecf-75375fd80f47454aa064880633d33f1337280cde.tar.xz
org.eclipse.ecf-75375fd80f47454aa064880633d33f1337280cde.zip
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=490920
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
index 53ca8a534..4c6acb7c4 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
@@ -30,10 +30,10 @@ public final class Client implements ISynchAsynchConnection {
public static final int DEFAULT_SNDR_PRIORITY = Thread.NORM_PRIORITY;
public static final int DEFAULT_RCVR_PRIORITY = Thread.NORM_PRIORITY;
// Default close timeout is 2 seconds
- public static final long DEFAULT_CLOSE_TIMEOUT = 2000;
+ public static final long DEFAULT_CLOSE_TIMEOUT = Integer.parseInt(System.getProperty("org.eclipse.ecf.provider.comm.tcp.client.closetimeout", "2000")); //$NON-NLS-1$ //$NON-NLS-2$
// Default maximum cached messages on object stream is 50
- public static final int DEFAULT_MAX_BUFFER_MSG = 50;
- public static final int DEFAULT_WAIT_INTERVAL = 10;
+ public static final int DEFAULT_MAX_BUFFER_MSG = Integer.parseInt(System.getProperty("org.eclipse.ecf.provider.comm.tcp.client.maxmsgs", "50")); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final int DEFAULT_WAIT_INTERVAL = Integer.parseInt(System.getProperty("org.eclipse.ecf.provider.comm.tcp.client.waitinterval", "10")); //$NON-NLS-1$ //$NON-NLS-2$
protected Socket socket;
private String addressPort = "-1:<no endpoint>:-1"; //$NON-NLS-1$
// Underlying streams
@@ -58,6 +58,7 @@ public final class Client implements ISynchAsynchConnection {
boolean disconnectHandled = false;
private final Object disconnectLock = new Object();
protected final Object outputStreamLock = new Object();
+ private int maxmsgs = DEFAULT_MAX_BUFFER_MSG;
private String getHostNameForAddressWithoutLookup(InetAddress inetAddress) {
// First get InetAddress.toString(), which returns
@@ -105,6 +106,7 @@ public final class Client implements ISynchAsynchConnection {
this.handler = handler;
containerID = handler.getEventHandlerID();
properties = new Properties();
+ this.maxmsgs = maxmsgs;
setupThreads();
}
@@ -306,10 +308,17 @@ public final class Client implements ISynchAsynchConnection {
}
}
+ private int resetCounter = 0;
+
void send(Serializable snd) throws IOException {
synchronized (outputStreamLock) {
outputStream.writeObject(snd);
outputStream.flush();
+ if (resetCounter > this.maxmsgs) {
+ outputStream.reset();
+ resetCounter = 0;
+ } else
+ resetCounter++;
}
}

Back to the top