public class WebIndexer extends AbstractIndexer {
+ private static final int METADATA_LOAD_TRY_COUNT = 10;
private final String globalPrefix;
private final String jspPath;
}
public DirectoryMetadata getMetadataForPath(final String requestPath)
- throws IOException, MalformedURLException, ClassNotFoundException {
+ throws ClassNotFoundException, IOException {
final StringBuffer urlStringBuffer = new StringBuffer();
final String urlString = urlStringBuffer.toString();
- final BufferedInputStream in = new BufferedInputStream(new URL(
- urlString).openStream());
+ IOException exception = null;
- final ObjectInputStream oin = new ObjectInputStream(in);
- final DirectoryMetadata directory = (DirectoryMetadata) oin
- .readObject();
- in.close();
+ for (int i = 0; i < METADATA_LOAD_TRY_COUNT; i++)
+ try {
- return directory;
+ final BufferedInputStream in = new BufferedInputStream(new URL(
+ urlString).openStream());
+
+ final ObjectInputStream oin = new ObjectInputStream(in);
+ final DirectoryMetadata directory = (DirectoryMetadata) oin
+ .readObject();
+ in.close();
+
+ return directory;
+ } catch (final IOException e) {
+ exception = e;
+ }
+
+ throw exception;
}
@Override