/** * Cancels any ongoing data loading. * * @param loaderID The identifier of the loader. */ void cancel(int loaderID) { MetadataLoader loader = loaders.get(loaderID); if (loader != null) { loader.cancel(); loaders.remove(loaderID); } }
/** * Sets the object in the {@link MetadataViewer#DISCARDED} state. Any ongoing data loading will be * cancelled. */ void discard() { state = MetadataViewer.DISCARDED; loaders.entrySet().iterator(); Iterator<Entry<Integer, MetadataLoader>> i = loaders.entrySet().iterator(); MetadataLoader loader; while (i.hasNext()) { loader = i.next().getValue(); if (loader != null) loader.cancel(); } loaders.clear(); if (multiDataLoader != null) multiDataLoader.cancel(); }