Skip to content

Commit

Permalink
Remove same-thread checks when recycling (see #5254).
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz committed Feb 28, 2014
1 parent b4f0553 commit 71f0056
Showing 1 changed file with 0 additions and 6 deletions.
Expand Up @@ -54,16 +54,10 @@ public MockPageCacheRecycler(Settings settings, ThreadPool threadPool) {

private <T> V<T> wrap(final V<T> v) {
ACQUIRED_PAGES.put(v, new Throwable());
final Thread t = Thread.currentThread();
return new V<T>() {

@Override
public boolean release() throws ElasticsearchException {
if (t != Thread.currentThread()) {
// Releasing from a different thread doesn't break anything but this is bad practice as pages should be acquired
// as late as possible and released as soon as possible in a try/finally fashion
throw new RuntimeException("Page was allocated in " + t + " but released in " + Thread.currentThread());
}
final Throwable t = ACQUIRED_PAGES.remove(v);
if (t == null) {
throw new IllegalStateException("Releasing a page that has not been acquired");
Expand Down

0 comments on commit 71f0056

Please sign in to comment.