*
*/
public class VamsasArchiveReader {
+ private static final int JARFILE_OPEN_RETRIES = 50;
+ private static final int JARFILE_OPEN_RETRYWAIT = 1;
private static Log log = LogFactory.getLog(VamsasArchiveReader.class);
JarFile jfile=null;
boolean stream=false; // true if we are seeking on the stream.
public VamsasArchiveReader(File vamsasfile) {
jfile=null;
+ int retries=JARFILE_OPEN_RETRIES;
+ Exception ex=null;
if (vamsasfile.exists()) {
+ while (jfile==null && --retries>0)
+ {
try {
jfile=new JarFile(vamsasfile);
}
catch (Exception e) {
- log.debug("non-serious? couldn't open new JarFile on "+vamsasfile,e);
+ ex = e;
jfile=null;
+ try {
+ Thread.sleep(JARFILE_OPEN_RETRYWAIT);
+ } catch (Exception w) {};
+ }
+ }
+ if (jfile==null && ex!=null)
+ {
+ log.debug("non-serious? Exceptions when opening JarFile at "+vamsasfile,ex);
}
}
-
}
/**
* in an ideal world - this constructor will create a reader object