org.eclipse.handly.util

## Interface IReferenceCountable

- All Superinterfaces:
    java.lang.AutoCloseable
  All Known Subinterfaces:
    IBuffer, ISnapshotProvider
  All Known Implementing Classes:
    Buffer, ChildBuffer, TextEditorBuffer, TextFileBuffer

      public interface IReferenceCountable
      extends java.lang.AutoCloseable

  A common protocol for reference countable objects. A reference countable object may be shared by multiple clients and will be disposed only after it is released by every owner. Clients which do not own the object must not access it; attempting that will result in unspecified behavior.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRef()` Spawns a new independent ownership of this object.
    `default void` | `close()` Alias for `release()`.
    `void` | `release()` Relinquishes an independent ownership of this object.

- - ### Method Detail

    - #### addRef

          void addRef()

      Spawns a new independent ownership of this object. Each successful call to `addRef()` must ultimately be followed by exactly one call to `release()`.

    - #### release

          void release()

      Relinquishes an independent ownership of this object. Each independent ownership of the object must ultimately end with exactly one call to this method.
      See Also:
        `close()`

    - #### close

          default void close()

      Alias for `release()`.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`

Copyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0