public boolean stopServer(String serverId) { IServer server = getServer(serverId); if (server == null) return false; else { server.stop(false); return true; } }
public void execute() throws BuildException { IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IProject project = workspace.getRoot().getProject(projectname); try { IServer server = WebDSLProjectBuilder.getProjectServer(project, null); if (server == null) { System.out.println("module is currently not in server, cannot remove it"); } else { System.out.println("Removing server module for project: " + projectname); removeProjectModuleFromServer(project, server, null); System.out.println("Stop server."); server.stop(true); } } catch (CoreException e) { e.printStackTrace(); } }
@Before public void setup() throws IOException, CoreException { // remove all servers for (final IServer server : ServerCore.getServers()) { server.stop(true); TaskMonitor monitor = new TaskMonitor() { @Override public boolean isComplete() { return !(server.canStop().isOK()); } }; TimeoutUtils.timeout(monitor, 2, TimeUnit.SECONDS); server.delete(); } // EventService.getInstance().resetSubscribers(); liveReloadServerPort = SocketUtil.findUnusedPort(50000, 55000); }