org.eclipse.wst.jsdt.chromium.util

## Class DestructingGuard

- java.lang.Object
- - org.eclipse.wst.jsdt.chromium.util.DestructingGuard

    public class DestructingGuard
    extends java.lang.Object

Helper class that destructs unfinished objects. It is needed when Java GC is not enough. It requires to be explicitly discharged if all went OK and destruction should be cancelled. Using this class may be more convenient that try/finally in Java.

User may subclass this class to override exception logging in handleFinallyProblem methods.

### Constructor Summary

Constructors
Constructor and Description
`DestructingGuard()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addValue(Destructable destructable)` Adds another value that should be destructed.
`void` `discharge()` Confirms that constructing has finished OKAY and no destruction is needed from now.
`void` `doFinally()` This method is supposed to be called from finally clause.
`protected void` `handleFinallyProblem(java.lang.Error e)`
`protected void` `handleFinallyProblem(java.lang.RuntimeException e)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DestructingGuard

    public DestructingGuard()

### Method Detail

#### discharge

    public void discharge()

Confirms that constructing has finished OKAY and no destruction is needed from now.

#### doFinally

    public void doFinally()

This method is supposed to be called from finally clause. It performs destructing unless `discharge()` has been called.

#### addValue

    public void addValue(Destructable destructable)

Adds another value that should be destructed. Added values are destructed in reversed order.

#### handleFinallyProblem

    protected void handleFinallyProblem(java.lang.RuntimeException e)

#### handleFinallyProblem

    protected void handleFinallyProblem(java.lang.Error e)