Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@apache.org Received: (qmail 71271 invoked from network); 22 Oct 2002 17:42:58 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 22 Oct 2002 17:42:58 -0000 Received: (qmail 25228 invoked by uid 97); 22 Oct 2002 15:25:40 -0000 Delivered-To: qmlist-jakarta-archive-lucene-dev@jakarta.apache.org Received: (qmail 25210 invoked by uid 97); 22 Oct 2002 15:25:39 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 25193 invoked by uid 97); 22 Oct 2002 15:25:38 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 22 Oct 2002 15:22:59 -0000 Message-ID: <20021022152259.89641.qmail@icarus.apache.org> From: cmarschner@apache.org To: jakarta-lucene-sandbox-cvs@apache.org Subject: cvs commit: jakarta-lucene-sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/net HostInfo.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N cmarschner 2002/10/22 08:22:59 Modified: contributions/webcrawler-LARM/src/de/lanlab/larm/net HostInfo.java Log: added host semaphores Revision Changes Path 1.3 +59 -2 jakarta-lucene-sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/net/HostInfo.java Index: HostInfo.java =================================================================== RCS file: /home/cvs/jakarta-lucene-sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/net/HostInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- HostInfo.java 15 Sep 2002 19:30:40 -0000 1.2 +++ HostInfo.java 22 Oct 2002 15:22:59 -0000 1.3 @@ -79,7 +79,62 @@ private int id; - private int healthyCount = 5; + int healthyCount = 8; + + int locks = 2; // max. concurrent requests + int lockObtained = 0; // for debugging + + Object lockMonitor = new Object(); + public Object getLockMonitor() + { + return lockMonitor; + } + public void releaseLock() + { + synchronized(lockMonitor) + { + if(lockObtained>=0) + { + locks++; + lockObtained--; +// try +// { +// throw new Exception(); +// +// } +// catch(Exception e) +// { +// System.out.println("HostInfo: release called at: " + e.getStackTrace()[1]); +// } +// System.out.println("HostInfo " + hostName + ": releaseing Lock. now " + lockObtained + " locks obtained, " + locks + " available"); + } +// else +// { +// System.out.println("HostInfo: lock released although no lock acquired!?"); +// } + } + } + // must be synchronized + public void obtainLock() + { + locks--; + lockObtained++; +// try +// { +// throw new Exception(); +// +// } +// catch(Exception e) +// { +// System.out.println("obtain called at: " + e.getStackTrace()[1]); +// } +// System.out.println("HostInfo " + hostName + ": obtaining Lock. now " + lockObtained + " locks obtained, " + locks + " available"); + } + // must be synchronized + public boolean isBusy() + { + return locks<=0; + } // five strikes, and you're out private boolean isReachable = true; @@ -194,6 +249,7 @@ public void badRequest() { healthyCount--; + System.out.println("HostInfo: " + this.hostName + ": badRequest. " + healthyCount + " left"); } @@ -205,6 +261,7 @@ public void setReachable(boolean reachable) { isReachable = reachable; + System.out.println("HostInfo: " + this.hostName + ": setting to " + (reachable ? "reachable" : "unreachable")); } -- To unsubscribe, e-mail: For additional commands, e-mail: