Может быть, мои сомнения немного глупы. Но я не мог найти ответ, похожий на мою проблему. Но после некоторого времени запросов (около 20 вызовов этого метода) клиент получает java.lang.OutOfMemoryError: пространство кучи Java
клиент:
final ClientResource cr = new ClientResource(host + userInteracId);
try {
Client httpClient = new Client(Protocol.HTTP);
httpClient.setConnectTimeout(36000);
cr.setNext(httpClient);
JSONObject obj = new JSONObject();
JsonRepresentation jr = new JsonRepresentation(obj);
cr.put(jr);
jr.release();
cr.setNext(httpClient);
Representation r = cr.get();
result = new JsonRepresentation(r).getJsonObject();
r.release();
} catch (Exception e) {
result = new JSONObject();
} finally {
cr.release();
cr.getResponseEntity().release();
}
и исключение:
WARNING: Unexpected error while controlling connector
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:39)
at java.nio.ByteBuffer.allocate(ByteBuffer.java:312)
at org.restlet.engine.io.Buffer.createByteBuffer(Buffer.java:64)
at org.restlet.engine.io.Buffer.<init>(Buffer.java:125)
at org.restlet.engine.connector.Way.<init>(Way.java:97)
at org.restlet.engine.connector.OutboundWay.<init>(OutboundWay.java:105)
at org.restlet.engine.connector.ClientOutboundWay.<init>(ClientOutboundWay.java:59)
at org.restlet.engine.connector.HttpClientOutboundWay.<init>(HttpClientOutboundWay.java:59)
at org.restlet.engine.connector.HttpClientHelper.createOutboundWay(HttpClientHelper.java:63)
at org.restlet.engine.connector.Connection.<init>(Connection.java:128)
...