• 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

[NX]How to design the Server or accessing mode

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,every professionals!
I just downloaded my assignment(ver 1.2.3),and in it,you will see the following paragraphs about Server:
"Network Approaches
Your choice of RMI or serialized objects will not affect your grade, but no other approach is acceptable. In either case, the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely. No authentication is required for database access.
Locking
Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above. 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. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available. "
Please teach me the detail ways to implement the Server,and at the same time,I've two problems:
1)How to do to"lock a resource that is already locked should cause the current thread to give up the CPU"?
2)And how to do ... "local database is to be used, in which case, the networking must be bypassed entirely"?
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Richard Jackson:
I've two problems:
1)How to do to"lock a resource that is already locked should cause the current thread to give up the CPU"?
2)And how to do ... "local database is to be used, in which case, the networking must be bypassed entirely"?


the first one, if one record is being locked, you have to wait the lock to be released, and try to obtain the opptunity to lock that record, you can use wait/notify mechanism to implement it.
the second one, in standalone mode, you can not use the serized approach to access the objects, that means, you can not depend on the RMI to do that in this mode.
Hope that help.
Frank. Jun 25,2003
[ June 25, 2003: Message edited by: frank sun ]
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please teach me the detail ways to implement the Server
That sounds too general a question, I think. You ought to have some ideas of your own about this if you're taking the test. Perhaps if you explain your current ideas, we can offer suggestions? You also may want to buy Max Habibi's book, as it contains a complete sample project which is similar to what you'll have to do for the assignment.
 
Richard Jackson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for JIM and Frank.
In my starting point,I want to know the details about my assignment.So as my said,I've still two problems:
1)What does it mean the word "bypass" when you are asked for implementing the accessing database function through BYPASSing the networked-mode entirely?
2)The Data class is required data access class.According to this,can't I modify the name or create other classes to implement the accessing function?
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1)What does it mean the word "bypass" when you are asked for implementing the accessing database function through BYPASSing the networked-mode entirely?
In this case "bypass" == "circumvent", if that helps. Create a solution in which you do not use the network classes at all if the standalone mode is invoked.
2)The Data class is required data access class.According to this,can't I modify the name or create other classes to implement the accessing function?
You can certainly create other classes. I would say all data should go through the Data class at some point. You can have other layers though, other classes that call the Data class, and the Data class can call on other classes (like a RandomAccessFile or FileChannel for example). But any time a user accesses or modifies data, somehow, somewhere there should be a call to a method in the Data class that handles the request.
 
Richard Jackson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for Jim's answer.
But I still confuse the way to implement RandomAccessFile or FileChannel.Could you explain the detail procedures when I do the part of work.
Thanks again.
-------------------------------------------------
Regards,
Jackson
 
Richard Jackson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,all.
I am still confused some states in the instuctions.html file.One shows as follows,

All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes.


1)What does it mean?
2)Need I do my work to write all the part of codes in the another header file(e.g called Header.java)? This mean that I must use DataInputStream and DataOutputStream classes to read and write data info?
Regards,
Richard.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic