Here is my idea:
-ConnectionManager is Subject for GUIClient the Observer.
-Let say that every two minutes the ConnectionManager in the network mode will replace the Data with new instance in the GUIClient.
-Before the subject disconnects the data instance it will performs necessary check if client has something running on the remote object.
I was now reading the SCJD forum for a wail and didn�t found anything that would be similar to this solution.
I just want to check if some had implemented any kind of prevention of dropped connection.
I don�t mean solving the problem, I mean preventing it (just to be explicit). I guess read a lot about the problem solving like WeakHashMap or Unreferenced or daemons checking the Map for invalid connections.
Right now I�m in starvation for simplicity please help
Several candidates have proposed (and presumably implemented) timeouts in their locking code in the past. I have not heard of anyone failing for this.
I have also heard of several candidates passing with very high scores without having any code to handle orphaned clients.
No matter what you do, you have to be very clear in your own mind why you chose your particular option over the others, and make sure you document it clearly in your Design Choices document.
Having got all that out of the way ...
In my personal opinion, I don't think automatic timeouts are acceptable. The way I read the instructions, once I have been granted a lock, it is mine. Fullstop. There is nothing in the instructions that might indicate that the server could decide after 10 seconds to cancel a lock. And that being the case, how do you decide what the magic number for timeouts is? 10 seconds might be OK for a "booking" process where the entire booking happens without user interaction, but 5 minutes may be too short if the booking requires user interaction (lock record / confirm with client / update record / unlock). Since the instructions indicate that parts (if not all) of the application may be rewritten in the near future, you might have to make the timeout value configurable. This is getting more complex as we go along.
The alternatives you mentioned (using Unreferenced / using a WeakHashMap in combination with a background thread) only come into play when the connection is guaranteed to be lost. They are also not required according to the instructions, however in my opinion they lead to a more professional solution.
[ December 11, 2004: Message edited by: Andrew Monkhouse ]
They are also not required according to the instructions, however in my opinion they lead to a more professional solution.
I totally agree. But consider that the assignment by it self is not based on very real ground (for example cookies implementation).
I consider the well being of the examiner of my assignment more imported than professionalism (just one exception in the practice).
You can use any thing that I write as signature line.
Since this post looks like private conversation. I would like to know your opinion on this (I know it is entirely of the topic but this is just for evaluation):
Examiner (requirements are not the only grading factor).
The result of examination you receive is greatly influenced by:
-examiners professional experience
-examiners coding habits
-by the day of the week of the examination
-examiners seriousness in the matter of the certification
-examiners health condition
-examiners age (in relation to: need to know more)
�(that�s it for know)
The factor that I�m able to influence:
-complete the requirements and just the requirements (even the once between the lines, and they are very hard to see)
-write the code in the most standard way. (common mistake writing method with names like �compareToRecodrAtSecondColumn()�)
-make the code and listings in �fast to read� fashion (I�m planning to open a thread on this topic after I have study some more literature and code examples.)
-design in relevance to the assignment (like designing by interface is good OO practice but interfaces that are never used are jut more reading for the examiner)
What do you thing it is worth to open discussion on such ground. Or I would spread to concrete details. Do you thing that the best way for discovering opinions on the points above would be discus each in speared thread.
You are very experience in posting (with 3422 posts). So what ever you say I�m going to respect.
You might enjoy reading �Patent It your self� by David Pressman. Even if it has nothing to do with java it is perfect way to discover the examiner�s psyche in very funny way.
You can use any thing that I write as signature line.
Since this post looks like private conversation. I would like to know your opinion on this (I know it is entirely of the topic but this is just for evaluation): ....
There are some excellent topics in your message that could, and probably should, be discussed.
In recent years I have noticed that there are more books coming out regarding how to approach the examination / assessment process. This is something that, unfortunately, I was never taught at school. From talking to friends and family it seems that most people of my generation (at least) were not taught how to do tests / assignments. It was assumed that if you attended the classes & read the books & did the exercises then the tests and assignments would be simple. :roll:
Some of the questions I have seen raised in this forum seem to come from the same feeling of not knowing some of the "other factors" / "factors you can influence" you mentioned.
I would love to see you open some topics up to cover some of these items. Generally speaking, it appears that if a topic is too theoretical and covers more than one concept, it does not appear to get very many responses. So you might want to space out how often you open a new "theoretical" topic, and how encompasing you make it.
You might enjoy reading “Patent It your self” by David Pressman. Even if it has nothing to do with java it is perfect way to discover the examiner’s psyche in very funny way.
Thanks for the suggestion - I will look out for this.