Package org.eclipse.handly.util

# Interface IReferenceCountable

All Superinterfaces:
  `AutoCloseable`

All Known Subinterfaces:
  `IBuffer`, `ISnapshotProvider`

All Known Implementing Classes:
  `Buffer`, `ChildBuffer`, `TextEditorBuffer`, `TextFileBuffer`

public interface IReferenceCountable extends 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

  Modifier and Type
  Method
  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 Details

  - ### 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 `AutoCloseable`