Skip to content

Commit

Permalink
fixed processor not starting
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyofrancis committed Aug 20, 2018
1 parent 2204f16 commit f162573
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 69 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class FileDownloaderDelegate(private val downloadInfoUpdater: DownloadInfoUpdate
uiHandler.removeCallbacks(startRunnable)
uiHandler.removeCallbacks(progressRunnable)
uiHandler.removeCallbacks(downloadBlockProgressRunnable)
uiHandler.removeCallbacks(errorReportingRunnable)
uiHandler.removeCallbacks(queuedReportingRunnable)
field = value
}
}
Expand Down Expand Up @@ -82,21 +80,6 @@ class FileDownloaderDelegate(private val downloadInfoUpdater: DownloadInfoUpdate
}
}

private val errorReportingRunnable: ErrorReportingRunnable = object : ErrorReportingRunnable() {

override fun run() {
fetchListener.onError(download, error, throwable)
}
}

private val queuedReportingRunnable: QueuedReportingRunnable = object : QueuedReportingRunnable() {

override fun run() {
fetchListener.onQueued(download, waitingOnNetwork)
}

}

override fun onError(download: Download, error: Error, throwable: Throwable?) {
synchronized(lock) {
if (!interrupted) {
Expand All @@ -105,16 +88,15 @@ class FileDownloaderDelegate(private val downloadInfoUpdater: DownloadInfoUpdate
downloadInfo.status = Status.QUEUED
downloadInfo.error = defaultNoError
downloadInfoUpdater.update(downloadInfo)
queuedReportingRunnable.download = download
queuedReportingRunnable.waitingOnNetwork = true
uiHandler.post(queuedReportingRunnable)
uiHandler.post {
fetchListener.onQueued(download, true)
}
} else {
downloadInfo.status = Status.FAILED
downloadInfoUpdater.update(downloadInfo)
errorReportingRunnable.download = download
errorReportingRunnable.error = error
errorReportingRunnable.throwable = throwable
uiHandler.post(errorReportingRunnable)
uiHandler.post {
fetchListener.onError(download, error, throwable)
}
}
}
}
Expand All @@ -126,14 +108,9 @@ class FileDownloaderDelegate(private val downloadInfoUpdater: DownloadInfoUpdate
val downloadInfo = download as DownloadInfo
downloadInfo.status = Status.COMPLETED
downloadInfoUpdater.update(downloadInfo)
val completedReportingRunnable: CompletedReportingRunnable = object : CompletedReportingRunnable() {

override fun run() {
fetchListener.onCompleted(download)
}
uiHandler.post {
fetchListener.onCompleted(download)
}
completedReportingRunnable.download = download
uiHandler.post(completedReportingRunnable)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PriorityListProcessorImpl constructor(private val handlerWrapper: HandlerW
override val isPaused: Boolean
get() = paused
@Volatile
private var stopped = false
private var stopped = true
override val isStopped: Boolean
get() = stopped
private val priorityIteratorRunnable = Runnable {
Expand Down

This file was deleted.

0 comments on commit f162573

Please sign in to comment.