Skip to content

Commit 13e9a2f

Browse files
authored
Merge pull request #268 from simbag/parallel-batch-processing
Added ability to handle JSON-RPC batch requests in parallel
2 parents 4d32e9d + b69a88f commit 13e9a2f

File tree

9 files changed

+455
-137
lines changed

9 files changed

+455
-137
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ The following settings apply to both the `JsonRpcServer` and `JsonServiceExporte
384384
* `rethrowExceptions` - Boolean specifying whether or not the server should re-throw exceptions after sending them back to the client.
385385
* `backwardsComaptible` - Boolean specifying whether or not the server should allow for jsonrpc 1.0 calls. This only includes the omission of the jsonrpc property of the request object, it will not enable class hinting.
386386
* `errorResolver` - An implementation of the `ErrorResolver` interface that resolves exception thrown by services into meaningful responses to be sent to clients. Multiple `ErrorResolver`s can be configured using the `MultipleErrorResolver` implementation of this interface.
387+
* `batchExecutorService` - A configured `ExecutorService` to use for parallel JSON-RPC batch processing. By default batch requests are handled sequentially.
387388
388389
### Server Method resolution
389390
Methods are resolved in the following way, each step immediately short circuits the

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ description = 'This project aims to provide the facility to easily implement JSO
1818
version = '1.5.3-2'
1919
group = 'com.github.briandilley.jsonrpc4j'
2020

21-
sourceCompatibility = 1.7
22-
targetCompatibility = 1.7
21+
sourceCompatibility = 1.8
22+
targetCompatibility = 1.8
2323

2424
compileJava {
2525
options.encoding = 'UTF-8'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.googlecode.jsonrpc4j;
2+
3+
import com.fasterxml.jackson.databind.JsonNode;
4+
5+
/**
6+
* Contains the JSON-RPC answer in {@code response}
7+
* {@code exceptionToRethrow} contains exception, which should be thrown when property {@code rethrowExceptions}
8+
* is active
9+
*/
10+
public class JsonResponse {
11+
private JsonNode response;
12+
private int code;
13+
private RuntimeException exceptionToRethrow;
14+
15+
public JsonResponse() {
16+
}
17+
18+
public JsonResponse(JsonNode response, int code) {
19+
this.response = response;
20+
this.code = code;
21+
}
22+
23+
public JsonNode getResponse() {
24+
return response;
25+
}
26+
27+
public void setResponse(JsonNode response) {
28+
this.response = response;
29+
}
30+
31+
public int getCode() {
32+
return code;
33+
}
34+
35+
public void setCode(int code) {
36+
this.code = code;
37+
}
38+
39+
public RuntimeException getExceptionToRethrow() {
40+
return exceptionToRethrow;
41+
}
42+
43+
public void setExceptionToRethrow(RuntimeException exceptionToRethrow) {
44+
this.exceptionToRethrow = exceptionToRethrow;
45+
}
46+
}

0 commit comments

Comments
 (0)