Skip to content

Commit e15f231

Browse files
committed
Don't use Java Queue
1 parent 85f944e commit e15f231

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyDebugContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public final class GraalHPyDebugContext extends GraalHPyContext {
5656
private int age;
5757
private long[] debugHandleInfo = new long[]{0};
5858
private int closedHandlesQueueMaxSize = DEFAULT_CLOSED_HANDLES_QUEUE_MAX_SIZE;
59-
private final Queue<GraalHPyHandle> closedHandles = new LinkedList<>();
59+
private final LinkedList<GraalHPyHandle> closedHandles = new LinkedList<>();
6060
private Object onInvalidHandleCallback;
6161

6262
public GraalHPyDebugContext(GraalHPyContext context) {
@@ -167,8 +167,8 @@ public synchronized boolean releaseHPyHandleForObject(int handleId) {
167167
GraalHPyHandle handle = super.getObjectForHPyHandle(handleId);
168168
super.releaseHPyHandleForObject(handleId);
169169
debugHandleInfo[handleId] = -1;
170-
if (closedHandles.size() >= closedHandlesQueueMaxSize) {
171-
closedHandles.poll();
170+
if (!closedHandles.isEmpty() && closedHandles.size() >= closedHandlesQueueMaxSize) {
171+
closedHandles.removeFirst();
172172
}
173173
closedHandles.add(handle);
174174
return true;

0 commit comments

Comments
 (0)