aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Use Case for Network Mode Start-up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Use Case for Network Mode Start-up" Watch "Use Case for Network Mode Start-up" New topic
Author

Use Case for Network Mode Start-up

Glen Iris
Ranch Hand

Joined: Jul 13, 2011
Posts: 164

Hey guys,

I am currently documenting the use cases for the newtork mode of operation.

I am thinking that the operation will roughly go like this:

1.Obtain the server details from the .properties file and/or the user.
2.Start the server if it is not already running.
3.Start the client and connect the client to the server.

Is this a good idea or should starting the application in netwrok mode be a two step process for the user?

ie
1. Start the server
2. Start the client which connects to the server

?

Thanks


OCPJP 6, OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

When the user starts the network client, the network server should already be up and running (executed by a system administrator for example).


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Glen Iris
Ranch Hand

Joined: Jul 13, 2011
Posts: 164

Thank you once again Roel.
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
We also need the non-network mode, which is called alone mode based on Monkhouse book. I have a question: Do we need to implement multiple clients application without the RMI server in the alone mode?
When I ran Monkhouse 's Denny Dvd in alone mode, there is only 1 client running. In the exam, do we need to create multiple threaded clients updating the same db file when running on alone mode?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

That's clearly stated in your instructions! Read them carefully.
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Let me go home to double check about non-network mode specification. I think my specification may be different from Glen's. Denny's DVD alone mode only deals with one client while the netowrk mode deals with multiple clients.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

Helen Ma wrote:Let me go home to double check about non-network mode specification.

The main parts of the instructions are always the same. Luckily for us, makes moderating a whole lot easier The only things that differ (in the different assignments) are the name of the company you are working for, the interface you have to implement and the database file structure.
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
I am revisiting the instruction about Non-network mode:

In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking and must not involve the serialization of any objects when communicating between GUI and database element.

..... this mode must use the database and GUI from the networked form, but must not use the network server code at all.


It does not mention anything about creating multiple threaded clients (multiple GUI's) , reading/writing the db file concurrently.
I assume we can use Monkhouse' approach: start the GUI, read the db file and perform the rent/return/search. In the same VM, I don't see there are any multiple clients involved.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

When i read the instructions carefully I notice this sentence:
instructions.html wrote:You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.


Helen Ma wrote:It does not mention anything about creating multiple threaded clients (multiple GUI's) , reading/writing the db file concurrently.

So that means you have different instructions (if you didn't encounter that sentence) or you are not able to read instructions carefully and understand them.

Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Roel De Nijs wrote:When i read the instructions carefully I notice this sentence:
instructions.html wrote:You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.


Helen Ma wrote:It does not mention anything about creating multiple threaded clients (multiple GUI's) , reading/writing the db file concurrently.

So that means you have different instructions (if you didn't encounter that sentence) or you are not able to read instructions carefully and understand them.



The sentence: "You may assume that at any moment, at most one program is accessing the database file....multiple concurrent clients of your server."
It is refering to the RMI network mode.

But for the standalone mode, there is no client/server relationship involved. In standalone mode, like Monkhouse's DVD example, there is only one client GUI, reading / writing the DB file.
I am sure it is very obvious that when in network mode (RMI/Socket), multiple clients and a single server relationships should be implemented.
When I read the non-network mode , there is no server involved. To my understand from the instruction and Monkhouse's DVD, I just need one client for non-network mode.
Glen Iris
Ranch Hand

Joined: Jul 13, 2011
Posts: 164

Hi Helen,

My understanding of this sentence:

You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.


Is that no other application, ie, an application separate to the one you are developing, will be accessing the database file.


G
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Hi, Glen.
The sentence: "You may assume that at any moment..... multiple concurrent clients of your server...."
To my understanding is that you start a server (RMI/socket server), then you start multiple clients connecting to the server.

In the exam, besides RMI client/server application, there is also a standalone mode.
In the standalone mode, there is no server involved.
Monkhouse's book or Roberto's publication talks about network mode and non-network mode. These two modes are required.
It is understandable that network mode is the RMI / socket server responding to multiple client requests.

But for standalone mode, it seems to my understanding that we just need to start the application in one JVM, reading/writing the db file. It does not seem like we need to start multiple threads doing reading/writing the db file concurently in standalone mode. This is my question : Do we need to create multiple threads to read/write the db file in standalone mode?
(The assignment specification does not say anything about this even though Roberto's Data test create 10 threads doing updating in one class.)
Glen Iris
Ranch Hand

Joined: Jul 13, 2011
Posts: 164

Hey Helen,

I will be coding my application to deal with multiple clients running on one JVM accessing one local db file.

G
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Hi, Glen.
Please verify what I wrote in the previous post.

In network mode, it is required that we need multiple clients and a single server doing conncurrent and thread safe reading/writing.
But in non-network mode, it does not say it is required that we need multiple clients reading / writing the same db.
If it is not requried in non-network standalone mode, I will use Monkhouse's approach : run one client doing one reading/writing.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

instructions.html wrote:You may assume that at any moment, at most one program is accessing the database file;

That's clearly stating that at most one application will be accessing the database file. So if you are running the application in standalone mode, you know that for the whole time this application is running, this application is the only one accessing the database file (no network server, no other applications inside the company,...). No discussion there, instructions are very clear.

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

Helen Ma wrote:Do we need to create multiple threads to read/write the db file in standalone mode?

No.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

Glen Iris wrote:I will be coding my application to deal with multiple clients running on one JVM accessing one local db file.

Huh How are you planning to start multiple clients in 1 JVM?
Glen Iris
Ranch Hand

Joined: Jul 13, 2011
Posts: 164

hey Roel,

by that I meant that concurrent instances of my application can be run at the same time by entering the command
java -jar <path_and_filename> <local_mode>
in many different command line windows on one machine.

do you see a problem with this?
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Roel De Nijs wrote:
Helen Ma wrote:Do we need to create multiple threads to read/write the db file in standalone mode?

No.


Hi, Roel. Thanks for this reply. I can do the work in a similar way as Monkhouse's approach for the standalone mode, just one client's GUI, doing reading/writing, no other threadings doing concurrent reading/writing.

So, Roberto's Data test involves threads doing concurrently updating/findings... I am sure this test is simulating RMI multiple client requests.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

Glen Iris wrote:do you see a problem with this?

No, certainly not (I did exactly the same). But then you have multiple clients running on same computer, not in same JVM.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

Helen Ma wrote:So, Roberto's Data test involves threads doing concurrently updating/findings...

The purpose Roberto's Data Class test is simply to check if your Data class is thread-safe. So you'll get an answer on the question "can my Data class handle multiple concurrent requests from different threads without corrupting the data or hanging forever".
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Roel De Nijs wrote:The purpose Roberto's Data Class test is simply to check if your Data class is thread-safe. So you'll get an answer on the question "can my Data class handle multiple concurrent requests from different threads without corrupting the data or hanging forever".



Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use Case for Network Mode Start-up