Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12142/src/java/org/logicalcobwebs/proxool
Modified Files:
Prototyper.java
Log Message:
New quickRefuse() method checks whether we are overloaded without checking whole pool for an available connection.
Index: Prototyper.java
===================================================================
RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/Prototyper.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Prototyper.java 4 May 2005 16:27:54 -0000 1.10
--- Prototyper.java 2 Oct 2005 12:36:30 -0000 1.11
***************
*** 231,237 ****
--- 231,242 ----
synchronized (lock) {
if (proxyConnection == null) {
+ /*
+ Actually, connectionCount only get incremented if it was successfully created. Don't
+ decrement the counter.
+
// If there has been an exception then we won't be using this one and
// we need to decrement the counter
connectionCount--;
+ */
}
connectionsBeingMade--;
***************
*** 296,299 ****
--- 301,316 ----
}
+ /**
+ * Give a quick answer to whether we should attempt to build a connection. This can be quicker
+ * if we are massively overloaded rather than cycling through each connection in the pool to
+ * see if it's free
+ * @return true if it's okay to attempt to get a connection, false if we should give up now. Just
+ * because this method returns true it doesn't guarantee that one will be available. There is a slight
+ * risk that we might tell the client to give up when a connection could become available in the next few
+ * milliseconds but our policy is to refuse connections quickly when overloaded.
+ */
+ public boolean quickRefuse() {
+ return connectionCount >= getDefinition().getMaximumConnectionCount() && connectionPool.getAvailableConnectionCount() < 1;
+ }
}
***************
*** 302,305 ****
--- 319,325 ----
Revision history:
$Log$
+ Revision 1.11 2005/10/02 12:36:30 billhorsman
+ New quickRefuse() method checks whether we are overloaded without checking whole pool for an available connection.
+
Revision 1.10 2005/05/04 16:27:54 billhorsman
Check to see whether a new connection was really added to the pool.
|