Don't allow the resource bundles to attempt to access their resource jar

files until they are known to be safely updated and ready to go.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2185 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-01-18 19:56:45 +00:00
parent bddca90c0d
commit 5414507e3a
2 changed files with 52 additions and 6 deletions
@@ -1,5 +1,5 @@
//
// $Id: ResourceManager.java,v 1.20 2003/01/16 22:50:29 mdb Exp $
// $Id: ResourceManager.java,v 1.21 2003/01/18 19:56:45 mdb Exp $
package com.threerings.resource;
@@ -18,6 +18,7 @@ import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
@@ -249,6 +250,7 @@ public class ResourceManager
// wake things up as the download is finished
lock.notify();
}
bundlesDownloaded();
}
}
@@ -295,6 +297,9 @@ public class ResourceManager
}
public void downloadProgress (int percent, long remaining) {
if (percent == 100) {
bundlesDownloaded();
}
obs.downloadProgress(percent, remaining);
}
@@ -304,6 +309,22 @@ public class ResourceManager
});
}
/**
* Called when our resource bundle downloads have completed.
*/
protected void bundlesDownloaded ()
{
// let our bundles know that it's ok for them to access their
// resource files
Iterator iter = _sets.values().iterator();
while (iter.hasNext()) {
ResourceBundle[] bundles = (ResourceBundle[])iter.next();
for (int ii = 0; ii < bundles.length; ii++) {
bundles[ii].sourceIsReady();
}
}
}
/**
* Loads up the most recent version of the resource manager
* configuration.