Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nx:All of URLy Bird 1.1.3 all method in Data

 
liqun chang
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi George and Satish,i have finished my Data and test standalone is right,
but for multiple thread test there is some mistakes.
i will represent each method and hope you give me some suggestion.
 
liqun chang
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Data class is not singleton,also each client has a new Data instance.
so in Data class most of codes are placed in synchronized block.
lock method:
 
liqun chang
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unlock method:

Please you see whehter my lock and unlock method is right?
[Andrew: removed code]
[ March 30, 2004: Message edited by: Andrew Monkhouse ]
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Liqun, did you check this thread.
All of URLy Bird 1.1.3 about Junit test
Did you solve the problem there?
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Liqun, I have gone through the lock and unlock methods. As I understand, the locking mechanism looks mostly/exactly like the one given in Max's book. As such, I see the locking mechanism is good. If while testing, you get any errors and if you want to post the errors, please post the stack trace along with ONLY relevant lines of the code.
It seems that you almost posted all of your code. Please remove it. I already got it noted, so if you can have doubts you can post. I can check your code that's with me and answer if you want and let know.
If you want to contact me, here's my ID avadhanamsati@yahoo.com.
Good Luck.
Did you find out what is wrong with your update testing?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Liqun,
I have removed some of your posted code. As Satish noted: we do not allow major sections of the assignment to be posted in this forum. The locking code is worth 20% of the assignment, and this is far too much to post in total.
There are multiple reasons for this policy:
  • Sun do not allow you to share your assignment or a solution to the assignment with others.
  • You have spent time and effort getting your solution right. It would not be right for someone else to just copy your solution without working it out for themselves.
  • If someone did get awarded the SCJD certification after copying your code, and were then given employment because they had that certification, the employer would probably find that the employee cannot actually do the work. Which makes the perceived value of this certificate decrease.
  • If people post too much code, then Sun may, in the future, request that we do not allow any SCJD code to be posted.

  • This policy is described in the question "What is the policy on posting questions I saw on the exam / details of how to do the assignment?" in the JavaRanch SCJD FAQ.
    Regards, Andrew
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 12014
    220
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Liqun,
    Regarding the code:

    I think you would be better off defining a few constants so that the person who has to maintain your code does not have to try and guess at what these values mean:

    You might also want to consider whether you want the exception to be more meaningful:

    Regards, Andrew
     
    liqun chang
    Ranch Hand
    Posts: 90
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Satish,today i will send my test code and Data class to you email.and hope you help me to find out my questions.If you find out my mistakes please
    you send the solution to my email.
    my id: liqunchang2001@yahoo.com
    liqunchang2000@yahoo.com.cn
    Thanks .good lucky
     
    liqun chang
    Ranch Hand
    Posts: 90
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Satish,you are my second friend and give me help.i don't know what to saying.good luck to you and your family.thanks very much.
    I have send my test code to your email.and if you receive it please you tell me in this thread.
    [ March 30, 2004: Message edited by: liqun chang ]
     
    Satish Avadhanam
    Ranch Hand
    Posts: 697
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Liqun, thanks for your kind words.
    Once I get mail, will look into it and reply back. Till then, Good Luck to you
     
    Satish Avadhanam
    Ranch Hand
    Posts: 697
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Liqun, I got the mail. I will look into the code. But the problem is I was trying to unzip or untar the sent file, but it could'nt open. I tried to install a couple of zip tools by searching in google and unzip it, but it could'nt open in the proper format. Sorry about that. So if you can send the code in PLAIN TEXT format, that would be great. Will look into it and reply as soon as possible.
    Looking forward to your mail. I also e-mailed to your yahoo ID. Good Luck.
     
    liqun chang
    Ranch Hand
    Posts: 90
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Satish i want to say thanks again.you are my empressement friend.
    I will give you my code use *.jar and *.zip because my file has directory
    structure.
    if you receive please you tell me.
     
    Satish Avadhanam
    Ranch Hand
    Posts: 697
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Liqun, I did not recieve your new mail yet. Just want to let you know.
     
    liqun chang
    Ranch Hand
    Posts: 90
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Satish:thanks for your suggestion.because you said my update() is right.
    So i change the WeakHashMap to HashMap,the result is ok.
    But another question appears:How could i deal with the client crash?
     
    Vitali Chalov
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Liqun,
    Originally posted by liqun chang:
    My Data class is not singleton,also each client has a new Data instance.
    so in Data class most of codes are placed in synchronized block.

    So, you have multiple instances of your Data class, I assume one instance per client. What about RandomAccessFile (raf). It is a member of your Data class. But tell me, is it class member (static) or instance member?
    Regards,
    Vitali.
    [ April 07, 2004: Message edited by: Vitali Chalov ]
    [ April 07, 2004: Message edited by: Vitali Chalov ]
     
    liqun chang
    Ranch Hand
    Posts: 90
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Vatili:my the RandomAccessFile is the static member for all Data instances. because i catch a cold,sorry for reply you now.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic