Skip to content

Commit 49b35a5

Browse files
authored
Replication tests (#219)
* Re-enabled replication tests after the latest fixes * Reduced RAM used by backup/restore test * Fixed backup test case * Fixed test * Improved exception message for http errors
1 parent 62bbbd5 commit 49b35a5

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

network/src/main/java/com/arcadedb/remote/RemoteDatabase.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,19 +235,16 @@ public ResultSet command(final String language, final String command, final Obje
235235
public ResultSet query(final String language, final String command, final Object... args) {
236236
Map<String, Object> params = mapArgs(args);
237237

238-
return (ResultSet) databaseCommand("query", language, command, params, false, new Callback() {
239-
@Override
240-
public Object call(final HttpURLConnection connection, final JSONObject response) {
241-
final ResultSet resultSet = new InternalResultSet();
242-
243-
final JSONArray resultArray = response.getJSONArray("result");
244-
for (int i = 0; i < resultArray.length(); ++i) {
245-
final JSONObject result = resultArray.getJSONObject(i);
246-
((InternalResultSet) resultSet).add(new ResultInternal(result.toMap()));
247-
}
238+
return (ResultSet) databaseCommand("query", language, command, params, false, (connection, response) -> {
239+
final ResultSet resultSet = new InternalResultSet();
248240

249-
return resultSet;
241+
final JSONArray resultArray = response.getJSONArray("result");
242+
for (int i = 0; i < resultArray.length(); ++i) {
243+
final JSONObject result = resultArray.getJSONObject(i);
244+
((InternalResultSet) resultSet).add(new ResultInternal(result.toMap()));
250245
}
246+
247+
return resultSet;
251248
});
252249
}
253250

@@ -420,14 +417,14 @@ private Object httpCommand(final String extendedURL, final String operation, fin
420417
} catch (NeedRetryException | DuplicatedKeyException | TransactionException | TimeoutException e) {
421418
throw e;
422419
} catch (Exception e) {
423-
throw new RemoteException("Error on executing remote operation " + operation, e);
420+
throw new RemoteException("Error on executing remote operation " + operation + " (cause: " + e.getMessage() + ")", e);
424421
}
425422
}
426423

427424
if (lastException instanceof RuntimeException)
428425
throw (RuntimeException) lastException;
429426

430-
throw new RemoteException("Error on executing remote operation " + operation, lastException);
427+
throw new RemoteException("Error on executing remote operation " + operation + " (retry=" + maxRetry + ")", lastException);
431428
}
432429

433430
public int getApiVersion() {

0 commit comments

Comments
 (0)