IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

Disposer and Disposable

Edit pageLast modified: 16 January 2025

The IntelliJ Platform's Disposer facilitates resource cleanup. If a subsystem keeps a set of resources alive coincident with a parent object's lifetime, the subsystem's resources should be registered with the Disposer to be released before or at the same time as the parent object.

The most common resource type managed by Disposer is listeners, but there are other possible types:

  • File handles, and database connections,

  • Caches and other significant data structures.

The Disposer is a singleton that manages a tree of Disposable instances. A Disposable is an interface for any object providing a Disposable.dispose() method to release heavyweight resources after a specific lifetime.

The Disposer supports chaining Disposable objects in parent-child relationships.