Revision 46914 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java

View differences:

DefaultFeatureSelection.java
256 256
    private Map featureTypeCounts = new HashMap(1);
257 257
    private final Map<Feature, Iterator> featureIterators = new HashMap<>();
258 258
    private final DefaultFeatureReferenceSelection featureReferenceSelection;
259
    private boolean disposed = false;
259 260

  
260 261
    /**
261 262
     * Creates a DefaultFeatureSelection, with a FeatureStore.
......
267 268
     */
268 269
    public DefaultFeatureSelection(DefaultFeatureStore featureStore)
269 270
            throws DataException {
271
        DisposeUtils.bind(this);
270 272
        this.featureReferenceSelection = new DefaultFeatureReferenceSelection(featureStore);
271 273
    }
272 274

  
......
281 283
     */
282 284
    public DefaultFeatureSelection(FeatureStore featureStore,
283 285
            FeatureSelectionHelper helper) throws DataException {
286
        DisposeUtils.bind(this);
284 287
        this.featureReferenceSelection = new DefaultFeatureReferenceSelection(featureStore, helper);
285 288
    }
286 289

  
......
291 294
     * attributes that this class needs to work.
292 295
     */
293 296
    public DefaultFeatureSelection() {
297
        DisposeUtils.bind(this);
294 298
        this.featureReferenceSelection = new DefaultFeatureReferenceSelection();
295 299
    }
296 300

  
......
383 387
    }
384 388

  
385 389
    @Override
386
    public void dispose() {
387
        this.featureReferenceSelection.dispose();
390
    public synchronized final void dispose() {
391
        // Check if we have already been disposed, and don't do it again
392
        if (!disposed) {
393
            if (DisposeUtils.release(this)) {
394
                try {
395
                    doDispose();
396
                } catch (Exception ex) {
397
                    LOG.error("Error performing dispose", ex);
398
                } finally {
399
                    disposed = true;
400
                }
401
            }
402
        }
388 403
    }
389 404

  
405

  
406

  
390 407
    @Override
391 408
    public void update(Observable o, Object o1) {
392 409
        this.featureReferenceSelection.update(o, o1);

Also available in: Unified diff