Commit 2bb95a3e authored by toaster's avatar toaster
Browse files

patch getinputstream, wait for group

git-svn-id: https://subversion.umiacs.umd.edu/ace/trunk@32 f1b3a171-7291-4a19-a512-95ad0ad9394a
parent 601c94b0
...@@ -248,7 +248,7 @@ public class SwapFileAccess extends StorageDriver { ...@@ -248,7 +248,7 @@ public class SwapFileAccess extends StorageDriver {
LOG.trace("Path parses to uuid, testing " + id); LOG.trace("Path parses to uuid, testing " + id);
return client.getFileGroupList().get(id); return client.getFileGroupList().get(id);
} catch ( IllegalArgumentException e ) { } catch ( IllegalArgumentException e ) {
LOG.trace("Path does not parse to a uuid, checking namespaces for '" + name +"'"); LOG.trace("Path does not parse to a uuid, checking namespaces for '" + name + "'");
for ( FileGroup fg : client.getFileGroupList() ) { for ( FileGroup fg : client.getFileGroupList() ) {
if ( fg.getCombinedNameSpace().equals(name) ) { if ( fg.getCombinedNameSpace().equals(name) ) {
return fg; return fg;
...@@ -271,14 +271,14 @@ public class SwapFileAccess extends StorageDriver { ...@@ -271,14 +271,14 @@ public class SwapFileAccess extends StorageDriver {
SwapClient client = createClient(); SwapClient client = createClient();
try { try {
Thread.sleep(2000); Thread.sleep(2000);
FileGroup group = groupByName(client, settings.getCollection().getDirectory()); FileGroup group = groupByName(client, settings.getCollection().getDirectory());
if ( group == null ) { if ( group == null ) {
LOG.error("Could not extract swap filegroup '" LOG.error("Could not extract swap filegroup '"
+ settings.getCollection().getDirectory() + "' "); + settings.getCollection().getDirectory() + "' ");
throw new RuntimeException("Could not find swap file group");
}
throw new RuntimeException("Could not find swap file group");
}
rootFile = group.getFileDetails(settings.getPrefix()); rootFile = group.getFileDetails(settings.getPrefix());
} catch ( InterruptedException e ) { } catch ( InterruptedException e ) {
LOG.error("Could not lookup swap file '" + settings.getPrefix() + "' "); LOG.error("Could not lookup swap file '" + settings.getPrefix() + "' ");
...@@ -286,9 +286,8 @@ public class SwapFileAccess extends StorageDriver { ...@@ -286,9 +286,8 @@ public class SwapFileAccess extends StorageDriver {
throw new RuntimeException("Could not open " + settings.getPrefix()); throw new RuntimeException("Could not open " + settings.getPrefix());
} }
if (rootFile == null) if ( rootFile == null ) {
{ LOG.error("Could not lookup swap file '" + settings.getPrefix() + "' ");
LOG.error("Could not lookup swap file '" + settings.getPrefix() + "' ");
throw new RuntimeException("Could not open " + settings.getPrefix()); throw new RuntimeException("Could not open " + settings.getPrefix());
} }
...@@ -328,11 +327,19 @@ public class SwapFileAccess extends StorageDriver { ...@@ -328,11 +327,19 @@ public class SwapFileAccess extends StorageDriver {
public InputStream getItemInputStream( String itemPath ) throws IOException { public InputStream getItemInputStream( String itemPath ) throws IOException {
SwapClient client = createClient(); SwapClient client = createClient();
FileGroup group = groupByName(client, settings.getCollection().getDirectory()); FileGroup group;
if ( group == null ) { SwapFile file;
throw new IOException("Could not file swap file group");
try {
Thread.sleep(2000);
group = groupByName(client, settings.getCollection().getDirectory());
if ( group == null ) {
throw new IOException("Could not open swap file group");
}
} catch ( InterruptedException e ) {
throw new IOException("Interrupted opening filegroup");
} }
SwapFile file = null;
try { try {
file = group.getFileDetails(settings.getPrefix() + itemPath); file = group.getFileDetails(settings.getPrefix() + itemPath);
} catch ( InterruptedException e ) { } catch ( InterruptedException e ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment