Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
xml document bundle tracker: execute submitted task only if opened (#…
Browse files Browse the repository at this point in the history
…5617)

Fixes: #5616
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
  • Loading branch information
maggu2810 authored and sjsf committed May 24, 2018
1 parent b4cf1df commit 77dbd0e
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -71,6 +71,8 @@ public class XmlDocumentBundleTracker<T> extends BundleTracker<Bundle> {
private final Map<String, ReadyMarker> bundleReadyMarkerRegistrations = new ConcurrentHashMap<>();
private final String readyMarkerKey;

private volatile boolean open = false;

@SuppressWarnings("rawtypes")
private BundleTracker relevantBundlesTracker;
private final ReadyService readyService;
Expand Down Expand Up @@ -133,6 +135,8 @@ private Set<Bundle> getRelevantBundles() {
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public final synchronized void open() {
open = true;

relevantBundlesTracker = new BundleTracker(context,
Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING | Bundle.ACTIVE, null) {
@Override
Expand All @@ -147,6 +151,8 @@ public Object addingBundle(Bundle bundle, BundleEvent event) {

@Override
public final synchronized void close() {
open = false;

super.close();
unregisterReadyMarkers();
bundleDocumentProviderMap.clear();
Expand Down Expand Up @@ -297,7 +303,9 @@ private void addingBundle(Bundle bundle) {
// http://bugs.java.com/view_bug.do?bug_id=8073755
@Override
public void run() {
processBundle(bundle);
if (open) {
processBundle(bundle);
}
}
});
queue.put(bundle, future);
Expand Down

0 comments on commit 77dbd0e

Please sign in to comment.