Archive for 2006/11
-
Sometimes Things Don't Work for You
-- Nov. 30, 2006, 10:56 a.m.
After a conversation with a co-worker yesterday about some code that I'd written, I have figured out a need for some new design patterns. You will occasionally find a piece of code that looks something like what you want, but it doesn't fit your needs exactly. This is a quick guide to help you when you run into such a ...
-
Dear Eclipse: Please Stop Telling People Synthetic Method Access is Bad
-- Nov. 29, 2006, 11:20 a.m.
I was going through my eclipse compiler settings and decided to turn on this synthetic access warning thing again. I mean, it makes sense that accessing a private method in another class might be slow, but I want to measure how slow. In my quest for understanding the actual impact of this, I figured I'd test to see how much ...
-
Layering
-- Nov. 21, 2006, 10:07 a.m.
People have trouble working in layers. I don't get it. Please see the block diagram to the right for a summary of this post. There have been several times people have asked me questions starting with the lowest layer possible and working their way up to their actual question. Meanwhile, I've spent at least a half an hour trying to ...
-
Double-Checked Locking Yet Again
-- Nov. 13, 2006, 4:07 p.m.
Since I'm pretty much the only reader of this site, I can say with authority that my readers are getting annoyed by all this talk of singletons and double-checked locking. But alas, there's more. For a quick catch-up, see my recent post on lock-free singletons. Today, someone pointed out to me that J2SE 5.0's volatile keyword makes a variant of ...
-
Cheap and Effective Object Pooling with BlockingQueue
-- Nov. 10, 2006, 10:20 a.m.
Last night I was brushing my teeth when suddenly the thought occurred to me: BlockingQueue is pretty much exactly what you want in a simple object pool. This seemed like a good thing to investigate. The basic concept is to populate a BlockingQueue implementation with your object, and then have code that wants to access it pull it from the ...
-
Internal Representation of Dates
-- Nov. 9, 2006, 12:54 p.m.
I was planning to have a bunch of timestamped objects implementing an interface that returns a java.util.Date object and was wondering what the storage overhead of a java.util.Date was vs. a long. Keep in mind, that by using a long, I'd need to construct a java.util.Date each time the method was called that wanted one, and I didn't want to ...