1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
13 package org.simantics.utils.datastructures.disposable;
15 import org.simantics.utils.threads.IThreadWorkQueue;
18 * Interface for disposable objects.
20 * @see AbstractDisposable for implementation
21 * @author Toni Kalajainen
23 public interface IDisposable {
26 * Starts dispose procedures. The objects goes into Disposing state
27 * while dispose listeners are handled.
32 * Dispose if not diposed.
37 * Is the object disposed. The return value of this method goes into
38 * true status, once dispose() is invoked and all listeners have been
41 * @return <code>true</code> if this object has been disposed
46 * Get objects state in respect to its life cycle.
48 * @return current object state
50 DisposeState getDisposeState();
52 void addDisposeListener(IDisposeListener listener);
53 void addDisposeListener(IDisposeListener listener, IThreadWorkQueue thread);
54 void removeDisposeListener(IDisposeListener listener);
55 void removeDisposeListener(IDisposeListener listener, IThreadWorkQueue thread);