Java Reference
In-Depth Information
L ISTING 8.9 Continued
int jarNumber = jarSequence.length;
try {
ds =
} catch (UnavailableServiceException use) {
ds = null;
System.out.println(“Service is not supported: “+use);
}//once have a ds you can do a lot of things
//begin downloading jars
for (int i=0;i<jarNumber;i++){
if (ds != null) {
//take a breath
try {
140: Thread.currentThread().sleep(3000);//IT'S ONLY COSMETICS!
// Thread.currentThread().yield();
} catch (Exception e) {
System.out.println(“Synchronization Exception: “+e);
showUp(false);//all the needed JARs have been processed
extensionInstaller.installSucceeded(true);//we're optimistic
* A fancy method that finds out if a JAR is cached and removes it.
* substitute it with your code.
private void processJar(DownloadService ds, int i){
try {
// determine if a particular resource is cached
URL url =
new URL(codebase + jarSequence[i]);
boolean cached = ds.isResourceCached(url, null);
160: // remove the resource from the cache, just for fun
if (cached) {
ds.removeResource(url, null);
// reload the resource into the cache, yes!
Search WWH ::

Custom Search