Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

mitchner green

+ Follow
since Sep 18, 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 mitchner green

I have the book. While I haven't read it all yet, I have a few comments.
First off, I think it will be very valuable at helping to narrow the scope of what one should study. Looking at different lists of study materials, a person could easily end up with 5 or 6 large books, plus tons of web sites. The book narrows things down a bit. For instance, the GOF design pattern book is hundreds of pages; this book has a concise 40 pages on patterns.
This book makes it clear that it alone is not enough to pass the exam. You will need to read and study other stuff also.
A coworker of mine who has passed SCEA said the "Case Study" section would be helpful so you know what level of detail is appropriate for some of the diagrams.
My last comment is that I expected this book to be huge with a tiny font. It is pretty light with a large font. Again, it's more of a guide book than a single book that tells you everything, as the SCJP books do.
I am so glad you asked this question!!!
I am using BEA Weblogic and my taglib was not working either. I spent most of this morning trying to get it to work, and eventually pushed it aside.
After seeing this, I put it in a package and voila: it worked.
So apparently both tomcat and WebLogic have issues if a taglib is not in a package. My servlets in the same web app. are not packaged and they work fine.
If the team has some creative/HTML type people, obviously they will only do JSP's, which works out well because the developers probably don't want to do them anyway.
As for Servlets/EJB's, I've never seen a project divided along those lines. The normal team structure (as I've seen it) has a team handling a set of business requirements and using Servlets, EJB's, and/or whatever else is needed to meet the requirements.
I just have two things to add. If you use reDirect() (since you are involving the browser) the address in the browser changes, and hence the user can refresh that page properly.
If you forward, it may be quicker since you save a round-trip, but if the user hits refresh, he will move backwards to the page still in the address bar.
Also, objects in request scope are lost on a redirect, but remain in scope after a forward.
[This message has been edited by mitchner green (edited October 24, 2001).]
I can't say what is "required" as I don't think Sun ever directly addresses this point.
I developed my app on Windows 2000 and stated in my doc. that I did not have access to a UNIX box and didn't test on UNIX. I coded my app. to avoid specifying file paths. I also never stated the encoding to be used when changing the deprecated methods. I hoped this would avoid cross-platform issues.
As it turns out, at the last moment I DID get access to a UNIX (Solaris on Intel) box and everything worked. The GUI didn't look as nice, but it was readable and worked fine.
In case you're not familiar with classpaths, try:
set CLASSPATH=%CLASSPATH%;<Your directory>
That should do it.
18 years ago
Are you saying the code you gave actually compiles? I got a slew of compiler errors when I tried it.
18 years ago
A good resource for this is "Effective Java" by Joshua Bloch. He has a chapter describing exactly how you get a memory leak in Java when building a simple stack. It's interesting.
In general, I don't think it's a good idea to set object references to null, except in special situations (like the stack implementation above, or maybe if the object is huge). The best way to not hog memory is to always keep your variable scope as small as possible.
Before I'd clutter my code with a bunch of object=null, I'd need a really good reason to do so.
18 years ago
Actually, the way I have it coded as soon as the global lock is *requested*, I quit granting any more locks. When the existing locks go away, I grant the global lock. This way I'll never wait and wait for the global lock.
The way I figured it, if a global lock is requested, that gets priority over clients requesting "normal" locks.
I wouldn't if I were you. That's out of scope in a huge way. Part of the assignment is figuring out the Data class, not replacing it.
Why does find() need to be synchronized? Here is my take.
First off, let me state I struggled with synchronization in the Data class quite a bit at the start and I wasn't clear on what to synchronize and what not to. There is lots of discussion about it but people don't seem to agree. The thing that cleared it up for me was reading "Effective Java" (Joshua Bloch). In there he states you should *always* synchronize access to shared, mutable data. He gives a very clear explanation why this is so. I won't go into the details. So that is my rule: If I'm reading or writing shared, mutable data I synchronize it.
Let's apply this to the find() method. Notice that method uses the recordCount field in a for loop. What would happen if the recordCount was changed after your loop did the comparison to recordCount, but before it processed that record? It would be ugly--you might return data that had been deleted, or read data that hadn't been fully written.
In the book, he goes on to explain that overly clever people try to increase concurrency by not synchronizing atomic operations. This is dangerous and wrong.
Finally he states that developers that fail to synchronize properly often have the program work fine in testing. Picture the situation I described above in the find method. It is unlikely to happen--even if you do tons of testing. When it does happen, you might not blow up in the find() method, you'll probably crash elsewhere, which will make the problem nearly impossible to debug. Also, recreating the error will be almost impossible. A true debugging nightmare.
I'm sure I haven't explained this as well as he did, but hopefully that made sense.
The book again is "Effective Java" by Bloch. Great book.
My lock method doesn't work that way. I don't grant a global lock until all the other locks have expired, or been unlocked. The way you described it, records 1, 2 and -1 could all have locks at the same time. I think that is bad. Why not wait for locks 1 and 2 to be unlocked before granting the -1 lock?
No, I'm not using any extra threads for this purpose.
At first I considered loading them from the datasource, but since the GUI starts with all the flights anyway, I had no need to make the extra server call. In the GUI constructor, I use the data that is in the table and get the unique values from that. That way there is no additional load placed on the server.
To address the original question "When is lock all records used"? I used it when shutting down my server.
If you do a ctrl-c shutdown, clients could have outstanding locks while the server shuts down.
At server start-up (or local mode startup) the filename ("db.db") is one of the arguments. Actually, I think my design will support one server using db.db on one port while another server uses another filename on another port.
I say "I think" that is supported because I haven't tested that scenario. Maybe I'll give it a try and see what happens...
My server arguments are: database file name, host name, port #. "default" can be entered for host and port to use and 1099. If only one argument is provided, the server and client both start in that VM.
On the client the arguments are host and port only. Again, "default" can be entered to connect to