• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Steven

Thank you for the response.
Now I got it.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
 
reply
    Bookmark Topic Watch Topic
  • New Topic