db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: rev 55537 - in incubator/derby/code/trunk/java: drda/org/apache/derby/impl/drda engine/org/apache/derby/iapi/reference
Date Mon, 25 Oct 2004 22:18:22 GMT
Author: kmarsden
Date: Mon Oct 25 15:18:21 2004
New Revision: 55537

Modified:
   incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java
   incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java
Log:
Set keepAlive on by default add static property derby.drda.keepAlive to 
allow keepAlive to be turned off.



Modified: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java
==============================================================================
--- incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java	(original)
+++ incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java	Mon
Oct 25 15:18:21 2004
@@ -59,9 +59,10 @@
 								return serverSocket.accept();
 							}
 						}
-					);
-					//set time out
-					
+					 );
+							clientSocket.setKeepAlive(parent.getKeepAlive());
+					//set time out					
+					//this looks highly suspect.  Why does timeSlice setSoTimeout?		
 					if (timeSlice != 0)
 						clientSocket.setSoTimeout(timeSlice);
 				} catch (PrivilegedActionException e) {

Modified: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java
==============================================================================
--- incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java	(original)
+++ incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java	Mon
Oct 25 15:18:21 2004
@@ -239,6 +239,7 @@
 	private Object timeSliceSync = new Object();// object to use for syncing reading
 										// and changing timeSlice
 
+	private boolean keepAlive = true;   // keepAlive value for client socket 
 	private int minPoolSize;			//minimum pool size for pooled connections
 	private int maxPoolSize;			//maximum pool size for pooled connections
 	private Object poolSync = new Object();	// object to use for syning reading
@@ -2513,6 +2514,12 @@
 			portNumber = getIntPropVal(Property.DRDA_PROP_PORTNUMBER, propval);
 
 		propval = PropertyUtil.getSystemProperty( 
+			Property.DRDA_PROP_KEEPALIVE);
+		if (propval != null && 
+			StringUtil.SQLEqualsIgnoreCase(propval,"false"))
+			keepAlive = false;
+		
+		propval = PropertyUtil.getSystemProperty( 
 			Property.DRDA_PROP_HOSTNAME);
 		if (propval != null)
 			hostArg = propval;
@@ -2568,6 +2575,7 @@
 		}
 		return val;
 	}
+
 	/**
 	 * Handle console error message
 	 * 	- display on console and if it is a user error, display usage
@@ -2944,6 +2952,15 @@
 			timeSlice = value;
 		}
 	}
+	
+	/** 
+	 * Get the current value of keepAlive to configure how long the server
+	 * should keep the socket alive for a disconnected client
+	 */
+	protected boolean getKeepAlive()
+	{
+		return keepAlive;
+	}
 
 	/**
 	 * Get the current value of minimum number of threads to create at start
@@ -3006,6 +3023,7 @@
 			return minPoolSize;
 		}
 	}
+
 	/**
 	 * Set the current value of minimum number of pooled connections to create at start
 	 *
@@ -3017,6 +3035,7 @@
 			minPoolSize = value;
 		}
 	}
+	
 	/**
 	 * Get the current value of maximum number of pooled connections to create 
 	 *
@@ -3245,6 +3264,8 @@
 		Properties retval = new Properties();
 		retval.put(Property.DRDA_PROP_PORTNUMBER, new Integer(portNumber).toString());
 		retval.put(Property.DRDA_PROP_HOSTNAME, hostArg);
+		retval.put(Property.DRDA_PROP_KEEPALIVE, new Boolean(keepAlive).toString());
+
 		String tracedir = getTraceDirectory();
 		if (tracedir != null)
 			retval.put(Property.DRDA_PROP_TRACEDIRECTORY, tracedir);

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java	(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java	Mon
Oct 25 15:18:21 2004
@@ -678,7 +678,14 @@
 	public final static String DRDA_PROP_PORTNUMBER = "derby.drda.portNumber";
 	public final static String DRDA_PROP_HOSTNAME = "derby.drda.host";
 
-
+	/**
+	 * derby.drda.keepAlive
+	 *
+	 *<BR>
+	 * client socket setKeepAlive value
+	 */
+	public final static String DRDA_PROP_KEEPALIVE = "derby.drda.keepAlive";
+	
 	/*
 	** Internal properties, mainly used by Monitor.
 	*/

Mime
View raw message