Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How to simulate multiple clients for testing  RSS feed

 
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Chiji Nwankwo:
Hi,
Does anyone know how I can simulate multiple clients from the same machine, in order to test my lock and unlock mechanism is working properly.
Thanks,
Chiji


Here's ya go.
Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you will want to do is create a new class that just has a main method
Have it make a connection to the RMI Server, get your connection Object, and then call some lock calls. Yuo can use loops to make the client wait, or use a wait() with time to wait.
Have a second class like the first above, then have it lock some records. Have it lock the same as the one above and some new ones.
Have many System.out.println() calls to display when a lock is made and when unlock is called.
When you run them, you will have two dos windows open. And try to execute them at about the same time. It will take a second to switch to the other window to start up the next class.
I wish I still had my test client code, but unfortunately I don't.
you could also try a search on this forum and I think there have been some test client code around somewhere.
Good Luck
Mark
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I thought this might come in handy for any one trying to simulate multiple remote clients, it worked for me.

Disclaimer:
Please only use this code as an example of how you might want to simulate multiple clients. This works in my current circumstances and might not necessarily be ideal for you. I can not be held liable, so use this at your own risk.

I hope this can help you.
Regards,
Chiji
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Have many System.out.println() calls to display when a lock is made and when unlock is called.


In addition to this, I think it is equally important to test multiple booking. Even though the following sequence works:
lock(5, client1)->lock(5,client2)waits->unlock(5, client1)->lock(5,client2)succeeds->unlock(5,client2)
Doesn't mean that this sequence will work as well:
client1.book(for record 5) -> client2.book(for record 5) waits -> client1.book(for record 5) ends -> client2.book(for record 5) starts and ends.
Eugene.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!