How do we simulate the test cases for RMI concurrent call of remote object by two clients. The same Remote object over the same method is being called by the two clients considering that the methods are not synchronised. I am aware that this will create data inconsistency. How can we actually run this test case?
Asked
Active
Viewed 280 times
-3
-
If t will create data inconsistency there is something seriously wrong with your remote object. – user207421 Jan 12 '17 at 23:01
-
If two clients have the same remote object and calls the same method from this remote object at the same time. The Skeleton will create two threads over the same object. Now both the threads will access the same method at the same time. If there is any data structure that is being updated, it will create data inconsistency in my opinion. – Maninder Singh Jan 12 '17 at 23:57
-
*Only if there is something seriously wrong with your remote object.* It should synchronize itself so that it is threadsafe. NB RMI Skeletons haven't been used for eighteen years. – user207421 Jan 13 '17 at 19:14
-
I think i have to read RMI again :) – Maninder Singh Jan 15 '17 at 00:33
-
By which I mean *you* should ensure correct synchronization in your remote object. Rather than just having an opinion about it. – user207421 Apr 25 '20 at 05:16
1 Answers
0
This can be achieved using ConcurrentJunitRunner API, and make a same call two test cases. There is also ConcurrentSuite API, which can run set of test class concurrently.
@RunWith(ConcurrentJunitRunner.class)
@Concurrent(threads = 2)

Srikanth Balaji
- 2,638
- 4
- 18
- 31
-
This answer could help you handle the example you have mentioned(Concurrent test case), Please reframe your question to a specific scenario/case - Theoretical term is too generic with n scenarios (n - 1-> ∞) – Srikanth Balaji Jan 12 '17 at 02:16
-
@SrikanthThanks! i want to test RMI concurrent execution of remote object by two clients. I will try to get an example for it. I am new to Java programming. But i did not understand how to run the API. It will be better first i get the example – Maninder Singh Jan 12 '17 at 04:07
-
@ManinderSingh, It is possible with the above. 1.) Reframe your question to your concurrent unit test case scenario instead of theoretical 2.) Mark as answered if it helped. – Srikanth Balaji Jan 12 '17 at 04:13
-
how to mark the answer. I am not able to upvote your answer. Is there any way ? – Maninder Singh Jan 12 '17 at 04:32
-
To mark as answered, You may click the tick icon below the up and down vote. – Srikanth Balaji Jan 12 '17 at 04:35