Ching-Tien Chang

Greenhorn
+ Follow
since May 31, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ching-Tien Chang

After a month of waiting, I have got my result from assignment watcher
database (www.certmanager.net/sun_assignment).

General Considerations (maximum = 100): 73
Documentation (maximum = 70): 70
O-O Design (maximum = 30): 30
GUI (maximum = 40): 40
Locking (maximum = 80): 80
Data store (maximum = 40): 40
Network server (maximum = 40): 40

I don't know why I lost so many points on general considerations but this doesn't matter now. I must thanks for the following ranchers, because of their valuable suggestions I can got 80/80 on locking issue:

"Jon Entwistle"
"Andrew Monkhouse"
"Jon Entwistle"
"Anthony Watson"

Also thanks for everyone on the forum for helping people out.

Sincerely,
Ching-Tien Chang
19 years ago
Andrew Monkhouse:

Thanks so much for your kindly reply,

and sorry for reply so late ^^"

I think I can just ignore the test case

Sincerely,
Ching-Tien Chang
dear folks:

I have two question about the RMI:

1. In the SCJD application submission I implement the network mode using
RMI, but in one of my test cases: RemoteObject using the real ip and
client software using virtual ip, client side can retrieve data from
RemoteObject correctly but if one of the clients change the data,
RemoteObject can't notify other clients the data has been changed
and catch a RemoteExcepion(connection refuse: 192.168.xxx.xxx).
Any solution for this situation?
(The code can work perfectly if both hosts are real ip or both hosts
are at the same subnet)

2. SCJD exam didn't mention about required network environment, can I
assumption that the exam just require both server and client side
are at the same subnet and just ignore the test case?

Regards,
Ching-Tien Chang
Thanks for Robert Konigsberg and Itapaj� Takeguma's reply and sorry for reply so lately.

I will think about both of your suggestions and post new question here if I still have any question about this.

Sincerely,
Chhing-Tien Chang
Hi all:

In the assignment requirement:


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.
The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.



I have finish the network mode part using RMI, here is my system architecture

Data
|
BusinessModel(extends UnicastRemoteObject implements Remote)
|
| (communication over network)
|
client code

I am now implement the non-network mode, but if I try to create a new
instance of BusinessModel without create BusinessModel_Stub and BusinessModel_Skel, a big-fat StubNotFoundException will be thrown.
If my system running in non-network mode but must rely on the existence
of BusinessModel_Stub, am I violate the requirement?
(In non-network, I'm not using any code about binding port or using rmiregstry)


Thanks a lot for answering and happy weekend,
Ching-Tien Chang
Thanks for Jon, Mike and Andrew,

I'm glad for understanding the lock issue that specified by the exam.

Sincerely,
Ching-Tien Chang
what you think mike,

i want to listen your opinion





Ching-Tien Chang
Dear Jon:


----------------------------------------------------------
You mean makes the DataAccess class singleton
----------------------------------------------------------
No - what happens if you add extra tables to the database?


Maybe in another words, how many RandomAccessFile object can actually access
database file?
ps. In SCJD exam, database = database file = only one table



--------------------------------------------------------------------------

synchronize all data access method?

--------------------------------------------------------------------------
No - just synchronize the code that needs it, wether that be a method or blocks of codes in methods.



agree with you.


----------------------------------------------------------------------------
why we needs the APIs
lock(recNo)
unlock(recNo)
isLock(recNo)
---------------------------------------------------------------------------
You are just providing a mechanism for clients to declare that it wants exclusive delete and update rights to this record. It is up to you to code clients to honour this convention. This has no relation to writing thread safe code.



if update() is synchronized, ClientA update 1'th record, and at the

same moment ClientB update 1'th record.

either ClientA or ClientB can get "synchronized", if ClientA

get "synchronized", ClientB are blocked in synchronized pool until

ClientA release the "synchronized". so there is no need to call

lock() before update(), because this is all done implicitly.


thanks sincerely,
Ching-Tien Chang

[ July 14, 2004: Message edited by: Ching-Tien Chang ]
[ July 14, 2004: Message edited by: Ching-Tien Chang ]
You mean makes the DataAccess class singleton and synchronize all data access method? if do so, there are one client at a moment can "really" access the database file, and when the client is access the database file, there ary no other client can interrupt it, if so, why we needs the APIs
lock(recNo)
unlock(recNo)
isLock(recNo)

could give me a scenario that needs the lock/unlock call?


appreciative,
Ching-Tien Chang
hi Jon:

yes, you are right, this is about thread issue.

If all data access method use synchronized, there are no "dirty-reading"

occurs. But if we do so, there ary only one client can access the database

file at a moment.

In the SCJD exam, do we need to achieve "simultaneously reading/writing

database" or "just synchronized all method, one client can access the

database file at a moment is okay"?



synchronized all method:



simultaneously reading/writing database






Grateful for your reply.

[ July 14, 2004: Message edited by: Ching-Tien Chang ]
[ July 14, 2004: Message edited by: Ching-Tien Chang ]
hi Jon:

for solution 1, "dirty reading" i means:


original data(10'th record):
A B C D E

client A:
lock(10);
update("1 2 3 4 5", 10);
|(start update)
| there are one moment, data will be "1 2 3 D E"
|(update finish)
unlock(10)


Since read(recNo) did not perform lock(10) before reading ,so at the moment

Client B:
read(10); -----> and get the 10'th record is "a b c D E"


that is the "dirty reading" i mean.

hopes my explain is clearly
[ July 14, 2004: Message edited by: Ching-Tien Chang ]
Dear folks:
after reading the relative topics of locking in the forum, i conclude three locking mechanism, and listing it below:

Prerequisite APIs by assignment:


Solution 1: Performs record level lock.
opt1: Only lock the record that needs to be modified or deleted.
advantage: absolutely fill the requirements.
disadvantage: "dirty reading" will occurs.

opt2: Lock the record when reading/modification/deleting
advantage: "dirty reading" won't happen.
disadvantage: very poor efficiency; not 100% fill the requirements.
(Locks a record so that it can only be "updated" or "deleted" ...)


Solution 2: Implements the database level "Readers/Writer Pattern"
advantage: Easy to implement and the efficiency is not bad.
disadvantage: Not fill the APIs requirements.


Solution 3: Implements the record level "Readers/Writer Pattern"
advantage: Best efficiency.
disadvantage: Not fill the APIs requirements and needs hard coding.


My question is:
1. Which solution you choice?
2. Any people use solution 2 or 3 and pass the exam? if yes, how many score
in the locking section they got?

Needs predecessor's comments, any comments are welcome.

Best Regards.
[ July 14, 2004: Message edited by: Ching-Tien Chang ]
Mr.Anthony:
Thanks for your kindly answer,
I will pay more attention on my locking mechanism.

Sincerely
Ching-Tien Chang
Sorry, I have a little question about solution 1:

there are at most one Data(and maybe accompanied by one Adapter) instanse. So both static member and instance member has only one copy in memeory.

Only lock the record that the client is updating(or deleting) and lock the file pointer that the client is using.


question is : how many file pointer in your data instance?
Thanks you Mr.Anthony, this is the answer that want ^^

another question:
please reference the thread:
https://coderanch.com/t/183457/java-developer-SCJD/certification/NX-URLyBird-single-remote-object

the topics discuss about "single remote object or multi-remote object?"
thought many people reply for this topic, but still no answer about
"why not just use one single remote data class for each client and any disadvantage??"

could anybody give me answer? thanks vary much.