my dog learned polymorphism*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: single JVM in non-networked mode? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: single JVM in non-networked mode?" Watch "B&S: single JVM in non-networked mode?" New topic
Author

B&S: single JVM in non-networked mode?

Steve Taiwan
Ranch Hand

Joined: Jul 01, 2003
Posts: 166
I get B&S assignment. It has the following sentences:

I interpret sentences as the follows.
1. When there is a sever which is started by �server� flag mode, database and gui in non-networked mode must run in the same JVM that is started by �server� flag mode for server.
2. When there is not a JVM which is started by �server� flag mode, database and gui in non-networked mode can run in a new JVM.

Am I wrong?

Or it should be that database and gui in non-networked mode can run in a new JVM even when there is a �JVM which is started by �server� flag mode�?

Thank you for the reply in advance.


Steve Taiwan<br />SCJP 1.2, SCJD 1.4, SCWCD 1.3, SCBCD 1.3, OCP 8i DBA, SCEA
Steven Hoodless
Ranch Hand

Joined: Mar 23, 2004
Posts: 64
Steve,

I think there are three modes usually server, alone and network mode.

In alone mode there is one JVM which starts the GUI, gets the file details and connects to the database.

In Server mode there is one JVM which connects the server to the database.

In network mode there is one JVM which connects your client to a, previously started, server. There may be many clients either on your machine or on your network but each is a new JVM.

As an example you might start two servers listening on different ports. This would require 2 JVMs. You then might have 10 clients using server 1 on port XXXX and 10 clients using server 2 on port YYYY. You'd have 22 JVMs running in total. They might all be running on one PC.

Steven


SCJP, SCJD, SCWCD.
Steve Taiwan
Ranch Hand

Joined: Jul 01, 2003
Posts: 166
Hi Steven.

Thank you for the reply.

my question is:

After there is a JVM which is started by "server" mode flag, a user tries to start a gui client by using "alone" mode flag, should this gui client request "JVM which is started by "server" mode flag" to spoon a thread for gui client? And then gui client(using locat object to connect to database) and server run in the same JVM?
Steven Hoodless
Ranch Hand

Joined: Mar 23, 2004
Posts: 64
Steve,

I may not understand you correctly but here's my interpretation of things.

The server starts up in its own JVM. It connects to the database and sits and waits for clients to call.

Clients start in seperate JVMs they connect to the server using hostname and port. The JVMs do not merge to become one. Nor does the client connect to the database directly. The client can call a method on the server (example book()) and the server books the record in the database.

Lets call the 2 examples above server and network modes.

Is that any clearer?

Steven
Steve Taiwan
Ranch Hand

Joined: Jul 01, 2003
Posts: 166
Dear Steven

Thank you for the reply. I do read a lot of threads about the mode flag but I still can't understand it.

My question is about "server" mode flag and "alone" mode flag.
What I am concerning is:
Step 1. Andy starts a JVM for "server" mode flag in Andy's PC. So currently, there is a JVM running.
2. Grace doesn't know Andy start a JVM for "server" mode flag. Then after a while, Grace tries to start a JVM for "alone" mode flag in Andy's PC. In "alone" mode flag, this JVM is gona use local object to connect to database.

In step 2, should Grace start a new JVM? or will Andy's JVM spoon a new thread for Grace, Therefore, we keep a single JVM in a PC.

Or When Grace start "alone" mode flag, she doesn't care about if there is an existing JVM which is started by "server" mode flag.
Steven Hoodless
Ranch Hand

Joined: Mar 23, 2004
Posts: 64
The simple answer is Grace wouldn't care that Andy was running a server on his PC.

You are mixing two things which will never happen. The spec says that at any moment only one process is going to be accessing the database. I don't have the spec with me but you must know the part I mean.

Lets assume the database exists on Andys PC. Either Andy will have his server up and running on his PC attending to the needs of the "network" mode clients or Andy will have gone home (having ended the server application) and Grace will be using the PC to use the new B&S Java system in "alone" mode. This way only one process (Andy's server OR Graces "alone" connection) will be accessing the DB at a time.

Happy?

Steven

ps. What the hell is Andy doing leaving Grace alone in the office with access to his PC? Doesn't he know about her dubious history?
Steve Taiwan
Ranch Hand

Joined: Jul 01, 2003
Posts: 166
Dear Steven

Thank you for the response.
Now I got it.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81


ps. What the hell is Andy doing leaving Grace alone in the office with access to his PC? Doesn't he know about her dubious history?


Hmmm, sounds like Andy doesnt practice safe hex


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S: single JVM in non-networked mode?
 
Similar Threads
Questions of understanding the request (URLyBird1.2.2) .
Who can hel me?
how to comprehend the "Non-Networked Mode" mentioned in my requirement!
NX: What is loopback networking
How many modes are there for the program?