aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjestin2012-02-20 16:08:12 +0000
committerjestin2012-02-20 16:08:12 +0000
commit26a6343bdf7a4e3f8e93f27e6982d7b923eafc7c (patch)
tree4e467382ce613ce197efe75db3f49be9da3e8faf
parent9c55bfcc68930a906cf1485d484045094f005cdb (diff)
downloadivy-java-26a6343bdf7a4e3f8e93f27e6982d7b923eafc7c.zip
ivy-java-26a6343bdf7a4e3f8e93f27e6982d7b923eafc7c.tar.gz
ivy-java-26a6343bdf7a4e3f8e93f27e6982d7b923eafc7c.tar.bz2
ivy-java-26a6343bdf7a4e3f8e93f27e6982d7b923eafc7c.tar.xz
reduced the default buffer size
-rw-r--r--Changelog11
-rw-r--r--build.xml2
-rwxr-xr-xsrc/Ivy.java18
-rwxr-xr-xsrc/IvyWatcher.java5
4 files changed, 34 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index 42cc88e..de1f100 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,15 @@
--------------------------------------------------------------------
+1.2.15
+
+ Internals:
+ - sets the default buffersize to 4096 bytes. This can be adjusted
+ through the use of the IVY_BUFFERSIZE jvm property (java
+ -DIVY_BUFFERSIZE=200 , e.g. ) This is intended to be similar to the
+ ivy C implementation, and *should* fix the buffering issues of
+ applications requiring a lot of small data exchanges (e.g:
+ transmitting mouse mouve at a high rate).
+
+--------------------------------------------------------------------
1.2.14
New API:
diff --git a/build.xml b/build.xml
index 71bae75..9c37e07 100644
--- a/build.xml
+++ b/build.xml
@@ -1,6 +1,6 @@
<project name="ivy-java" basedir="." default="main">
- <property name="version" value="1.2.14"/>
+ <property name="version" value="1.2.15"/>
<property name="defaultbus" value="-DIVYBUS=224.5.6.7:8910" />
<property name="src.dir" value="src"/>
diff --git a/src/Ivy.java b/src/Ivy.java
index b147af3..2196321 100755
--- a/src/Ivy.java
+++ b/src/Ivy.java
@@ -15,6 +15,9 @@
*</pre>
*
* CHANGELOG:
+ * 1.2.15
+ * - allows the fine tuning of the IvyClient socket buffersize using
+ * IVY_BUFFERSIZE property
* 1.2.14
* - added a lock mechanism to be sure that once a connexion has been
* initiated, the ready message will be sent before stopping the bus
@@ -138,6 +141,14 @@ public class Ivy implements Runnable {
* the port for the UDP rendez vous, if none is supplied.
*/
public static final int DEFAULT_PORT = 2010;
+
+ /**
+ * the default size of the IvyClients' socket buffer
+ * defaults to 4096, can be adjusted through the use of IVY_BUFFERSIZE JVM
+ * property
+ */
+
+ private static final int PREFFERREDBUFFERSIZE = 4096; // in bytes
/**
* the domain for the UDP rendez vous.
*/
@@ -146,13 +157,14 @@ public class Ivy implements Runnable {
* the library version, useful for development purposes only, when java is
* invoked with -DIVY_DEBUG
*/
- public static final String LIBVERSION ="1.2.14";
+ public static final String LIBVERSION ="1.2.15";
public static final int TIMEOUTLENGTH = 1000;
private String appName;
private int applicationPort; /* Application port number */
private String ready_message = null;
private boolean doProtectNewlines = false;
+ private int bufferSize = PREFFERREDBUFFERSIZE ;
private SelfIvyClient selfIvyClient;
private Object lockApp = new Object();
private boolean debug;
@@ -196,6 +208,8 @@ public class Ivy implements Runnable {
debug =
(System.getProperty("IVY_DEBUG") != null)
|| (System.getProperty("IVY_DEBUG") != null);
+ if (System.getProperty("IVY_BUFFERSIZE") != null)
+ bufferSize = Integer.parseInt(System.getProperty("IVY_BUFFERSIZE"));
if ( appcb != null ) {
ivyApplicationListenerList.addElement( appcb );
}
@@ -940,6 +954,8 @@ public class Ivy implements Runnable {
}
protected String getWatcherId() { return watcherId; }
+ protected int getBufferSize() { return bufferSize; }
+
protected int getSerial() { return myserial; }
private void traceDebug(String s){
if (debug) System.out.println("-->Ivy[" + myserial + "]<-- " + s);
diff --git a/src/IvyWatcher.java b/src/IvyWatcher.java
index 5a47da3..1e33302 100755
--- a/src/IvyWatcher.java
+++ b/src/IvyWatcher.java
@@ -14,6 +14,9 @@
* thing.
*
* CHANGELOG:
+ * 1.2.15
+ * - allows the fine tuning of the IvyClient socket buffersize using
+ * IVY_BUFFERSIZE property
* 1.2.14
* - tries to fix a lock on accept() by becoming a Thread instead of
* runnalbe (see tests/test2)
@@ -191,6 +194,8 @@ class IvyWatcher extends Thread {
traceDebug("no known agent originating from " + remotehost + ":" + remotePort);
try {
Socket s = new Socket(remotehost,remotePort);
+ s.setReceiveBufferSize(bus.getBufferSize());
+ System.out.println("MY DEBUG - buffer size="+s.getReceiveBufferSize());
s.setTcpNoDelay(true);
bus.createIvyClient(s,remotePort,false);
} catch ( java.net.ConnectException jnc ) {