From b9341c94304aa3124ba901f82503fe8987c8ca11 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sat, 9 Aug 2003 00:31:14 +0000 Subject: [PATCH] Break out and report the patching and unpacking phases. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2756 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/resource/DownloadManager.java | 15 +++++---- .../threerings/resource/ResourceManager.java | 32 +++++++++++++------ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/java/com/threerings/resource/DownloadManager.java b/src/java/com/threerings/resource/DownloadManager.java index 2af905c07..58f1ac3dc 100644 --- a/src/java/com/threerings/resource/DownloadManager.java +++ b/src/java/com/threerings/resource/DownloadManager.java @@ -1,5 +1,5 @@ // -// $Id: DownloadManager.java,v 1.11 2003/08/08 17:45:00 mdb Exp $ +// $Id: DownloadManager.java,v 1.12 2003/08/09 00:31:14 mdb Exp $ package com.threerings.resource; @@ -61,9 +61,10 @@ public class DownloadManager public void downloadProgress (int percent, long remaining); /** - * Called on the download thread during the patching of jar files. + * Called on the download thread when the patching of jar files + * has begun. */ - public void patchingProgress (int percent); + public void patching (); /** * Called after the download and patching has completed on the @@ -277,7 +278,6 @@ public class DownloadManager } // now go through and do the post-download phase - IOException failure = null; DownloadDescriptor fdesc = null; for (int ii = 0; ii < size; ii++) { Downloader loader = (Downloader)fetch.get(ii); @@ -288,7 +288,6 @@ public class DownloadManager // can, so we don't fail entirely here, just keep track of // the last failure and report that when we're done fdesc = loader.getDescriptor(); - failure = ioe; Log.warning("Downloader failed in postDownload hook " + "[desc=" + fdesc + "]."); Log.logStackTrace(ioe); @@ -296,8 +295,10 @@ public class DownloadManager } // if we had any failure, go ahead and report it now - if (failure != null) { - notifyFailed(obs, fdesc, failure); + if (fdesc != null) { + PatchException pe = new PatchException( + "Failed to patch one or more updated bundles."); + notifyFailed(obs, fdesc, pe); } else { // make sure to always let the observer know that we've diff --git a/src/java/com/threerings/resource/ResourceManager.java b/src/java/com/threerings/resource/ResourceManager.java index ddd01d563..aa5a63738 100644 --- a/src/java/com/threerings/resource/ResourceManager.java +++ b/src/java/com/threerings/resource/ResourceManager.java @@ -1,5 +1,5 @@ // -// $Id: ResourceManager.java,v 1.32 2003/08/05 01:33:20 mdb Exp $ +// $Id: ResourceManager.java,v 1.33 2003/08/09 00:31:14 mdb Exp $ package com.threerings.resource; @@ -118,9 +118,23 @@ public class ResourceManager public void downloadProgress (int percent, long remaining); /** - * Called following the call to {@link #dowloadProgress} of 100 - * percent completion to indicate that we have validated and - * unpacked our bundles and are fully ready to go. + * Called to inform the observer that the bundle patching process + * has begun. This follows the download phase, but is optional. + */ + public void patching (); + + /** + * Called to inform the observer that the bundle unpacking process + * has begun. This follows the download or patching phase. + */ + public void unpacking (); + + /** + * Called to indicate that we have validated and unpacked our + * bundles and are fully ready to go. A call to {@link + * #dowloadProgress} with 100 percent completion is guaranteed to + * precede this call and optionally one to {@link #patching} and + * {@link #unpacking}. */ public void downloadComplete (); @@ -362,7 +376,7 @@ public class ResourceManager public void downloadProgress (int percent, long remaining) { } - public void patchingProgress (int percent) { + public void patching () { } public void postDownloadHook () { @@ -419,7 +433,7 @@ public class ResourceManager // nothing for now } - public void patchingProgress (int percent) { + public void patching () { // nothing for now } @@ -480,12 +494,12 @@ public class ResourceManager obs.downloadProgress(percent, remaining); } - public void patchingProgress (int percent) { - // TODO: - // obs.patchingProgress(percent)? + public void patching () { + obs.patching(); } public void postDownloadHook () { + obs.unpacking(); bundlesDownloaded(); }