mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
leaks in debugger tests
This commit is contained in:
@@ -29,6 +29,7 @@ import com.intellij.openapi.progress.util.ProgressWindowWithNotification;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
/**
|
||||
* @author lex
|
||||
@@ -43,6 +44,7 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma
|
||||
super();
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static DebuggerManagerThreadImpl createTestInstance() {
|
||||
return new DebuggerManagerThreadImpl();
|
||||
}
|
||||
@@ -222,4 +224,10 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public void clearQueue() {
|
||||
myEvents.clearQueue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
@@ -50,6 +51,7 @@ public class EventQueue<E> {
|
||||
|
||||
myLock.lock();
|
||||
try {
|
||||
assertOpen();
|
||||
getEventsList(priority).addFirst(event);
|
||||
myEventsAvailable.signalAll();
|
||||
}
|
||||
@@ -65,6 +67,7 @@ public class EventQueue<E> {
|
||||
|
||||
myLock.lock();
|
||||
try {
|
||||
assertOpen();
|
||||
getEventsList(priority).offer(event);
|
||||
myEventsAvailable.signalAll();
|
||||
}
|
||||
@@ -80,6 +83,7 @@ public class EventQueue<E> {
|
||||
public void close(){
|
||||
myLock.lock();
|
||||
try {
|
||||
assertOpen();
|
||||
myIsClosed = true;
|
||||
myEventsAvailable.signalAll();
|
||||
}
|
||||
@@ -88,6 +92,10 @@ public class EventQueue<E> {
|
||||
}
|
||||
}
|
||||
|
||||
private void assertOpen() {
|
||||
if (myIsClosed) throw new AssertionError("Already closed");
|
||||
}
|
||||
|
||||
private E getEvent() throws EventQueueClosedException {
|
||||
myLock.lock();
|
||||
try {
|
||||
@@ -120,4 +128,12 @@ public class EventQueue<E> {
|
||||
public E getCurrentEvent() {
|
||||
return myCurrentEvent;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public void clearQueue() {
|
||||
myCurrentEvent = null;
|
||||
for (LinkedList event : myEvents) {
|
||||
event.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user