cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2004-12-21 Thread olegk
olegk   2004/12/21 03:27:55

  Modified:httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java
  Log:
  Fixed a whole bunch of typos
  
  Contributed by Ernst de Haan ernst.dehaan at nl.wanadoo.com
  
  Revision  ChangesPath
  1.47  +22 -10
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- MultiThreadedHttpConnectionManager.java   19 Oct 2004 18:09:45 -  
1.46
  +++ MultiThreadedHttpConnectionManager.java   21 Dec 2004 11:27:55 -  
1.47
  @@ -64,6 +64,7 @@
   public class MultiThreadedHttpConnectionManager implements 
HttpConnectionManager {
   
   //  Class 
Variables
  +
   /** Log object for this class. */
   private static final Log LOG = 
LogFactory.getLog(MultiThreadedHttpConnectionManager.class);
   
  @@ -95,10 +96,13 @@
*/
   private static WeakHashMap ALL_CONNECTION_MANAGERS = new WeakHashMap();
   
  +
  +// -- Class 
Methods
  +
   /**
* Shuts down and cleans up resources used by all instances of 
* MultiThreadedHttpConnectionManager. All static resources are 
released, all threads are 
  - * stopped, and [EMAIL PROTECTED] #shutdown()} is called on all live 
instaces of 
  + * stopped, and [EMAIL PROTECTED] #shutdown()} is called on all live 
instances of 
* MultiThreadedHttpConnectionManager.
*
* @see #shutdown()
  @@ -127,7 +131,7 @@
   }
   
   /**
  - * Stores the reference to the given connection along with the 
hostConfig and connection pool.  
  + * Stores the reference to the given connection along with the host 
config and connection pool.  
* These values will be used to reclaim resources if the connection is 
lost to the garbage 
* collector.  This method should be called before a connection is 
released from the connection 
* manager.
  @@ -221,7 +225,9 @@
   }
   }
   
  +
   // - Instance 
Variables
  +
   /**
* Collection of parameters associated with this connection manager.
*/
  @@ -232,6 +238,9 @@
   
   private boolean shutdown = false;
   
  +
  +// --- 
Constructors
  +
   /**
* No-args constructor
*/
  @@ -242,6 +251,9 @@
   }
   }
   
  +
  +// --- Instance 
Methods
  +
   /**
* Shuts down the connection manager and releases all resources.  All 
connections associated 
* with this class will be closed and released. 
  @@ -262,7 +274,7 @@
   /**
* Gets the staleCheckingEnabled value to be set on HttpConnections that 
are created.
* 
  - * @return codetrue/code if stale checking will be enabled on 
HttpConections
  + * @return codetrue/code if stale checking will be enabled on 
HttpConnections
* 
* @see HttpConnection#isStaleCheckingEnabled()
* 
  @@ -277,7 +289,7 @@
* Sets the staleCheckingEnabled value to be set on HttpConnections that 
are created.
* 
* @param connectionStaleCheckingEnabled codetrue/code if stale 
checking will be enabled 
  - * on HttpConections
  + * on HttpConnections
* 
* @see HttpConnection#setStaleCheckingEnabled(boolean)
* 
  @@ -716,7 +728,7 @@
   }
   
   /**
  - * Creates a new connection and returns is for use of the calling 
method.
  + * Creates a new connection and returns it for use of the calling 
method.
*
* @param hostConfiguration the configuration for the connection
* @return a new connection or codenull/code if none are 
available
  @@ -903,8 +915,8 @@
   
   /**
* Notifies a waiting thread that a connection for the given 
configuration is 
  - * available.  This will wake a thread witing in tis hostPool or if 
there is not
  - * one a thread in the ConnectionPool will be notified.
  + * available.  This will wake a thread waiting in this host pool or 
if there is not
  + * one a thread in the connection pool will be notified.
* 
* @param hostPool the host pool to use for notifying
*/
  
  
  

-
To 

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2004-03-28 Thread mbecke
mbecke  2004/03/28 13:26:50

  Modified:httpclient/src/test/org/apache/commons/httpclient
