Hi, I've been having a problem with the ClientResource in Restlet (v 2.0.5) 
which may be a consequence of not understanding its correct usage.

I'm using the ClientResource, with the Apache HTTP Client connector, and have 
written the following:

private final ClientResource httpClient;
public SendClient(String uri) {
  httpClient = new ClientResource(uri);
}
// Omitted code would create messages to send, and then use an executor
// to send this particular message to its destination.
public void run() {
  ClientResource sendClient = null;
  try {
    sendClient = wsClient.getChild(uriResource); // re-use original httpclient 
instance, uriResource is passed in to the method that calls this.
    sendClient.post(form);
  } catch (Throwable e) {
    logger.error("Unable to send message, {}", e.getMessage());
  } finally {
    if (sendClient != null) {
      sendClient.release(); // As I understand from [Restlet WIKI][1] 
    }
  }
}  

Is this correct? I suspect that it is not, since after several hours (7 or 
more) this section of code starts throwing the following error, "Internal 
Server Error", and messages are no longer received by the destination.

Any ideas of what I am doing incorrectly?

NOTE I am aware that ClientResource is not thread-safe, and you'll notice that 
in my code I am using an executor to run this section of code, however, that 
executor contains only a single thread, so, until I understand otherwise, I've 
ruled out that as a problem.

Thanks.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2732149

Reply via email to