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