Uploaded image for project: 'JSword'
  1. JSword
  2. JS-267

Downloads are possibly not in a different thread

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.6.1
    • Fix Version/s: None
    • Component/s: o.c.common.progress
    • Labels:
      None
    • Environment:

      Android

      Description

      I haven't investigated this thoroughly yet, but can dig deeper if nobody knows what the problem might be.

      I am at the stage of a first pass integration of the latest JSword with AB and a lot is working but when I try to Download Documents I never get to show the status of the download. The system pauses until the download completes and then allows display of the status screen - but by this time the download has completed. So I wondered if the download thread had accidentally been removed.

      Here is the logging when I download Gill and I have noted the place the pause occurs for the download:

      03-28 16:54:22.731: D/DownloadControl(4392): Download requested
      03-28 16:54:22.751: D/o*.c*.c*.u*.PluginUtil(4392): Found 1 implementors of org.crosswire.jsword.book.install.InstallerFactory
      03-28 16:54:22.751: D/o*.c*.c*.p*.JobManager(4392): job starting: Installing book: John Gill's Expositor
      03-28 16:54:22.751: D/ProgressNotificationManager(4392): Creating Notification for progress Hash:1096145592
      // LONG PAUSE OCCURS HERE WHILE THE DOWNLOAD OCCURS
      03-28 16:55:03.241: D/net.bible.service.download.XiphosRepo(4392): Book added gill
      03-28 16:55:03.271: D/ProgressNotificationManager(4392): Finished
      03-28 16:55:03.271: D/o*.c*.c*.p*.JobManager(4392): job finished: Installing book: John Gill's Expositor

        Attachments

          Activity

          Hide
          dmsmith DM Smith added a comment -

          Yes, it no longer provides its own thread. Downloading and indexing threading are now the responsibility of the calling program. Threading was removed because it is not appropriate for J2EE programs. Let me know if we need to accommodate both threading and not threading. If not, please close this as "Won't Fix" or "Not a problem".

          It was a trivial change for Bible Desktop. Here is what the code in BD looks like now:

                  // TRANSLATOR: Title to a dialog asking whether the user should download the book based on it's size.
                  if (CWOptionPane.showConfirmDialog(this, formattedMsg, BDMsg.gettext("Download Book"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                      // So now we know what we want to install
                      // All we need to do is installer.install(name)
                      // however we are doing it in the background.
                      final SitePane pane = this;
                      final Thread worker = new Thread("BookDownloader") {
                          /* (non-Javadoc)
                           * @see java.lang.Thread#run()
                           */
                          @Override
                          public void run() {
                              try {
                                  installer.install(name);
                              } catch (InstallException ex) {
                                  Reporter.informUser(pane, ex);
                              }
                          }
                      };
          
                      // this actually starts the thread off
                      worker.setPriority(Thread.MIN_PRIORITY);
                      worker.start();
                  }
          
          Show
          dmsmith DM Smith added a comment - Yes, it no longer provides its own thread. Downloading and indexing threading are now the responsibility of the calling program. Threading was removed because it is not appropriate for J2EE programs. Let me know if we need to accommodate both threading and not threading. If not, please close this as "Won't Fix" or "Not a problem". It was a trivial change for Bible Desktop. Here is what the code in BD looks like now: // TRANSLATOR: Title to a dialog asking whether the user should download the book based on it's size. if (CWOptionPane.showConfirmDialog( this , formattedMsg, BDMsg.gettext( "Download Book" ), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // So now we know what we want to install // All we need to do is installer.install(name) // however we are doing it in the background. final SitePane pane = this ; final Thread worker = new Thread ( "BookDownloader" ) { /* (non-Javadoc) * @see java.lang. Thread #run() */ @Override public void run() { try { installer.install(name); } catch (InstallException ex) { Reporter.informUser(pane, ex); } } }; // this actually starts the thread off worker.setPriority( Thread .MIN_PRIORITY); worker.start(); }
          Hide
          mjdenham Martin Denham added a comment -

          Okay, done as commented by DM above.

          Show
          mjdenham Martin Denham added a comment - Okay, done as commented by DM above.

            People

            • Assignee:
              dmsmith DM Smith
              Reporter:
              mjdenham Martin Denham
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: