I'm trying to understand (what I think is) a bug in the generated java code. My thrift schema generates this method: public List<Long> listGet(String key) throws org.apache.thrift.TException { ... }
To avoid an allocation on every listGet request, I'd like to keep a pre-allocated List<Long> buffer per thread, fill that, and return it. When I do this, it doesn't take much for me to get a ConcurrentModificationError, possibly because the wrappers around my listGet method are holding onto it? What's the recommended way to avoid the extra allocations?