Skip to main content

Between Us

Posted by editor on November 28, 2006 at 6:52 AM PST

When constructors need to be private

Sometimes when we get a not-so-stupid question, we need to expand the question as originally submitted, to give readers a little to chew on before they reach the discussion section. And that can be a little tricky when we already know the answer. It does require mentally placing one's self in the mind of someone who hasn't been programming in Java for a long time.

In other words, if I can forget the many times I've banged out a singleton pattern, I can take myself back to a place where the idea of a private constructor didn't make sense. To the new programmer, this can be a valid conundrum: if you would need to have an instance of some class to call a private method on that class, and would need to call a private constructor to create such an instance, it seems like a logical impossibility.

Many of you see the hole in this reasoning (I'll bet you've written a few singleton patterns in your time, yes?), because within just an hour of posting today's Feature Article, there were already four substantial talkbacks. And I'll bet there are more uses to be discussed other than just the singleton. So please have a look at
(Not So) Stupid Questions 15: How Can a Constructor Be Private? and see if you can add something to the discussion.

In Java Today,
the ossj-tck-foundation project has
graduated fom the incubator to a Java Enterprise project. The goal of the OSSJ TCK Foundation project is to ease creation of OSS/J TCKs by ensuring that the TCK builder can focus on building test cases and not having to worry about the 'plumbing' that is needed to bridge the 3 integration profiles (EJB, XML/JMS, Webservice) that are defined for all OSS/J APIs.

To celebrate the NetBeans 5.5 launch, NetBeans has put together the second edition of NetBeans Magazine, focusing on enterprise development. This edition of NetBeans Magazine covers a wide range of new features in NetBeans 5.5 and its main extensions, while also delving into core Java technologies. You can view this issue as a whole or as individual articles.

Java Puzzlers author Neal Gafter is back again with A Thread Pool Puzzler: "When I started using java.util.concurrent I was already somewhat comfortable with [its] concepts. But when I used it more intensely for production work in the Google Calendar server, I ran into a couple of 'gotcha' situations. I'd like to tell you about one in particular, in part because it might help you avoid the problem yourself, and in part because I believe this issue exposes some missing functionality in the concurrency framework."

Joshua Marinacci continues his code drops in today's Weblogs. In

Free Projects Part 2: the Stacked Image Editor, he writes:
"the Stacked Image Editor is a little program I wrote and posted on my blog a year and a half ago. It is used to draw a certain kind of diagram very easily. In this case, I had a need to show something composed of layers, with each layer broken out visually so you could see how they stacked."

In the new Mobile & Embedded community, Mark Lam presents
The BIG Picture: a Map of CVM:
"A view of the internals of the phoneME Advanced VM (CVM) in a nutshell..."

Finally, Jacob Hookom takes a swing at
Extending EL Syntax:
"Continuing on the EL testing, I started to extend the EL parser for the new EL-API within JSR 245 (JSP 2.1). I've added things like method invocation and simple projections."

Patrick Wright announces that SwingLabs website now has search! in today's Forums.
"We now have search enabled for SwingLabs-related topics on the SwingLabs website: This uses a new Google feature, Google Custom Search. The results come from Google, and are restricted (in this case) to a known set of websites, including the discussion forums, project sites, and blogs, among others. We can tune the CSE setttings over time to get more accurate results."

shannon clears up some concepts in
Re: Java EE appclients vs standalone clients:
"Apparently there's some confusion over application clients. [...] Application clients are simply standalone Java applications that execute in an environment that conveniently provides access to the Java EE facilities. It's the application client container that provides Java EE support to the application client program."

caclark theorizes about the hitch in running many apps in one JVM in the discussion
Re: Isolation API in JDK7?:
"There is a fundamental problem regarding the way that Java is specified, and that is that the stop () method of java.lang.Thread is deprecated, and therefore should not be used. Attempts to create a unified Java environment have come up with this problem. I guess U**x or l**x users will say 'what's the problem?' as they are used to Apache forking off processes like they are going out of fashion... but Java would really benefit from a one-process, multiple applications approach. So it requires a Java application monitor - and it also requires a 'master thread' approach."

In today's
News Headlines

Registered users can submit news items for the href=""> News Page using our
news submission
. All submissions go through an editorial review before being
posted to the site. You can also subscribe to the href=""> News RSS

Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

When constructors need to be private