wei liang liang

+ Follow
since Dec 29, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by wei liang liang

OK,I have a touch with what people says here...
Requests from different JVMs will be interpreted as "different programs",
therefore i may assume at any instance requests could only comes from
one JVM but different threads.
Am I right?
Thanks everybody's help.
p.s.The spec also says:
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...

Locally concurrent clients could come from different JVMs,right?
Have I missed anything?
Yeah,that's exactly what my spec says.
Locally how would you construct strictly one server instance
serving different threads comes from different JVMs?
Locally you would have trouble,because unlike using registry(in which only a
single instance is registered),locking a particular record
requires you to lock something across different JVMs(different clients).
Suppose you have both a remote and a local client accessing the data file,
how would you perform locking?That's what seems entrangles me.Any more helps?
Hi Andriv,Thank you for your reply.
For my assignment,the spec has given me an interface for which I must

public interface DBMain(){
public void update(int recNo,String[] data) throws RecordNotFoundException;
....(and so on)
public void lock(int recNo) throws RecordNotFoundException;
public void unlock(int recNo) throws RecordNotFoundException;

This apparently indicates I have to lock a paticular record for both remote and local
access.(So i can't create a file to indicate my data file has been locked because this will,
effectively lock all records,which is apparently not the examiner wants because it will
introduce read/write overheads).
You have mentioned "one server,multiple clients",my question is: when different users(locally)
type "java -jar sampleproject.jar alone",they will inevitably result in different JVM(because this is the
spec says i must do).There is no easy way i could synchronize/lock a particular record across
different JVMs.
Remotely i am OK,because once i have put my data access instance in the remote registry,
different clients will invoke the same data access instance via a remote stub,thus it becomes
"one server,multiple clients",but how can you achieve this in a local context without using RMI
registry/sockets (which are prohibited)?

I don't understand.The spec says you must not use serialized/sockets code in a non-networked mode.
My interpretation is I could only start a separate JVM each time when the user type "java -jar [jar_file_name] alone"
(this will start a GUI+database access function within an independent JVM).Consequently,I have to
perform locking across multiple JVMs.How could you have a single server instance shared between different
JVMs without using RMI?Could you please give more explanations?
I have my SCJD assignment and it says:

The program must be able to work in a non-networked 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 the GUI and database elements.
When you submit your assignment, each part (client and server) must be executable using a command of this exact form:
java -jar <path_and_filename> [<mode>]
So if i want to start multiple non-networked GUI,I have to type "java -jar [jar_file_name] alone" multiple times.But this will start multiple JVMs(each JVM corresponds to
one "GUI+database access").The problem is,how can we lock/synchronize an object/record accross multiple JVMs?Conventional locking strategies don't seem to
be working here.Have i missed anything?Any help will be much appreciated.