LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  May 2015

HPS-SVN May 2015

Subject:

r2982 - /java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/JCacheManager.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Sat, 16 May 2015 02:31:12 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (78 lines)

Author: [log in to unmask]
Date: Fri May 15 19:31:02 2015
New Revision: 2982

Log:
Make sure request XML gets read correctly.

Modified:
    java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/JCacheManager.java

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/JCacheManager.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/JCacheManager.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/JCacheManager.java	Fri May 15 19:31:02 2015
@@ -71,8 +71,7 @@
                 process = new ProcessBuilder("jcache", "request", requestId.toString()).start();
             } catch (final IOException e) {
                 throw new RuntimeException(e);
-            }
-            
+            }            
             int status = 0;
             try {
                 status = process.waitFor();
@@ -82,26 +81,31 @@
             if (status != 0) {
                 throw new RuntimeException("The jcache request process returned a non-zero exit status: " + status);
             }            
+            return getRequestXml(process.getInputStream()).getChild("request").getChildText("status");
+        }
+        
+        private Element getRequestXml(InputStream is) {
             String xmlString = null;
             try {
-                xmlString = readFully(process.getInputStream(), "US-ASCII");
+                xmlString = readFully(is, "US-ASCII");
             } catch (IOException e) {
                 throw new RuntimeException(e);
-            }
-            xmlString = xmlString.trim();
+            }            
+            xmlString = xmlString.substring(xmlString.trim().indexOf("<?xml"));
             LOGGER.info(xmlString);
-            Document xml = buildDocument(xmlString);
-            Element root = xml.getRootElement();
-            String requestStatus = root.getChild("request").getChildText("status");
-            return requestStatus;
-        }
-        
+            return buildDocument(xmlString).getRootElement();
+        }
+                                            
         boolean isPending() {
             return !"pending".equals(getStatus());
         }
         
         boolean isDone() {
             return "done".equals(getStatus());
+        }
+        
+        boolean isHit() {
+            return "hit".equals(getStatus());
         }
     }
     
@@ -169,9 +173,9 @@
             boolean check = true;    
             INFO_LOOP: for (Entry<File, FileInfo> entry : fileInfos.entrySet()) {
                 FileInfo info = entry.getValue();
-                info.update();                
+                info.update();
                 if (!info.isCached()) {
-                    LOGGER.info(entry.getKey() + " is not cached yet");
+                    LOGGER.info(entry.getKey() + " is not cached with status " + info.getStatus());
                     check = false;
                     break INFO_LOOP;
                 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use