Class Retainable.ReferenceCounter

java.lang.Object
org.eclipse.jetty.io.Retainable.ReferenceCounter
All Implemented Interfaces:
Retainable
Enclosing interface:
Retainable

public static class Retainable.ReferenceCounter extends Object implements Retainable

A reference count implementation for a Retainable resource.

The reference count is initialized to 1 when the resource is created, and therefore it is implicitly retained and needs a call to release().

Additional calls to retain() must be matched by correspondent calls to release().

When the reference count goes to zero, the resource may be pooled. When the resource is acquired from the pool, acquire() should be called to set the reference count to 1.