Skip to content

Commit

Permalink
Fix build on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Snjezana Peco <[email protected]>
  • Loading branch information
snjeza committed Apr 12, 2019
1 parent 5f4346f commit 125ff6a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.jdt.ls.core.internal;

import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;

Expand All @@ -22,18 +25,26 @@ public class LanguageServer implements IApplication {
@Override
public Object start(IApplicationContext context) throws Exception {

JavaLanguageServerPlugin.startLanguageServer(this);
synchronized(waitLock){
while (!shutdown) {
try {
context.applicationRunning();
JavaLanguageServerPlugin.logInfo("Main thread is waiting");
waitLock.wait();
} catch (InterruptedException e) {
JavaLanguageServerPlugin.logException(e.getMessage(), e);
}
}
}
JavaLanguageServerPlugin.startLanguageServer(this);
synchronized (waitLock) {
while (!shutdown) {
try {
context.applicationRunning();
JavaLanguageServerPlugin.logInfo("Main thread is waiting");
waitLock.wait();
} catch (InterruptedException e) {
JavaLanguageServerPlugin.logException(e.getMessage(), e);
}
try {
JavaLanguageServerPlugin.logInfo("Saving workspace");
long start = System.currentTimeMillis();
ResourcesPlugin.getWorkspace().save(true, new NullProgressMonitor());
JavaLanguageServerPlugin.logInfo("Workspace saved. Took " + (System.currentTimeMillis() - start) + " ms");
} catch (CoreException e) {
JavaLanguageServerPlugin.logException(e.getMessage(), e);
}
}
}
return IApplication.EXIT_OK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final class ParentProcessWatcher implements Runnable, Function<MessageCon

private static final long INACTIVITY_DELAY_SECS = 30 *1000;
private static final boolean isJava1x = System.getProperty("java.version").startsWith("1.");
private static final int POLL_DELAY_SECS = 10;
private static final int POLL_DELAY_SECS = 60;
private volatile long lastActivityTime;
private final LanguageServer server;
private ScheduledFuture<?> task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,10 @@ private CodeActionOptions getCodeActionOptions() {
public CompletableFuture<Object> shutdown() {
logInfo(">> shutdown");
return computeAsync((monitor) -> {
try {
JavaRuntime.removeVMInstallChangedListener(jvmConfigurator);
if (workspaceDiagnosticsHandler != null) {
workspaceDiagnosticsHandler.removeResourceChangeListener();
workspaceDiagnosticsHandler = null;
}
ResourcesPlugin.getWorkspace().save(true, monitor);
} catch (CoreException e) {
logException(e.getMessage(), e);
JavaRuntime.removeVMInstallChangedListener(jvmConfigurator);
if (workspaceDiagnosticsHandler != null) {
workspaceDiagnosticsHandler.removeResourceChangeListener();
workspaceDiagnosticsHandler = null;
}
return new Object();
});
Expand Down

0 comments on commit 125ff6a

Please sign in to comment.