Author: andre
Date: 2010-06-09 11:29:32 +0200 (Wed, 09 Jun 2010)
New Revision: 42482

Modified:
   
mmbase/trunk/applications/streams/src/main/java/org/mmbase/streams/transcoders/SegmenterAnalyzer.java
Log:
added a time-out to wait for filesystem to be ready


Modified: 
mmbase/trunk/applications/streams/src/main/java/org/mmbase/streams/transcoders/SegmenterAnalyzer.java
===================================================================
--- 
mmbase/trunk/applications/streams/src/main/java/org/mmbase/streams/transcoders/SegmenterAnalyzer.java
       2010-06-09 08:32:19 UTC (rev 42481)
+++ 
mmbase/trunk/applications/streams/src/main/java/org/mmbase/streams/transcoders/SegmenterAnalyzer.java
       2010-06-09 09:29:32 UTC (rev 42482)
@@ -33,7 +33,8 @@
 
 /**
  * Analyzes <code>segmenter</code> output during its job, changes url field to 
m3u8 index file when 
- * ready and rewrites m3u8 to removed full paths.
+ * ready and rewrites m3u8 to removed full paths. It can wait two minutes for 
the filesystem to be
+ * ready before starting to rewrite.
  * 
  * @author Andr&eacute; van Toly
  * @version $Id: SegmenterAnalyzer.java 40036 2009-11-30 20:27:39Z andre $
@@ -113,6 +114,18 @@
                 File index = new File(filesDirectory + url);
                 File temp  = new File(filesDirectory + url + ".tmp");
                 
+                int count = 0;
+                while ((!index.exists() || index.length() < 1) && count < 12) {
+                    LOG.service("Result ready, but file " + index + 
(index.exists() ? " is too small" : " doesn't exist") + ". Waiting 10 sec. to 
be sure filesystem is ready (" + count + ")");
+                    try {
+                        Thread.currentThread().sleep(10000);
+                        count++;
+                    } catch (InterruptedException ie) {
+                        LOG.info("Interrupted");
+                        return;
+                    }
+                }
+                
                 try {
                     BufferedReader in = new BufferedReader(new 
FileReader(index));
                     PrintWriter pw = new PrintWriter(new FileWriter(temp));

_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to