Fixes #1186 limit the number of items in the ThreadLocal list in the ConcurrentBag.

pull/1159/merge
Brett Wooldridge 7 years ago
parent d0cb0f8dab
commit 52b3811e4d

@ -195,8 +195,10 @@ public class ConcurrentBag<T extends IConcurrentBagEntry> implements AutoCloseab
} }
final List<Object> threadLocalList = threadList.get(); final List<Object> threadLocalList = threadList.get();
if (threadLocalList.size() < 50) {
threadLocalList.add(weakThreadLocals ? new WeakReference<>(bagEntry) : bagEntry); threadLocalList.add(weakThreadLocals ? new WeakReference<>(bagEntry) : bagEntry);
} }
}
/** /**
* Add a new object to the bag for others to borrow. * Add a new object to the bag for others to borrow.

Loading…
Cancel
Save