/object-pool-example

An Example to Demonstrate Object Pool Design Pattern

Primary LanguageKotlin

Object Pool Design Pattern

This repo is an example to demonstrate how the Object Pool Design Pattern works.

Brief

A creational design pattern.

This pattern allows to reuse the objects that are expensive or slow to instantiate. The pool is a container which contains a specified amount of objects. When an object is taken from the pool, it is not available in the pool until it is put back. Objects in the pool have a lifecycle: creation, validation and destroy.

— Javatpoint.com

Participants

  • Pool: The most important class. It works as a controller to handle clients' requests for reusable objects.
  • Objects: The reusable objects that are expensive or slow to instantiate.
  • Client: The class that requests to use object(s) in the pool.

UML Diagram

UML Diagram for This Example of Object Pool Design Pattern

References