TestHttpConnectionManager.java
   httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java
  Log:
  Added MultiThreadedHttpConnectionManager shutdown() and shutdownAll().
  
  PR: 27589
  Submitted by: Michael Becke
  Reviewed by: Oleg Kalnichevski
  
  Revision  ChangesPath
  1.19  +99 -5 
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java
  
  Index: TestHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TestHttpConnectionManager.java22 Feb 2004 18:08:49 -  1.18
  +++ TestHttpConnectionManager.java28 Mar 2004 21:26:50 -  1.19
  @@ -366,6 +366,94 @@
   }
   
   /**
  + * Tests that [EMAIL PROTECTED] 
MultiThreadedHttpConnectionManager#shutdownAll()} closes all resources
  + * and makes all connection mangers unusable.
  + */
  +public void testShutdownAll() {
  +
  +MultiThreadedHttpConnectionManager connectionManager = new 
MultiThreadedHttpConnectionManager();
  +connectionManager.setMaxConnectionsPerHost(1);
  +connectionManager.setMaxTotalConnections(1);
  +
  +HostConfiguration host1 = new HostConfiguration();
  +host1.setHost(host1, -1, http);
  +
  +// hold on to the only connection
  +HttpConnection connection = connectionManager.getConnection(host1);
  +
  +// wait for a connection on another thread
  +GetConnectionThread getConn = new GetConnectionThread(host1, 
connectionManager, 0);
  +getConn.start();
  +
  +MultiThreadedHttpConnectionManager.shutdownAll();
  +
  +// now release this connection, this should close the connection, but have 
no other effect
  +connection.releaseConnection();
  +connection = null;
  +
  +try {
  +getConn.join();
  +} catch (InterruptedException e) {
  +e.printStackTrace();
  +}
  +
  +// this thread should have caught an exception without getting a connection
  +assertNull(Not connection should have been checked out, 
getConn.getConnection());
  +assertNotNull(There should have been an exception, 
getConn.getException());
  +
  +try {
  +connectionManager.getConnection(host1);
  +fail(An exception should have occurred);
  +} catch (Exception e) {
  +// this is expected
  +}
  +}
  +
  +/**
  + * Tests that [EMAIL PROTECTED] MultiThreadedHttpConnectionManager#shutdown()} 
closes all resources
  + * and makes the connection manger unusable.
  + */
  +public void testShutdown() {
  +
  +MultiThreadedHttpConnectionManager connectionManager = new 
MultiThreadedHttpConnectionManager();
  +connectionManager.setMaxConnectionsPerHost(1);
  +connectionManager.setMaxTotalConnections(1);
  +
  +HostConfiguration host1 = new HostConfiguration();
  +host1.setHost(host1, -1, http);
  +
  +// hold on to the only connection
  +HttpConnection connection = connectionManager.getConnection(host1);
  +
  +// wait for a connection on another thread
  +GetConnectionThread getConn = new GetConnectionThread(host1, 
connectionManager, 0);
  +getConn.start();
  +
  +connectionManager.shutdown();
  +
  +// now release this connection, this should close the connection, but have 
no other effect
  +connection.releaseConnection();
  +connection = null;
  +
  +try {
  +getConn.join();
  +} catch (InterruptedException e) {
  +e.printStackTrace();
  +}
  +
  +// this thread should have caught an exception without getting a connection
  +assertNull(Not connection should have been checked out, 
getConn.getConnection());
  +assertNotNull(There should have been an exception, 
getConn.getException());
  +
  +try {
  +connectionManager.getConnection(host1);
  +fail(An exception should have occurred);
  +} catch (Exception e) {
  +// this is expected
  +}
  +}
  +
  +/**
* Tests the MultiThreadedHttpConnectionManager's ability to restrict the 
maximum number 
* of connections.
*/
  @@ -599,6 +687,7 @@
   private MultiThreadedHttpConnectionManager connectionManager;
   private HttpConnection connection;
   

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2004-01-16 Thread mbecke
mbecke  2004/01/16 21:43:14

  Modified:httpclient/src/java/org/apache/commons/httpclient Tag:
HTTPCLIENT_2_0_BRANCH
MultiThreadedHttpConnectionManager.java
  Log:
  Fixed JDK1.2.2 compilation
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.17.2.6  +5 -8  
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.17.2.5
  retrieving revision 1.17.2.6
  diff -u -r1.17.2.5 -r1.17.2.6
  --- MultiThreadedHttpConnectionManager.java   19 Nov 2003 00:10:45 -  
1.17.2.5
  +++ MultiThreadedHttpConnectionManager.java   17 Jan 2004 05:43:14 -  
1.17.2.6
  @@ -107,23 +107,20 @@
* A mapping from Reference to ConnectionSource.  Used to reclaim resources 
when connections
* are lost to the garbage collector.
*/
  -public static final Map REFERENCE_TO_CONNECTION_SOURCE;
  +public static final Map REFERENCE_TO_CONNECTION_SOURCE = 
