Category Archives: J2EE

Jakarta HTTPClient

I’m going through the Jakarta HTTPClient package (used in LARM to retrieve web pages) and I don’t understand what function the HostConfiguration class performs.

a) It looks like it’s just a wrapper for a URI that adds proxy server information (so that when the HttpConnection class calls a URI, the HostConfiguration class adds the proxy information to the request). That seem right?

b) What’s up with the developer not providing a lick of documentation for HostConfiguration? Normal? Oversight? Unnecessary? 🙂

Using the volatile keyword in Java

Using the volatile keyword in Java.

The volatile modifier is used when you are working with multiple threads.

The Java language allows threads that access shared variables to keep private working copies of the variables; this allows a more efficient implementation of multiple threads. These working copies need be reconciled with the master copies in the shared main memory only at prescribed synchronization points, namely when objects are locked or unlocked. As a rule, to ensure that shared variables are consistently and reliably updated, a thread should ensure that it has exclusive use of such variables by obtaining a lock that, conventionally, enforces mutual exclusion for those shared variables.

Who Needs Resolutions

From Java Developer’s Journal: “Who Needs Resolutions“:

1. Read Thinking in Java cover-to-cover.
Now in its third edition, Thinking in Java by Bruce Eckel (Prentice Hall) continues to fill my head with all things new. It’s a good reminder of how Java programs should be constructed and how programmers should approach programming problems in general. It touches on design patterns and how they’re used and also things like integrating Ant and JUnit.

Anyone read that book? Good?

Using the Decorator Pattern

Using the Decorator Pattern: “The main difference between subclassing and the Decorator pattern is this: with subclassing, you work with the class, whereas in the Decorator pattern, you modify objects dynamically. When you extend a class, the change you make to the child class will affect all instances of the child class. With the Decorator pattern, however, you apply changes to each individual object you want to change.” [onjava]

One of the comments at the end of the article mentions that the Decorator pattern is always illustrated using UI components (and, in fact, the first couple pages of Design Patterns uses only UI type examples, Design Patterns also mentions using the Decorator pattern with streams). What other uses can the Decorator pattern be put to? Better, in what ways have you used the Decorator pattern?

update on JCACHE

update on JCACHE from Cameron Purdy: “JCache. jCache. JCACHE. Who knows. It’s Technically known as JSR 107 and it’s been stuck in the doldrums until recently due to Oracle licensing issues. I am on the expert commitee. One thing that I really dislike about the JCP is its total lack of transparency. The work all goes on behind an iron curtain. Take this JSR for example. It’s been in process for a year and a half, but no one outside the JSR knows what state it is in. The specs inside the JSR don’t match the ones published with the original JSR at all. The specs implemented by various future JCACHE vendors don’t match either the originally published API or the current thinking for the JSR. There’s no status updates, no accountability. If a vendor wanted to implement the spec, they’d have to wait for the public review period at the earliest, and would be far behind Tangosol, Oracle, SpiritSoft, etc. by that point. The JCP should not be the means to a market advantage for a company; it should the means for the market advantage of Java.”

Bummer…