Skip to content

Commit

Permalink
*) "Httpc object was not returned to object pool." bug fixed.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@62 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
theli committed Apr 26, 2005
1 parent 47e426f commit 3756e6d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions source/de/anomic/http/httpc.java
Expand Up @@ -167,16 +167,21 @@ public static httpc getInstance(
public static httpc getInstance(String server, int port, int timeout, boolean ssl) throws IOException {

httpc newHttpc = null;
// fetching a new httpc from the object pool
try {
// fetching a new httpc from the object pool
newHttpc = (httpc) httpc.theHttpcPool.borrowObject();

} catch (Exception e) {
throw new IOException("Unable to initialize a new httpc. " + e.getMessage());
}

// initialize it
newHttpc.init(server,port,timeout,ssl);
try {
newHttpc.init(server,port,timeout,ssl);
} catch (IOException e) {
try{ httpc.theHttpcPool.returnObject(newHttpc); } catch (Exception e1) {}
throw e;
}
return newHttpc;


Expand All @@ -192,9 +197,11 @@ public static void returnInstance(httpc theHttpc) {
}

protected void finalize() throws Throwable {
if (!this.removedFromPool) System.err.println("Httpc object was not returned to object pool.");
this.reset();
httpc.theHttpcPool.invalidateObject(this);
if (!this.removedFromPool) {
System.err.println("Httpc object was not returned to object pool.");
httpc.theHttpcPool.invalidateObject(this);
}
this.reset();
}

public static String dnsResolve(String host) {
Expand Down

0 comments on commit 3756e6d

Please sign in to comment.