Collections.synchronizedMap(new HashMap());
   
   /**
* The reference queue used to track when HttpConnections are lost to the
* garbage collector
*/
  -private static final ReferenceQueue REFERENCE_QUEUE;
  +private static final ReferenceQueue REFERENCE_QUEUE = new ReferenceQueue();
   
   /**
* The thread responsible for handling lost connections.
*/
   private static ReferenceQueueThread REFERENCE_QUEUE_THREAD;
   
  -
   static {
  -REFERENCE_TO_CONNECTION_SOURCE = Collections.synchronizedMap(new HashMap());
  -REFERENCE_QUEUE = new ReferenceQueue();
   REFERENCE_QUEUE_THREAD = new ReferenceQueueThread();
   REFERENCE_QUEUE_THREAD.start();
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-09-26 Thread Adam R. B. Jack
Thanks, this works for me. I appreciate the patch.
regards
Adam
- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 8:44 PM
Subject: cvs commit:
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java


 mbecke  2003/09/25 19:44:18

   Modified:httpclient/src/java/org/apache/commons/httpclient
 MultiThreadedHttpConnectionManager.java
   Log:
   Fixes connection release problem.
   PR: 22800
   Submitted by: Michael Becke

   Revision  ChangesPath
   1.25  +4 -4
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThrea
dedHttpConnectionManager.java

   Index: MultiThreadedHttpConnectionManager.java
   ===
   RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/
MultiThreadedHttpConnectionManager.java,v
   retrieving revision 1.24
   retrieving revision 1.25
   diff -u -r1.24 -r1.25
   --- MultiThreadedHttpConnectionManager.java 1 Sep 2003 18:06:55 -
1.24
   +++ MultiThreadedHttpConnectionManager.java 26 Sep 2003 02:44:18 -
1.25
   @@ -996,7 +996,7 @@
}

