Win a copy of Head First Android this week in the Android forum!

Peter Joosten

Greenhorn
+ Follow
since Aug 16, 2005
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 Peter Joosten

The main question I am asking is that wouldn't it make sense to keep the recordNumbersLock.writeLock() locked until after the database has updated,


You are correct. How about 2 threads each creating a new record. This could end up in both records getting the same offset, and one of both being overwritten in the database.

General remark on your updateRecord method: try to implement a separate classes for 1. file access, and 2. for functionial locking of a record by the clients (as in Andrews book).
Same topic as:
"Synchronization/locking question on persistDVD in Andrew's book - Daniel Bryant". Continue discussion there. This topic can be closed.
Following is a code fragment of sample application from the "SCJD Exam with J2SE 5": class DvdFileAccess, method persistDvd.


The actual write to the RAF takes place after this code fragment.

Suppose 2 threads both want to create a new record.
1. thread 1: get writelock.
2. thread 1: get offset: offset = database.length();
3. thread 1: release writelock.
4. thread 2: get writelock.
5. thread 2: get offset: offset = database.length();
6. thread 2: release writelock.
7. thread 1: physical write.
8. thread 2: physical write.

At 5. no physical write has taken place yet, the database length is unchanged, and the value of the offset will be the same as at 2.
At 8. the new record ot thread 2 will now overwite the new record of thread 1.

Any comments ?


Regards,
Peter Joosten.
There is a motocoder website.

http://www.motocoder.com/motorola/template.jsp?filename=center_V3.html

Download the Motorola J2ME SDK (and other tools) for your device.

Originally posted by Andrew Monkhouse:

  • Having a single or multiple RAF instances


  • At the end of the day, there is only one physical file on disk.

    Some operating systems ...



    Interesting ... So to be on the safe side I should implement a single RAF
    ( / single filepointer). Consequence: I can have multiple concurrent threads, but they can write to or read from the RAF, only 1 at a time. I cannot have simultanious reads of the same record, or writes to different records (of course). But then, what's the point of locking a record, I might
    just as well lock the whole table :-) Food for thought! It's late, maybe my mind is not clear at the moment. I'll better go to bed and rethink this tomorrow. Comments are very welcome!
    [ November 23, 2005: Message edited by: Peter Joosten ]
    Quote:
    Throughout this exercise, you must use exclusively the Java 2 platform. You may develop your code using any implementation of the Java 2 platform, but the submission that you return must have been tested and shown to work under a production (not development) version of the Sun Microsystems' Java 2 platform and that platform must not have been superseded by a new production version for more than 18 months by the time you make your submission.
    Unquote.

    I count 3 times Java 2 platform: does this mean I must use 1.4 and have to submit my assignment before March 2006 (or else buy a new assignment) ? Or can I use Java 5 platform (1.5) anyway. (Sorry for asking, just need to be sure)

    I did buy my assigment January 2005, but for personal reasons I just got started about a mont ago.
    [ November 20, 2005: Message edited by: Peter Joosten ]
    https://coderanch.com/t/147872/java-Web-Services-SCDJWS/certification/Study-Resources-SCDJWS-Exam

    This is the thread I referred to. Skip the messages about the specs, unless you want to become a member of some w3c comittee. Start reading with the message of Richard Monson-Heafel.

    Peter.
    16 years ago
    In my story I forgot to mention that I took the SUN Web-based Practice Exams WGS-PREX-J220C. There are 3 exams, 70 questions each. The explanations for
    the answers are worthless, so it is a bad learning tool, but it was a good tool to test if I was ready for the real exam.

    After reading half of the RMH my score for the 1st exam was 60. This was more than I expected, because at that time I didn't have coverered half of the certification requirements. Than I read MZ Guide, and I did the 1st exam
    (again) and the 2nd exam. Score: 84% and 80%. This made me confident.

    Yesterday, I read the MZ Quiz, and did the 3rd practice exam. Score: 67%
    My confidence was gone (passing score 68%). So I think I must be extremely lucky that my score for the real exam today is 84%.

    Originally posted by Ami Goop:
    Peter

    Were Mikalai's notes enough for the SCDJWS ?

    Thx

    ami



    I did read half of the RMH book, and I also did the practice exam. But I think MZ Guide + Quiz is the greatest contribution to my success. Not all requirements are covered by the MZ materials. The ommisions are mentioned
    as "TODOs".

    The questions on the exam are simple, and since it is multiple choice you can can come far with reasoning, eliminating, some superficial knowledge, and some intelligent guesses. The difficulty with this certification is not
    the level of required knoglegde, but the fact that it covers a lot of ground.

    So if your (very) strong in reasoning, than read the MZ Guide + Quiz. And take the SUN Practice Exams to test if your ready. You will not get a 100% score, but maybe you will pass.

    The way I prepared for the exam, I cannot recommend it. If I would have had
    all the time I wanted to prepare, I would have read RMH book + Blueprints book, played around with the SUN Web Services Developer Kit, And then read the MZ Guide + Quiz to prepare for the exam.

    There is some older thread in the SCDJWS forum, with a study advice that I would recommend: read RMH book, some chapters of Blueprints, JAXB chapter of the SUN Web Services Tutorial and some article about TrAX. I will see if I can find it. Then I will post the link here!

    Greetings,
    Peter Joosten.
    16 years ago
    Had to be certified quick for commercial reasons. Started to read RMH: excellent book, but to many pages. Stopped half way thru. Got MZH Guide + Quiz. Harder to read, but less pages.

    Mikalai, thanks!
    You made my day,
    Peter Joosten.

    Now that I am certified, my employer is satisfied, and I will have time
    to pick up RMH again, start reading Blueprints, and participate in on-line course Web Services Programming (with Passion!)
    http://www.javapassion.com/webservices/index.html
    to get some REAL knowledge, and hands on!

    I think the subject UDDI is boring! Agree, disagree ?
    (Propably because there is nothing to understand,
    only lots of things to learn by heart, which I don't like)
    16 years ago
    http://www.w3.org/TR/REC-xml-names/

    XML namespaces provide a simple method for qualifying element and attribute names used in Extensible Markup Language documents by associating them with namespaces identified by URI references.

    <?xml version="1.0"?>
    <city xmlns='http://www.cities.org/cityspec-1.1'>
    <services><garbagecollection>Trash Co.</garbagecollection></services>
    </city>

    <?xml version="1.0"?>
    <java xmlns='http://www.java.org/javaspec-1.5'>
    <feature><garbagecollection>JVM 1.5</garbagecollection></feature>
    </java>

    Namespaces help to prevent ambiguities.