Skip to content

Commit

Permalink
Encapsulate the object field in Pooled (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvest authored Dec 28, 2024
2 parents 9d7565c + ab43b7c commit 64073ba
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/stormpot/Pooled.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
public class Pooled<T> extends BasePoolable implements Poolable, AutoCloseable {
/**
* The object managed by this pooled instance.
*
* @deprecated Use {@link #getObject()} instead.
*/
@Deprecated
public final T object;

/**
Expand All @@ -37,6 +40,14 @@ public Pooled(Slot slot, T object) {
this.object = object;
}

/**
* Get the pooled object.
* @return The pooled object held by this {@link Pooled} reference.
*/
public T getObject() {
return object;
}

/**
* {@link Pooled} implements {@link AutoCloseable} as a convenient way to release
* claimed objects back to the pool, using the try-with-resources syntax.
Expand Down

0 comments on commit 64073ba

Please sign in to comment.