mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 22:58:36 +00:00
Update ObjectPool.java
This commit is contained in:
@@ -40,7 +40,7 @@ public abstract class ObjectPool<T> {
|
||||
* Checkout object from pool
|
||||
*/
|
||||
public synchronized T checkOut() {
|
||||
if (available.size() <= 0) {
|
||||
if (available.isEmpty()) {
|
||||
available.add(create());
|
||||
}
|
||||
T instance = available.iterator().next();
|
||||
|
||||
Reference in New Issue
Block a user