Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running 2 JVMs

 
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be a stupid quesion...
How do you run your code on different JVMs on the same machine? Does this only mean to start the server in a different command line?
ie.
1. start RMI server with an IP/localhost
2. client connect using RMI
Where on the same JVM is NOT starting RMI and just instantiate your own DB object?
Thanks!
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anna Kafei:

How do you run your code on different JVMs on the same machine? Does this only mean to start the server in a different command line?
ie.
1. start RMI server with an IP/localhost
2. client connect using RMI

I think you are right. Atleast my understanding is also the same.

Where on the same JVM is NOT starting RMI and just instantiate your own DB object?

I didn't quite catch this. Is it about the standalone mode?
Can you be a bit more specific?
 
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that is what I meant. Running on one JVM is standalone. ie, you get your db object when the client GUI loads. Which means, running everything by one command line.
I see the JVM is per System.exit(); like, when you type System.exit(); you will shut down the JVM. I also got this understanding from when I start an app that is done by Java and you get to give it a heap size on the JVM that determines how much memory is used by that app.
So all my understandings are just guesses, I am not sure if I am right...
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anna,
Originally posted by Anna Kafei:
How do you run your code on different JVMs on the same machine? Does this only mean to start the server in a different command line?
ie.
1. start RMI server with an IP/localhost
2. client connect using RMI
Where on the same JVM is NOT starting RMI and just instantiate your own DB object?

Yes, you get a new JVM whenever you execute the java command from the command-line. So you can accomplish a client server configuration on the same machine by doing what you suggest: open a command window and enter "java -jar runme.jar server", and configure the server application to use localhost; and open another command window and enter "java -jar runme.jar", and configure the network client to use localhost as the database server.
Of course, running in standalone mode only requires opening a single command window and entering "java -jar runme.jar alone". Running in standalone mode only requires a single JVM. Running in server mode requires a JVM and running in network client mode requires a JVM, so if you're running the server and client on the same machine you will be running two different JVMs on that machine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic