Search code examples
javaasynchronousrmi

JAVA asynchronous RMI


I need to have Remote Method invocation (RMI) functionality between two different JAVA programs. Both are supposed to perform some backend functionality on given file(File Name as parameter)sequentially. As the number of files to be processed can be too large, I require that the Remote Call to be done asynchronously. Initially I used Java RMI for this as it fits perfectly except that call is done synchronously. These are simple java programs and I don’t want to deploy them on any Application server as that would be too much overhead. Also multiple files need to be executed simultaneously so program is developed in thread-safe mode. Please suggest ideal implementation for that. Any custom developed API if available free would be really helpful.


Solution

  • The simplest solution is to have your RMI call start an asynchronous task. If you want to improve efficiency you could send batches of files to process. Note: unless you are careful, you disk subsystem could be your bottleneck and using multiple threads can be slower instead of faster.