-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify EvaluationHandler service to separate retrieving evaluation fr…
…om updating. - Make the URL evaluation handler use a separate thread to extract evaluation.
- Loading branch information
Matt Pearce
committed
Dec 10, 2018
1 parent
2604c72
commit 9588d89
Showing
4 changed files
with
140 additions
and
17 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
rre-server/src/main/java/io/sease/rre/server/services/EvaluationHandlerException.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,24 @@ | ||
package io.sease.rre.server.services; | ||
|
||
/** | ||
* Exception thrown during evaluation handling. | ||
* | ||
* @author Matt Pearce ([email protected]) | ||
*/ | ||
public class EvaluationHandlerException extends Exception { | ||
|
||
public EvaluationHandlerException() { | ||
} | ||
|
||
public EvaluationHandlerException(String message) { | ||
super(message); | ||
} | ||
|
||
public EvaluationHandlerException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public EvaluationHandlerException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import io.sease.rre.core.domain.Evaluation; | ||
import io.sease.rre.server.domain.EvaluationMetadata; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
|
@@ -10,16 +11,36 @@ | |
* and use them to build an Evaluation object that can be used to populate | ||
* the dashboard. | ||
* | ||
* The {@link #processEvaluationRequest(JsonNode)} method should ideally | ||
* return as quickly as possible, to avoid blocking the sender of the incoming | ||
* request. The evaluation data can then be retrieved using {@link #getEvaluation()} | ||
* where the evaluation contains the most recently processed data. | ||
* | ||
* @author Matt Pearce ([email protected]) | ||
*/ | ||
@Service | ||
public interface EvaluationHandlerService { | ||
|
||
/** | ||
* Update the currently held evaluation data. | ||
* Update the currently held evaluation data. This may be done | ||
* asynchronously - the method should return as quickly as possible. | ||
* | ||
* @param requestData incoming data giving details of evaluation. | ||
* @throws Exception if the data cannot be processed. | ||
* @throws EvaluationHandlerException if the data cannot be processed. | ||
*/ | ||
void processEvaluationRequest(final JsonNode requestData) throws EvaluationHandlerException; | ||
|
||
/** | ||
* Get the current evaluation data. | ||
* | ||
* @return the Evaluation. | ||
*/ | ||
Evaluation getEvaluation(); | ||
|
||
/** | ||
* Get the current evaluation metadata. | ||
* | ||
* @return the evaluation metadata. | ||
*/ | ||
Evaluation processEvaluationRequest(final JsonNode requestData) throws Exception; | ||
EvaluationMetadata getEvaluationMetadata(); | ||
} |
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