public void releaseConnection() {
   -if (hasConnection()) {
   +if (!isLocked()  hasConnection()) {
HttpConnection wrappedConnection =
this.wrappedConnection;
this.wrappedConnection = null;
wrappedConnection.releaseConnection();




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-09-26 Thread Michael Becke
No problem.  I'm sorry it took so long to happen.

Mike

Adam R. B. Jack wrote:

Thanks, this works for me. I appreciate the patch.
regards
Adam
- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 8:44 PM
Subject: cvs commit:
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java



mbecke  2003/09/25 19:44:18

 Modified:httpclient/src/java/org/apache/commons/httpclient
   MultiThreadedHttpConnectionManager.java
 Log:
 Fixes connection release problem.
 PR: 22800
 Submitted by: Michael Becke
 Revision  ChangesPath
 1.25  +4 -4
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThrea
dedHttpConnectionManager.java
 Index: MultiThreadedHttpConnectionManager.java
 ===
 RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/
MultiThreadedHttpConnectionManager.java,v
 retrieving revision 1.24
 retrieving revision 1.25
 diff -u -r1.24 -r1.25
 --- MultiThreadedHttpConnectionManager.java 1 Sep 2003 18:06:55 -
1.24

 +++ MultiThreadedHttpConnectionManager.java 26 Sep 2003 02:44:18 -
1.25

 @@ -996,7 +996,7 @@
  }
  public void releaseConnection() {
 -if (hasConnection()) {
 +if (!isLocked()  hasConnection()) {
  HttpConnection wrappedConnection =
this.wrappedConnection;

  this.wrappedConnection = null;
  wrappedConnection.releaseConnection();


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-09-01 Thread Michael Becke
Quite right.  I'll take care of it.

Mike

On Monday, September 1, 2003, at 03:46 AM, Ortwin Glück wrote:

[EMAIL PROTECTED] wrote:
  +Connection recalimed by garbage 
collector, hostConfig= + config);
typo ---^^^

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-09-01 Thread mbecke
mbecke  2003/09/01 11:05:51

  Modified:httpclient/src/java/org/apache/commons/httpclient Tag:
HTTPCLIENT_2_0_BRANCH
MultiThreadedHttpConnectionManager.java
  Log:
  Fixed typo.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.17.2.4  +4 -4  
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.17.2.3
  retrieving revision 1.17.2.4
  diff -u -r1.17.2.3 -r1.17.2.4
  --- MultiThreadedHttpConnectionManager.java   30 Aug 2003 20:13:46 -  
1.17.2.3
  +++ MultiThreadedHttpConnectionManager.java   1 Sep 2003 18:05:51 -   
1.17.2.4
  @@ -711,7 +711,7 @@
   
   if (LOG.isDebugEnabled()) {
   LOG.debug(
  -Connection recalimed by garbage collector, 
hostConfig= + config);
  +Connection reclaimed by garbage collector, 
hostConfig= + config);
   }
   
   HostConnectionPool hostPool = 
connectionPool.getHostPool(config);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-09-01 Thread mbecke
mbecke  2003/09/01 11:06:56

  Modified:httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java
  Log:
  Fixed typo.
  
  Revision  ChangesPath
  1.24  +4 -4  
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- MultiThreadedHttpConnectionManager.java   30 Aug 2003 20:15:17 -  1.23
  +++ MultiThreadedHttpConnectionManager.java   1 Sep 2003 18:06:55 -   1.24
  @@ -727,7 +727,7 @@
   
   if (LOG.isDebugEnabled()) {
   LOG.debug(
  -Connection recalimed by garbage collector, 
hostConfig= + config);
  +Connection reclaimed by garbage collector, 
hostConfig= + config);
   }
   
   HostConnectionPool hostPool = 
connectionPool.getHostPool(config);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-08-30 Thread mbecke
mbecke  2003/08/30 13:13:46

  Modified:httpclient/src/java/org/apache/commons/httpclient Tag:
HTTPCLIENT_2_0_BRANCH
MultiThreadedHttpConnectionManager.java
  Log:
  Added debugging for connection reclaiming.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.17.2.3  +8 -3  
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.17.2.2
  retrieving revision 1.17.2.3
  diff -u -r1.17.2.2 -r1.17.2.3
  --- MultiThreadedHttpConnectionManager.java   31 Jul 2003 02:31:09 -  
1.17.2.2
  +++ MultiThreadedHttpConnectionManager.java   30 Aug 2003 20:13:46 -  
1.17.2.3
  @@ -709,6 +709,11 @@
   HostConfiguration config = (HostConfiguration) 
referenceToHostConfig.get(ref);
   referenceToHostConfig.remove(ref);
   
  +if (LOG.isDebugEnabled()) {
  +LOG.debug(
  +Connection recalimed by garbage collector, 
hostConfig= + config);
  +}
  +
   HostConnectionPool hostPool = 
connectionPool.getHostPool(config);
   hostPool.numConnections--;
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-08-30 Thread mbecke
mbecke  2003/08/30 13:15:17

  Modified:httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java
  Log:
  Added debugging for connection reclaiming.
  
  Revision  ChangesPath
  1.23  +9 -4  
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- MultiThreadedHttpConnectionManager.java   31 Jul 2003 02:47:30 -  1.22
  +++ MultiThreadedHttpConnectionManager.java   30 Aug 2003 20:15:17 -  1.23
  @@ -724,7 +724,12 @@
   if (referenceToHostConfig.containsKey(ref)) {
   HostConfiguration config = (HostConfiguration) 
referenceToHostConfig.get(ref);
   referenceToHostConfig.remove(ref);
  -
  +
  +if (LOG.isDebugEnabled()) {
  +LOG.debug(
  +Connection recalimed by garbage collector, 
hostConfig= + config);
  +}
  +
   HostConnectionPool hostPool = 
connectionPool.getHostPool(config);
   hostPool.numConnections--;
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-07-22 Thread mbecke
mbecke  2003/07/22 18:28:02

  Modified:httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java
  Log:
  Added connection life-cycle debugging.
  PR: 21788
  
  Revision  ChangesPath
  1.21  +10 -4 
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- MultiThreadedHttpConnectionManager.java   16 Jul 2003 20:48:27 -  1.20
  +++ MultiThreadedHttpConnectionManager.java   23 Jul 2003 01:28:02 -  1.21
  @@ -443,6 +443,9 @@
   if ((hostPool.numConnections  getMaxConnectionsPerHost()) 
(numConnections  getMaxTotalConnections())) {
   
  +if (LOG.isDebugEnabled()) {
  +LOG.debug(Allocating new connection for hostConfig:  + 
hostConfiguration);
  +}
   connection = new HttpConnection(hostConfiguration);
   
connection.setHttpConnectionManager(MultiThreadedHttpConnectionManager.this);
   numConnections++;
  @@ -491,6 +494,9 @@
   if (hostPool.freeConnections.size()  0) {
   connection = (HttpConnection) 
hostPool.freeConnections.removeFirst();
   freeConnections.remove(connection);
  +if (LOG.isDebugEnabled()) {
  +LOG.debug(Getting connection for hostConfig:  + 
hostConfiguration);
  +}
   }
   return connection;
   }
  @@ -585,7 +591,7 @@
   HostConfiguration connectionConfiguration = 
configurationForConnection(conn);
   
   if (LOG.isDebugEnabled()) {
  -LOG.debug(Freeing connection:  + conn);
  +LOG.debug(Freeing connection for hostConfig:  + 
connectionConfiguration);
   }
   
   synchronized (this) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-07-22 Thread mbecke
mbecke  2003/07/22 18:47:20

  Modified:httpclient/src/java/org/apache/commons/httpclient Tag:
HTTPCLIENT_2_0_BRANCH
MultiThreadedHttpConnectionManager.java
  Log:
  Added connection life-cycle debugging.
  PR: 21788
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.17.2.1  +10 -4 
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.17
  retrieving revision 1.17.2.1
  diff -u -r1.17 -r1.17.2.1
  --- MultiThreadedHttpConnectionManager.java   27 Jun 2003 03:20:32 -  1.17
  +++ MultiThreadedHttpConnectionManager.java   23 Jul 2003 01:47:20 -  
1.17.2.1
  @@ -427,6 +427,9 @@
   if ((hostPool.numConnections  getMaxConnectionsPerHost()) 
(numConnections  getMaxTotalConnections())) {
   
  +if (LOG.isDebugEnabled()) {
  +LOG.debug(Allocating new connection for hostConfig:  + 
hostConfiguration);
  +}
   connection = new HttpConnection(hostConfiguration);
   
connection.setHttpConnectionManager(MultiThreadedHttpConnectionManager.this);
   numConnections++;
  @@ -475,6 +478,9 @@
   if (hostPool.freeConnections.size()  0) {
   connection = (HttpConnection) 
hostPool.freeConnections.removeFirst();
   freeConnections.remove(connection);
  +if (LOG.isDebugEnabled()) {
  +LOG.debug(Getting connection for hostConfig:  + 
hostConfiguration);
  +}
   }
   return connection;
   }
  @@ -569,7 +575,7 @@
   HostConfiguration connectionConfiguration = 
configurationForConnection(conn);
   
   if (LOG.isDebugEnabled()) {
  -LOG.debug(Freeing connection:  + conn);
  +LOG.debug(Freeing connection for hostConfig:  + 
connectionConfiguration);
   }
   
   synchronized (this) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient MultiThreadedHttpConnectionManager.java

2003-06-26 Thread mbecke
mbecke  2003/06/26 20:20:32

  Modified:httpclient/src/java/org/apache/commons/httpclient
MultiThreadedHttpConnectionManager.java
  Log:
  DEFAULT_MAX_HOST_CONNECTIONS and DEFAULT_MAX_TOTAL_CONNECTIONS
are now public and static.
  PR: 21130
  Submitted by: Gary Gregory
  
  Revision  ChangesPath
  1.17  +11 -6 
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
  
  Index: MultiThreadedHttpConnectionManager.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MultiThreadedHttpConnectionManager.java   8 May 2003 17:33:52 -   1.16
  +++ MultiThreadedHttpConnectionManager.java   27 Jun 2003 03:20:32 -  1.17
  @@ -96,13 +96,18 @@
   /** Log object for this class. */
   private static final Log LOG = 
LogFactory.getLog(MultiThreadedHttpConnectionManager.class);
   
  -// - Instance Variables
  +/** The default maximum number of connections allowed per host */
  +public static final int DEFAULT_MAX_HOST_CONNECTIONS = 2;   // Per RFC 2616 sec 
8.1.4
  +
  +/** The default maximum number of connections allowed overall */
  +public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 20;
   
  +// - Instance Variables
   /** Maximum number of connections allowed per host */
  -private int maxHostConnections = 2;   // Per RFC 2616 sec 8.1.4
  +private int maxHostConnections = DEFAULT_MAX_HOST_CONNECTIONS;
   
   /** Maximum number of connections allowed overall */
  -private int maxTotalConnections = 20;
  +private int maxTotalConnections = DEFAULT_MAX_TOTAL_CONNECTIONS;
   
   /** Connection Pool */
   private ConnectionPool connectionPool;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]