Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9138f0e3541f0a3118ac76be2c0d6d9b6d92cdc1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*******************************************************************************
 * Copyright (c) 2001, 2008 Oracle Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Oracle Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jsf.common.internal.managedobject;

import java.util.concurrent.atomic.AtomicBoolean;


/**
 * Sub-class for managed objects.
 * 
 */
/**
 * @author cbateman
 *
 */
public abstract class AbstractManagedObject implements IManagedObject
{
    /**
     * Flag for checking disposal.
     */
    protected final AtomicBoolean _isDisposed = new AtomicBoolean(false);

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject#dispose
     * ()
     */
    public void dispose()
    {
        _isDisposed.set(true);
    }

    public boolean isDisposed()
    {
        return _isDisposed.get();
    }

    /**
     * Checks if this object is disposed and throws IllegalStateException if it
     * is.
     */
    protected final void assertNotDisposed()
    {
        if (isDisposed())
        {
            throw new IllegalStateException(this.toString() + " is disposed"); //$NON-NLS-1$
        }
    }
    /*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject#checkpoint
     * ()
     */
    public abstract void checkpoint();

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject#destroy
     * ()
     */
    public abstract void destroy();

}

Back to the top