66import static net .osslabz .jsonrpc .JsonRpcFieldNames .RESULT ;
77
88import com .fasterxml .jackson .core .JsonProcessingException ;
9+ import com .fasterxml .jackson .databind .DeserializationFeature ;
910import com .fasterxml .jackson .databind .JsonNode ;
1011import com .fasterxml .jackson .databind .ObjectMapper ;
12+ import com .fasterxml .jackson .datatype .jsr310 .JavaTimeModule ;
1113import java .io .Closeable ;
1214import java .io .IOException ;
1315import java .net .InetSocketAddress ;
@@ -62,6 +64,8 @@ public JsonRpcTcpClient(String host, int port) {
6264 this .host = host ;
6365 this .port = port ;
6466 this .objectMapper = new ObjectMapper ();
67+ objectMapper .disable (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES );
68+ objectMapper .registerModule (new JavaTimeModule ());
6569
6670 Thread selectorThread = new Thread (this ::processSelectorEvents );
6771 selectorThread .setDaemon (true );
@@ -82,7 +86,7 @@ private void processSelectorEvents() {
8286 try {
8387 Thread .sleep (100 );
8488 } catch (InterruptedException e ) {
85- throw new JsonRcpException ( e );
89+ // ignore
8690 }
8791 continue ;
8892 }
@@ -121,10 +125,10 @@ private void processSelectorEvents() {
121125 writeData (key );
122126 }
123127 } catch (IOException e ) {
128+ pendingRequests .clear ();
124129 pendingResponses .forEach ((id , future ) ->
125130 future .completeExceptionally (e ));
126131 pendingResponses .clear ();
127- pendingRequests .clear ();
128132 }
129133 }
130134 }
@@ -262,7 +266,6 @@ private void readData(SelectionKey key) {
262266 } catch (Exception e ) {
263267 throw new JsonRcpException (e );
264268 }
265-
266269 }
267270
268271
0 commit comments