Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frustated, Your view on this

 
Nicolas Kal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear xxx,

I have strong disagreement regarding the grading of my SCJD resubmission. The first time I submitted my assignment I understand that the locking facility was implemented incorrectly (I received 7 out of 80).

In the resubmitted assignment I have corrected the mistake and I strongly disagree that record locking is not working. I have searched through forums, I have consulted other developers, read books and the way I have done it works. How is it possible last time to receive 7 out of 80 without having a working solution and now receive 0 out 80 when it is actually working??? I am providing a video demonstration that clearly provides evidence that the record locking is working according to the following specification “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.” In the attached video you can see that the first client Opens for the first record “Dew Drop In”. At this point the lock is hold by that client. While the lock is held the other two clients request an edit on the same record. Since the record is locked the threads are put to wait, consequently “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.” When the thread that holds the lock performs the update the waiting threads are notified and one of the two waiting clients is awake and holds now the lock for the updated record.


In the RemoteDataSimulator class there are two new methods lockHotel and unlockHotel which their main purpose is to allow a thread to lock a resource. If you open the HotelLocker class when a thread requests a lock it first checks if the record is locked by other thread. If it is locked the thread is put to wait, thus meaning “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.”

public void lockHotel() throws RecordNotFoundException, FileNotFoundException{
while ( isRecordLocked() ){
try {
Data.singleton().wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}


When a thread finishes with a record the thread notifies all of the waiting threads thus meaning the following “consuming no CPU cycles until the desired resource becomes available”.

public void unlockHotel() throws RecordNotFoundException, FileNotFoundException{
Data.singleton().openFile();
Data.singleton().setUserId(userId);
Data.singleton().unlock(hotelCode);
Data.singleton().notifyAll();
}

With what criteria was my locking mechanism evaluated?? What am I supposed to do? Buy a third resubmission voucher? For what reason? To supply again this solution since it is working? I have consulted other sun certified developers and all agree that my solution is according to specifications and that I shouldn’t have failed? Do you use any kind of automated tests to see if record lock is working? Because my record locking mechanism is placed on the RemoteDataSimulator and not on the Data class. There is no restriction on the instructions and I have indicated the way my locking mechanism works and honestly I don’t see why the assessor failed me this time.

I understand that first time that I failed because I was throwing an exception, but now what have I failed again when there is the appropriate usage of wait(), notifyAll()??? What else do I have to do?? Everyone else is following the same approach with the difference that others place it on the Data class, again there is NO restriction specified regarding where to place the locking mechanism and there is NO justified reason why I received even lower mark than the last time. I expect a more detailed feedback than this “Major point loss for record-locking mechanism, which is not according to spec. Your locking code does not block when trying to lock a locked record” This is copy paste message and I deserve better treatment after the total of 800-900 EURO I have paid so far.

I expect an immediate answer on this topic or I would like to speak in person with the accessor since this is insane.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try Roberto's Tests for the Data class/locking mechanism? Did they work for you?

It looks to me as though it is the RemoteDataSimulator class' lockHotel() method that is calling wait(), not the Data class' lock() method. Is that correct?

If so, then it sounds like you are not meeting the Data class' lock() method requirement that "If the specified record is already locked, the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked". While you have met this at an application level, you have failed to meet the contractual obligations of the provided interface.

To put it another way, the one and only thing in the entire submission that other developers could code to is the provided interface. They should be able to call the lock method and have it perform in the manner described. Since you have moved the responsibility for where the wait() method gets called, someone could write a program that only interacts with the implementation of that interface, only to find that it does not work as expected.

By the way - you should put code between [code] and [/code] ubb code blocks, as it can then be easier for people to read the code.

I presume the missing line(s) of this method are where you actually lock the record?

What is being synchronized here to ensure that nobody else can lock the record before you get the lock?

How are you passing around the user identification and the hotel identification? Are these global variables (which aren't thread safe)?

It also looks like you have changed the provided interface considerably - your unlock method is calling an openFile() method and a setUserId() method that are not in any interface I have seen. Can an automated test of the Data class work without knowing about any of your modifications?
 
Andriy Pererva
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Nicolas!
I don't know exactly what your problem is, but generraly I would recommend you to avoid such low-level facilities as wait/notify/notifyAll etc.
Instead, it would be better to use a new Concurrent API that was introduced in Java 5 (package java.util.concurrent and subpackages)

BTW, take a look at the A.Mounkhouse's book example project source code. He didn't use wait/notify/notifyAll at all! Instead he used ReentrantLock for the locking needs. In fact, it is much safer and looks in tune with the times.

For more details, see the book Effective Java (Item #69) and the book Java Concurrency in Practice which is one that most completely covers the concurrent issues
 
Nicolas Kal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andriy,

I don't disagree that there are and other aproaches, but searching throught this forum and not just this forum the majority has used wait and notify and all passed, yes i agree that there might be other ways but this does not mean that any acceptable solution which satisfies the requirements is a candidate to fail. And at least in my case the locking mechanism was working properly. How can you justify it that the first i did an incorrect implementation and got more marks than the second time that i actually implemented according to specs?

Regards,
Nicolas
 
Nicolas Kal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew the lock, unlock, isLocked are used, that's why in my first submission i din't received 0 out of 80 ! And yes I did used the tool to check if it works and yes it is working. Trust me the Data class is designed and lock / unlock / isLocked are called from the classes within the server, not at an application level, honestly there is absolutely no reason for this. It does not even makes sense why i received even less than the first time! But i can reassure you that the locking is performed on the server side and not on the client side

The score i received is the following
General Considerations (maximum = 100): 100
Documentation (maximum = 70): 70
O-O Design (maximum = 30): 30
GUI (maximum = 40): 24
Locking (maximum = 80): 0
Data store (maximum = 40): 40
Network server (maximum = 40): 40

Only from the scores you can identify that the data class is designed with no errors, i got 40/40 (exactly as the previous time).

I'm pissed off, the first time it took them 9 weeks to publish my results, after the 6 week i was contacting them to see wtf is going on. I know the first time it was a mistake i made because i was throwing an exception and that's why i failed. The second time I failed with 0/80 with a working locking mechanism?? I am working for one of the most global prestigius IT companies and even consulted one of the senior architects to see if I my approach was actually incorrect, what more can i say, should i pay again for a voucher? there is no possible way to again all that money, i paid so far around 900 EURO and all for nonething and to recieve a copy paste feedback, f**c it if they don't respect us and if they don't even have the dignity to provide a more detailed feedback. Personally i believe that the second assessor didn't even bother reading what I have actually done and how I implement it. Just run an automated test, anyway I don't know what to say anymore, I will go to my local Sun branch and I will camp there until i get an answer, i'm totally disapointed

Personally I believe that this is all hapening because I made serius complaints the first time about the delay in the whole process and the fact that their support department did not replied to emails.

I have read an older post from this forum that one other rancher had the same problem with me, with him they have evaluated again his solution and he got the certificate because locking was working...I hope the same will happen to me

Regards,
Nicolas
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nicolas,

I have read an older post from this forum that one other rancher had the same problem with me, with him they have evaluated again his solution and he got the certificate because locking was working...I hope the same will happen to me

I hope it also for you, fingers crossed.

I don't know of course how you designed your application, but if I compare the code of your lockHotel and unlockHotel methods with the code of my application, I see 1 big difference: calling wait and notifyAll happens in my case inside the lock and unlock methods of the Data class, you don't need a seperate call on the singleton Data instance.

I believe the code you provided as an example is specific for the network (rmi) approach. And I see another big difference in this logic (I also used a setClientId method to identify the different clients, which I documented quiet heavily in my choices.txt). So for a record to get locked i used following code:

So these seperate calls need to be in a synchronized block, because they need to be executed as an atomic operation. But again this is my solution and it could be that because of your own design this isn't necessary (but you are the only one who can check and decide if that's the case).

And like Andrew already pointed out: my interface has some extra methods, like the setClientId. But my Data class will work perfectly when just using the provided methods in Sun's provided interface. So in a multi-threaded environment the locking (and unlocking) of a record will work perfectly if and only if it is guaranteed that each client is always represented by the same thread. If you don't have that guarantee (like when you are using RMI), that's where the setClientId and the atomic operations come into play.

Just my remarks and clues why you possibly got failed again. And as a final remark: I certainly don't believe your complaints have anything to do with this, that would be very shameful of Sun: you (we) pay a lot of money for these certifications, so a minimal of service (for example get every assignment graded within 4 to 6 weeks) might be expected and if that lacks, a complaint (or more than 1) is the logical consequence.

Kind regards,
Roel
 
Nicolas Kal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel,

I agree with you, and of course all of these that you have mentioned are also covered in my design. What you see is a small snipset and I have documented all of these in my choices.txt and why I have chosen this design principles. Everything runs in a synchronised context and i explained all the considerations and assumptions that were made to design the locking mechanism and how it should be treated. Of course we all know that programming is like a mathematical problem which will have multiple answers and what it maters in the end is to get the desired result. So yes it might be difficult for someone to understand my design by just looking at one piece, as it will be difficult for me to understand the design of someone else but not looking the overall picture.

From my first submission if you remember i was frustated because of the delay and the luck of communication because I knew that i hadn't correctly so I did't want to wait no more than 6 weeks to receive an "F" and that is what happened. When I received the report i didn't got 0 out of 80 for locking, i got 7 out of 80. My locking mechanism was working but the stupid think I have done is that instead of putting the thread to wait and notify after I was throwing an exception and that is why I failed and I believe that is the reason why I did not took 0 out 80. The assumptions I made from this is that my assessor actually evaluated the locking mechanism I have implemented althought it was not working correctly, am I correct so far? And very correct my assessor didn't gave me full credits on consideration since my assumptions was incorrect (exception thrown), am I still correct?

Coming to the second submision I had to do minimal changes to my code, nothing else was changed apart from the locking mechanism that introduced the required functionality. As every logical person will think since I made changes I thought I should update the choices.txt. I explained in detail how the mechanism was working, how it was implemented in the first place and what I did to fix. I explained the possible scenarios that can occru and what happens.

Taking a closer look at my score report you can see that I have full credits for the general considerations and 0 point for the locking. How is it possible to have full credits on the general considerations and receive 0 on locking since locking by itself is the one major consideration. We have allready reached to a conflict! And how is it possible, the exact the same design, improved and working to receive less points from the initial that was not working, conflict number 2 !

In my choices.txt and in my assumptions I explained in detaild that the data class is accessed only by the remote business interface. Furthermore I explained how the lock / unlock / isLocked methods will behave within the Data class and for the overall design of the data class again i took 40 credits. conflict number 3 (suppose there was an error there)

In the company I work it is mandatory to take as part of the training the SCJP which I allready had but I wanted to take the SCJD for personal satisfaction. I don't believe that solutions architects and senior developers that deal with enterprise applications are unable to understand a simple wait / notifyAll and that told me that I had it correct and it is working just to make me feel good.. Personally I see it as a joke, let's not fool ourselfs, it does not has the complexity that we deal as software engineers in the industry..Of course it needs to carefull (something I paid in my submission for a silly mistake) but it's not the task that is impossible to do..

Which are my assumptions? I believe that the assessor that I had this time did not assess my locking mechanism properly and probably it was assessed in a hurry. YES if you don't read my considerations and you test my class with your own consideration of course it will fail but this will apply to anyone, its like a jackpot but the difference is that you don't want to hit the jackpot here.. As a java programmer and as software engineer working in the industry I find it difficult to believe that I failed when it had been actually implemented what was requested. I even recorded a video with snagit having three clients running and accessing the same resources and send it to them..

I know that probably that I will not find my right but it's "cheap" on behalf of Sun to tread us like dollar bills, or EURO bills in my case. Their customer support is the worst I have ever seen. During the 8th week of my first submission I couldn't get a reply from them and I send an email expressing my dissatisfaction to a woman called "Jenice Jensel" who is the one who used to communicate with me in order to provide me with payment details and i got an email from Eric Boice (from his personal email not the who2contact) saying to me to send him an attachment of my assignment so as he can hand it for marking. WTF is going now? 3 weeks later he was reassuring me that the grading process started when I submited and 8 weeks after he asks for an email attachment and sent me the feedback within 5-7 days. So i suppose this how much time they devote, maximum 5 days to mark an assignment and they are just feeding as cr*p saying that it will last 4-6 weeks and that is prometrics fault and we can't access your essay.. Is this a professional treatment on behalf of Sun? And after all of these how am I supposed to trust the assessor and the way he/she marks my assignment?

Just to not be missunderstood, i don't say that i don't make mistakes or to brag "oh i'm working in the industry", but when I build a product i know if it has minor points and if it needs adjustments and in that case (resubmision) i shouldn't have failed, furthermore when I have the feedback from my team members who are working for years and they are allready certified and their experience is far more extensive than mine i can't believe it that i was unable to build successfull this simple wait/notify task..If it is like this i will sell my degrees,certificates and I will go to sell pizza and I will have free food (BTW again to not be missunderstood i respect all kind of work, and I have been working a waitor while being a student)

Anyway..We'll see what will happen..
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nicolas,

When you 1st submit your assignment you threw an exception (when a record was already locked) instead of just letting the thread wait, you did the same thing as Laura Pecoraro and she received a 0/80 (and I agree with you: that would indeed be the score to expect, not a weird 7/80).

If you take a look here you'll see a breakdown of the "general considerations" score section (of the old assignment, but I think it is still valid for the new assignment). So it is completely normal to have full credits here and have a fail on the locking section. So I don't agree with you on this one.

About the service of Sun I certainly can't complain: I received my grade after exactly 4 weeks, when I sent an email to the who2contact-address I always received an answer in 1 or 2 business days,... But of course I have read many stories about other ranchers being not that fortunate and having a lot of problems to get their grade or get any response of Sun. It's a very weird situation and there is a lot of room for improvement, because each one of us pays a lot of euros/dollars/... and deserves the same treatment and service.
So I certainly wouldn't buy a new resubmission voucher, but first try to get some feedback (explanation) in more detail why you were failed again. Because if you don't know what's wrong it is impossible to correct your code. Maybe you can also contact the sun educational services of your country (where you normally would buy the voucher for your certifications) and explain the whole situation and express your dissatisfaction about the way you are treated.

I hope it is sorted out very quickly and you'll become a SCJD without having to resubmit your assignment again.
Good luck!
Kind regards,
Roel
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to belabor the point, but I am not sure from what you have written whether the interface's contract is met. For example, can I run the following code against your data class?



When I run this on my computer with my singleton instance of the Data class, I see that I get locks and releases in the correct order, and that the overall time taken is 10 seconds:


Can you do the same thing, or does the code need to be modified to work with your solution?

If the code needs to be modified, then I believe you are not meeting the contract required by the interface.
 
Nicolas Kal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew,

As I told earlier yes it is working. I have spoken with a representative of local Sun branch and he told me that he will try to find out what happened and why I have failed. Furthermore I asked for him ig it is logical that the previus time I had 7/80 (without working) and now I got 0/80 with locking working..Anyway I can't consume time and efort thinking on this anymore. If they had the dignity they should provide more detailed feedback if there is something that I did wrong. The feedback I got was exactly the same as the previus. I have lost points in locking and gui, of course there is no feedback on the gui, why i lost 16 points. and again the first time there were not any feedback on the gui.

Regards,
Nikolas
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have lost points in locking and gui, of course there is no feedback on the gui, why i lost 16 points.

Nobody gets feedback why you lost some points on a certain section. And of course that's a pity, because you never know what you did wrong and you can't learn from your mistakes. But on the other hand I understand: they simply want to prevent endless discussions between developer and accessor about the grade.
But I agree with you that when you fail you should get an extensive description about the reason you got failed.

Kind regards,
Roel
 
patrick kunert
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One question,

to me it appears, that your Data singelton acts as a central lock. So as blocking concurrent acces to one entry would work, what about client B trying to access hotel-2 (though accessing a different entity), as Client A has acuired a lock for hotel-1. To me it seems, you provided rather a table-locking mechanism than an entity locking mechanism...


correct me if i' m wrong

 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see that you're blocking everything? Then it's not concurrent since only one thread can access the file?
Every test you run will pass... But there are no concurrent access to your file. (since your data-class is singleton and every thread uses the
same class).

Can you try (towards given interface, this should succeed):

1. Data.lock(1)
2. Data.lock(2)
3. Data.update(1)
4. Data.update(2)
5. Data.unlock(1)
6. Data.unlock(2)


(somebody correct me if I'm wrong concerning this case?)

Edit: Patrick: I agree with you.
 
Allan Cheong
Ranch Hand
Posts: 71
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jari Timonen wrote:I see that you're blocking everything? Then it's not concurrent since only one thread can access the file?
Every test you run will pass... But there are no concurrent access to your file. (since your data-class is singleton and every thread uses the
same class).

Can you try (towards given interface, this should succeed):

1. Data.lock(1)
2. Data.lock(2)
3. Data.update(1)
4. Data.update(2)
5. Data.unlock(1)
6. Data.unlock(2)


(somebody correct me if I'm wrong concerning this case?)

Edit: Patrick: I agree with you.


I would also like to know the answer above. Is the following scenario successful?



At any given moment, the Map that stores the record number as key and cookie/client id as value might have more than one key value pairs. Please advice.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nicolas,

It's almost 1 month ago? Any progress on your certification process? Do you already know the reason why you got failed the 2nd time?

Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic