mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
project leak
This commit is contained in:
@@ -233,7 +233,7 @@ public class OSProcessHandler extends ProcessHandler {
|
||||
private boolean skipLF = false;
|
||||
|
||||
private boolean myIsClosed = false;
|
||||
volatile private boolean myIsProcessTerminated = false;
|
||||
private volatile boolean myIsProcessTerminated = false;
|
||||
private final Semaphore mySemaphore = new Semaphore();
|
||||
private final BlockingQueue<String> myNotificationQueue = new LinkedBlockingQueue<String>();
|
||||
|
||||
@@ -349,12 +349,15 @@ public class OSProcessHandler extends ProcessHandler {
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
final ReadProcessRequest request = takeRequest();
|
||||
ReadProcessRequest request = takeRequest();
|
||||
if (request == null) return;
|
||||
|
||||
processRequest(request);
|
||||
if (!request.isClosed()) addRequest(request);
|
||||
|
||||
//noinspection UnusedAssignment
|
||||
request = null; //leak?
|
||||
|
||||
try {
|
||||
Thread.sleep(1L);
|
||||
}
|
||||
|
||||
@@ -68,13 +68,7 @@ public abstract class GitTextHandler extends GitHandler {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void startHandlingStreams() {
|
||||
myHandler = new OSProcessHandler(myProcess, myCommandLine.getCommandLineString()) {
|
||||
@Override
|
||||
public Charset getCharset() {
|
||||
Charset charset = GitTextHandler.this.getCharset();
|
||||
return charset == null ? super.getCharset() : charset;
|
||||
}
|
||||
};
|
||||
myHandler = new MyOSProcessHandler(myProcess, myCommandLine.getCommandLineString(), getCharset());
|
||||
myHandler.addProcessListener(new ProcessListener() {
|
||||
public void startNotified(final ProcessEvent event) {
|
||||
// do nothing
|
||||
@@ -130,7 +124,23 @@ public abstract class GitTextHandler extends GitHandler {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void waitForProcess() {
|
||||
myHandler.waitFor();
|
||||
OSProcessHandler handler = myHandler;
|
||||
myHandler = null;
|
||||
handler.waitFor();
|
||||
}
|
||||
|
||||
private static class MyOSProcessHandler extends OSProcessHandler {
|
||||
private final Charset myCharset;
|
||||
|
||||
public MyOSProcessHandler(Process process, String commandLine, Charset charset) {
|
||||
super(process, commandLine);
|
||||
myCharset = charset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Charset getCharset() {
|
||||
Charset charset = myCharset;
|
||||
return charset == null ? super.getCharset() : charset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user