title: Rserve server: how to terminate a blocking instance (eval taking forever)?
body: <p>I need to perform R <code>eval</code>s in a multi-threaded way, which is something <code>Rserve</code> provides quite well.
  But, if the eval of one instance takes too long, I need to be able to shutdown the instance which is computing the blocking eval. As far as I tested, the given instance will refuse to shutdown until the eval is done (apparently, it needs to fetch the result, before listening again). So here is my question:</p>
  
  <p>Is there a way get a java handle on the blocking instance (something like a <code>Process</code> object), such that I can brute force kill/terminate the eval (something like <code>process.destroy()</code>)?
  In other words, when I ask for an eval (create a connection, throw a command), how do I establish a relationship between the eval being processed, and the instance of Rsere related to it, via java?</p>
  
  <p>Or did I miss something about Rserve which already allows to deal with this kind of needs?</p>
  
  <p><strong>Note:</strong> I already tried to run everything (all evals) via <code>serverEval()</code> instead of the regular <code>eval</code>, which runs the computations on the main instance, but this is, of course, not satisfying as it uses only one process (the main one). That one I can kill, but my main goal was to be able to shutdown individually a blocking eval, running on an individual instance. And, naturally, keep advantage of my 8 CPU cores, that is to say, preserve the parallelism. There is no point to use Rserve otherwise (JRI engine would be more than sufficient in this case).</p>
  
  <p><strong>Note:</strong> I would like to avoid this kind of things (<a href="https://stackoverflow.com/questions/21580654/rserve-multiple-instances-on-one-server">thread</a>), dealing with several instances of the main server itself, on different ports. That is not an option.</p>
  
  <p>I already tried getting information on Rserve's mailing list, but haven't been answered. 
  I hope I made myself clear enough to get an answer or helpful comment here. If not, please ask for details. Thanks so much by advance.</p>
  
  <p><strong>Edit:</strong> I also tested <a href="http://code.google.com/p/rcaller/" rel="nofollow noreferrer">RCaller</a>, which deals with as many instances of R one need, but, as it is writing results into XML files for later parsing from java side (not really using a communication protocol as Rserve would), it is far too slow for what I have to perform...</p>