forked from angelozerr/tern.java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue angelozerr#171: Preference for disabling asynchronous requests.
- Loading branch information
1 parent
18f4983
commit 92c42ef
Showing
11 changed files
with
115 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/tern.core/src/tern/server/SynchronousRequestProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright (c) 2015 Genuitec LLC. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Piotr Tomiak <piotr@genuitec.com> - initial API and implementation | ||
*/ | ||
package tern.server; | ||
|
||
import tern.TernException; | ||
import tern.server.protocol.ITernResultsAsyncCollector; | ||
import tern.server.protocol.ITernResultsCollector; | ||
import tern.server.protocol.TernDoc; | ||
import tern.server.protocol.TernResultsProcessorsFactory; | ||
|
||
/** | ||
* Basic request processor, which processes requests always in a synchronous | ||
* way. | ||
*/ | ||
public class SynchronousRequestProcessor implements ITernServerRequestProcessor { | ||
|
||
private ITernServer server; | ||
|
||
public SynchronousRequestProcessor(ITernServer server) { | ||
this.server = server; | ||
} | ||
|
||
@Override | ||
public void processRequest(TernDoc doc, ITernResultsCollector collector) | ||
throws TernException { | ||
try { | ||
TernResultsProcessorsFactory.makeRequestAndProcess(doc, server, | ||
collector); | ||
// mark collection as done to be super correct | ||
if (collector instanceof ITernResultsAsyncCollector) { | ||
((ITernResultsAsyncCollector) collector).done(); | ||
} | ||
} catch (TernException ex) { | ||
throw ex; | ||
} catch (Throwable t) { | ||
throw new TernException(t); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters