Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
530
Issue boards
Milestones
Wiki
Code
Merge requests
15
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
417c3ad0
Commit
417c3ad0
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Prevent RejectedExecutionException
parent
669f980d
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/gui/BaseQueuedAdapter.java
+18
-15
18 additions, 15 deletions
vlc-android/src/org/videolan/vlc/gui/BaseQueuedAdapter.java
with
18 additions
and
15 deletions
vlc-android/src/org/videolan/vlc/gui/BaseQueuedAdapter.java
+
18
−
15
View file @
417c3ad0
...
...
@@ -32,6 +32,7 @@ import java.util.ArrayDeque;
import
java.util.ArrayList
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.RejectedExecutionException
;
public
abstract
class
BaseQueuedAdapter
<
T
extends
MediaLibraryItem
,
VH
extends
RecyclerView
.
ViewHolder
>
extends
RecyclerView
.
Adapter
<
VH
>
{
protected
final
ExecutorService
mUpdateExecutor
=
Executors
.
newSingleThreadExecutor
();
...
...
@@ -65,21 +66,23 @@ public abstract class BaseQueuedAdapter <T extends MediaLibraryItem, VH extends
@MainThread
private
void
internalUpdate
(
final
ArrayList
<
T
>
newList
)
{
mUpdateExecutor
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
final
ArrayList
<
T
>
finalList
=
prepareList
(
newList
);
final
DiffUtil
.
DiffResult
result
=
DiffUtil
.
calculateDiff
(
createCB
(
finalList
),
detectMoves
());
VLCApplication
.
runOnMainThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
mDataset
=
finalList
;
result
.
dispatchUpdatesTo
(
BaseQueuedAdapter
.
this
);
processQueue
();
}
});
}
});
try
{
mUpdateExecutor
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
final
ArrayList
<
T
>
finalList
=
prepareList
(
newList
);
final
DiffUtil
.
DiffResult
result
=
DiffUtil
.
calculateDiff
(
createCB
(
finalList
),
detectMoves
());
VLCApplication
.
runOnMainThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
mDataset
=
finalList
;
result
.
dispatchUpdatesTo
(
BaseQueuedAdapter
.
this
);
processQueue
();
}
});
}
});
}
catch
(
RejectedExecutionException
ignored
)
{}
// Will be retried
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment