-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ExecutorScalingQueue to workaround LinkedTransferQueue JDK bug (…
…#104347) (#104426) This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
- Loading branch information
1 parent
96d83cd
commit f2ef03a
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
server/src/test/java/org/elasticsearch/common/util/concurrent/ExecutorScalingQueueTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.common.util.concurrent; | ||
|
||
import org.elasticsearch.test.ESTestCase; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
public class ExecutorScalingQueueTests extends ESTestCase { | ||
|
||
public void testPut() { | ||
var queue = new EsExecutors.ExecutorScalingQueue<>(); | ||
queue.put(new Object()); | ||
assertEquals(queue.size(), 1); | ||
} | ||
|
||
public void testAdd() { | ||
var queue = new EsExecutors.ExecutorScalingQueue<>(); | ||
assertTrue(queue.add(new Object())); | ||
assertEquals(queue.size(), 1); | ||
} | ||
|
||
public void testTimedOffer() { | ||
var queue = new EsExecutors.ExecutorScalingQueue<>(); | ||
assertTrue(queue.offer(new Object(), 60, TimeUnit.SECONDS)); | ||
assertEquals(queue.size(), 1); | ||
} | ||
|
||
} |