From 26a6343bdf7a4e3f8e93f27e6982d7b923eafc7c Mon Sep 17 00:00:00 2001 From: jestin Date: Mon, 20 Feb 2012 16:08:12 +0000 Subject: reduced the default buffer size --- src/Ivy.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/Ivy.java') 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 @@ * * * 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); -- cgit v1.1