Reputation: 1024
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.
Upvotes: 2
Views: 7102
Reputation: 25
I'm with the same issue. Looking for reponses, I've found
I have choosen the last option
Upvotes: 0
Reputation: 10803
Here is another new player in RMI area which supports asynchronous execution. The Redisson framework. More documentation about asynchronous execution is here.
Upvotes: 0
Reputation: 43
The way to have true asynchronous call is to:
There is only one implementation that I know of such async RMI
Here is a good explanation with sequence diagram about how it is actually implemented.
Upvotes: 2
Reputation: 4786
Just spin up a thread and call the method from with the thread. Now you have async RMI ;-)
Upvotes: 0
Reputation: 310980
I need to have Remote Method invocation (RMI) functionality between two different JAVA programs ... I require that the Remote Call to be done asynchronously.
Those two requirements are mutually contradictory. RMI means Remote Method Invocation, which implies call-and-return method call semantics. If it isn't call-and-return, it isn't method invocation, so it isn't RMI either.
You should investigate technologies that have listeners, such as JMS.
Upvotes: 2
Reputation: 533680
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.
Upvotes: 2
Reputation: 9159
You should JMS (Java Messaging Service) if you are sure both your applications are in Java (and are going to be). The communication being asynchronously there is also going to be a 3rd party broker - a message queue (ActiveMQ or one directly embedded in an application server like Glassfish or others).
By using this, you send the MQ and it sends the messages to the other application.
If you want more flexibility and maybe some of the applications are (or are going to be) written in another language you should probably use AMQP instead of JMS.
Upvotes: 0