- From: Jean-Guilhem Rouel via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 16 Sep 2009 13:48:40 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn In directory hutz:/tmp/cvs-serv2694/src/org/w3c/unicorn Modified Files: UnicornCall.java RequestThread.java Log Message: Trying to solve timeout pb Index: RequestThread.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/RequestThread.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- RequestThread.java 15 Sep 2009 15:38:57 -0000 1.3 +++ RequestThread.java 16 Sep 2009 13:48:38 -0000 1.4 @@ -76,7 +76,6 @@ */ @Override public void run() { - this.unicornCall.incCounter(); Response aResponse = null; try { // Uncomment/comment next lines to test io_error @@ -126,17 +125,15 @@ e1.printStackTrace(); } } - + RequestThread.logger.debug(obsID + " before sync mapOfResponse"); synchronized (mapOfResponse) { mapOfResponse.put(obsID, aResponse); } + RequestThread.logger.debug(obsID + " after sync mapOfResponse"); + } - if (!aResponse.isPassed() && this.unicornCall.getBPassed()) { - this.unicornCall.setbPassed(false); - } - - this.unicornCall.decCounter(); - + public String getObsID() { + return obsID; } } Index: UnicornCall.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/UnicornCall.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- UnicornCall.java 16 Sep 2009 11:57:24 -0000 1.13 +++ UnicornCall.java 16 Sep 2009 13:48:38 -0000 1.14 @@ -90,16 +90,6 @@ private Map<String, Response> mapOfResponse; /** - * Active threads number in doRequests() method - */ - private int nbActiveThreads; - - /** - * Tells if all the checks passed - */ - private boolean bPassed; - - /** * Creates a new UnicornCall. */ public UnicornCall() { @@ -108,7 +98,6 @@ this.mapOfStringParameter = new LinkedHashMap<String, String[]>(); this.mapOfResponse = new LinkedHashMap<String, Response>(); - this.nbActiveThreads = 0; } /** @@ -230,39 +219,6 @@ return mapOfCurrentNodeObserver; } - /** - * Adds 1 to active threads number - */ - public synchronized void incCounter() { - this.nbActiveThreads++; - } - - /** - * Substracts 1 to active threads number - */ - public synchronized void decCounter() { - this.nbActiveThreads--; - } - - /** - * Change the value the boolean bPassed - * - * @param b - * new value - */ - public void setbPassed(boolean b) { - this.bPassed = b; - } - - /** - * getter for bPassed - * - * @return the value of bPassed - */ - public boolean getBPassed() { - return this.bPassed; - } - public boolean isPassed() { boolean passed = true; for (String key : this.getObservationList().keySet()) { @@ -272,7 +228,7 @@ } return passed; } - + /** * Execute the request depending on the priority * @@ -281,10 +237,8 @@ * @throws IOException * Input/Output error */ - private boolean doRequests() throws IOException { - UnicornCall.logger.trace("doRequest"); - - bPassed = true; + private void doRequests() throws IOException { + UnicornCall.logger.trace("doRequests"); final Map<String, Request> requests = this.aRequestList.getRequestMap(); // Creation of the thread list @@ -292,26 +246,23 @@ for (final String obsID : requests.keySet()) { // send request to observer - if (UnicornCall.logger.isDebugEnabled()) { - UnicornCall.logger.debug("Request : " - + requests.get(obsID).toString()); - } - threadsList.add(new RequestThread(mapOfResponse, requests .get(obsID), obsID, this)); + UnicornCall.logger.debug("Request " + requests.get(obsID) + " added to threadsList"); } for (int i = 0; i < threadsList.size(); i++) { threadsList.get(i).start(); + UnicornCall.logger.debug("Request " + ((RequestThread)threadsList.get(i)).getObsID() + " started"); } for (int i = 0; i < threadsList.size(); i++) { try { threadsList.get(i).join(); + UnicornCall.logger.debug("Request " + ((RequestThread)threadsList.get(i)).getObsID() + " terminated"); } catch (InterruptedException e) { e.printStackTrace(); } } - return bPassed; } @@ -858,10 +809,7 @@ aMimeType = new MimeType(sMimeType); break; } - if (UnicornCall.logger.isDebugEnabled()) { - UnicornCall.logger - .debug("MimeType : " + aMimeType.toString() + "."); - } + UnicornCall.logger.debug("MimeType : " + aMimeType.toString() + "."); return aMimeType;
Received on Wednesday, 16 September 2009 13:48:50 UTC