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

Matthew Comer

Ranch Hand
+ Follow
since Aug 10, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matthew Comer

It should be noted that any of the described behaviors could be implemented as a new plugin. Perhaps you should implement it and turn it over to the Eclipse community?
Maybe his name really is Clint Eastwood? It's possible (grin).
Yes, I had a LockManager.
First, I had a business facade layer that the client communicated with, never directly to the db. This facade ran client-side when in remote mode. The facade layer used a Connection object to talk to the db - either a LocalConnection or a RemoteConnection. The "identity" of these Connection objects is what I used for locking, i.e. this is what I used for my client id.
Because I had locking in both local and remote mode, my Data class owned an instance of LockManager and delegated locking calls to it. Therefore, each Data (table) instance has it's own LockManager, which is as it should be.
The trick then becomes "how do I tell Data WHO is doing the lock, when the method signature for lock() and unlock() don't specify any such parameter?" You could add a Connection parameter to lock() and unlock(), but since I also decided to ENFORCE locking for create/delete/update record calls this means I would have needed to pass the connection id to these as well... Awkward. Instead, I "registered" the fact that a given thread was working on behalf of a given connection using a ThreadLocal-like mechanism (this was before ThreadLocal became well implemented as in 1.4. Today I would use ThreadLocal directly). NOTE - this does NOT imply that I assumed that RMI would use the same thread to service the same remote object every time. It won't! This registration of the Thread<->Connection relationship occured for each call, and was unregistered at the end of the call. This meant that any code anywhere in Data or it's helper class could always determine which connection was being serviced.
How did you get the jar file to the Linux box? Did you FTP it? If so, did you remember to issue "type binary" before you transferred the file?
It sounds like the jar file is corrupted.
The GRASP patterns say something about this - your are looking for HIGH cohesiveness and LOOSE coupling. So, the functions provided by a class should be HIGHLY COHESIVE, i.e. related to a single purpose or objective and LOOSELY COUPLED to other classes.
So, the question is this: What does the parsing of query criteria have to do with the maintenance of a flat file database? Well, not much. To build both of these behaviors into a single class would NOT lead to high cohesion within the class.
It is important to note though that putting this behavior in a seperate class should be done in such a way as to keep COUPLING LOW, i.e. don't design CriteriaBuilder in such a way that it is highly dependant on the internal implementation or data structures of the Data class.
I wish I had a bot that could auto-respond to any new threads on locking that showed up... This is such a common topic here.
There is a TON of misunderstanding on this forum about the requirements for locking in the assignment. Many of the experts here, including the forum moderators (who do a good job BTW) have stong opinions about "right" approach and sell their opinions as "correct" as it relates to the requirements.
Let me say this: I scored 153/155 and I DID IMPLEMENT LOCKING IN LOCAL MODE! The only two points I lost were on my database converter, which was a required item in earlier versions of the assignment (not any more though). The decision on local mode locking is a design choice. It boils down to this: Do you want a local client to be able to hold multiple connections to the db? Do you want these connections to cooperate like remote connections would? Do you want the db to be able to operate in "hybrid" mode, i.e. serving a local client as well as remote clients? (Yes, this is beyond the scope of the requirements, but mine could do it.)
Unless the person who graded my submission was wrong, I do not believe that implementing locking in local mode will cause you to lose any points. I believe that the correctness of your locking solution and your adherance to your design decisions about locking are what count. (This is my experience - caveat emptor).
BTW, I would be happy to provide my completed assignment to anyone on the forum (who I can tell from prior posts or who can otherwise prove to me that they are already SCJD2) as well as my score report to show that I am not making this up.
p.s. I want to say again that I think the forum experts provide endless amounts of good advice and help to those that need it. They are great. But I believe they are incorrect on this one.

Originally posted by Glenn Opdycke-Hansen:

I have a question (or 2):
Is there a WSAD cert to replace the VA cert? Why not take that cert and be safe?

Yes, there is a WSAD cert. Take a look at test 157. I passed it recently.
BTW, I scored 153/133 and I did implement locking in local mode. The only two points they took off were for my db converter, which was a requirement in an older version of the assignment. So, by example, I would say that implementing locking in local mode will NOT necessarily decrease your score.
I did document my reasons for this decision in my design choices doc...
Oh, and I did delegate the actual locking work to a LockManager class.
[ June 10, 2002: Message edited by: Matthew Comer ]
1) Set them up as a Java project. Then use the "make zip" plugin to have the compiled classes moved into a jar file in the EAR whenever the project is rebuilt. (You can put a Java project on the build path of your web project, but this does not address the need for the classes to be on the runtime classpath for the server. Making a jar and adding it to the EAR does this.) (ALSO - you'll need to reference the jar from the manifest file of your WAR - the "add module dependencies" wizard does this for you.)
2) Jar them and put them in the lib folder of your WAR. You can associate a "source jar" with the jar in WSAD so that you can debug. (Don't remember the exact steps - would need to look it up.)
Which is better? Depends. If the classes will be used by other projects, including any new web projects or an ejb project, use #1. If the classes are simply support files for the single web project, use #2.
p.s. If I hadn't just passed 157 I probably wouldn't be remembering any of this (grin).
[ May 21, 2002: Message edited by: Matthew Comer ]
19 years ago
Three ways to fix your problem:
1) Add the extra jars to the classpath on the command line
2) Put the extra jars on your classpath using the environment variable
3) *RECOMMENDED* Put an entry in the manifest file of the main jars that references the extra jars
Yes, Peter has it right. These threads are NOT interchangeable, as each one could be waiting on a DIFFERENT lock.
However, you could design a lock manager that used seperate semaphores for each lock. This would allow you to wake up only the threads that were waiting for the lock that was being released. This might be more effecient because it would prevent irrelevant threads from being activated only to put themselves back to sleep. However this would be more complicated, and would require more object creation and more memory use. Wonder if anyone has implemented such a lock manager for the developer assignment?
First, instead of 488 you should look at 158. IBM is withdrawing 488 (I believe at the end of June, from the top of my head).
Second, I was able to prep for 488 (and these same resources should work for 158) by using:
(Available from
1) The EJB 1.1 Spec
2) The JSP 1.1 Spec
3) The J2EE 1.2 Spec
(Available from
4) The WAS 4.0 Handbook
5) The WAS 4.0 Developer's Guide
Take a look at and examine the recommended educational resources. Also take the practice test.
I basically blew off the VAJ portions of 488 since I knew I would be taking 157/158 in the future. I was able to pass 488 just fine without worrying about VAJ.
Two notes:
1) I passed 157 last week. The product help was more "helpfull" than the Redbooks, though reading the Redbooks through at least once was a good idea. I'm working on a writeup of 157 study materials/strategies for my company right now - maybe I'll post it here as well.
2) I passed 488 a few months ago, and from everything I see and hear 158 is almost the same test. 488 was a bit tough given the amount of material to cover. I went in basically knowing the J2EE stuff down cold but knowing little about VAJ. I did fine - the generic stuff is the bulk of the test. (My ignorance of the VAJ stuff was evident on the score report though!)
Maybe a dumb question, but is the data you are attempting to save in the session serializable? If you are using a complex object graph to represent the shopping cart contents, then you need to be sure that the whole thing is serializable, otherwise it won't/can't be persisted.
19 years ago
I just passed 157, and my score report says JCert on it...