Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Moreover, Java programming isn't just about writing applets and applications for deployment on personal computers and workstations; Java has made strong inroads into the embedded systems market as well. Current embedded systems have relatively scarce memory resources and computing power, so many of the old issues facing programmers have resurfaced for Java developers working in the device realm.
Balancing these factors is a fascinating design problem: It's important to accept the fact that no solution in the area of embedded design will be perfect. So, we need to understand the types of techniques that are going to be useful in achieving the fine balance required to work within the constraints of the deployment platform.
One of the memory conservation techniques Java programmers find useful is lazy instantiation. With lazy instantiation, a program refrains from creating certain resources until the resource is first needed -- freeing valuable memory space. In this tip, we examine lazy instantiation techniques in Java class loading and object creation, and the special considerations required for Singleton patterns. The material in this tip derives from the work in Chapter 9 of our book, Java in Practice: Design Styles & Idioms for Effective Java (see Resources).
If you're familiar with Netscape's Web browser and have used both versions 3.x and 4.x, undoubtedly you've noticed a difference in how the Java runtime is loaded. If you look at the splash screen when Netscape 3 starts up, you'll note that it loads various resources, including Java. However, when you start up Netscape 4.x, it doesn't load the Java runtime -- it waits until you visit a Web page that includes the <APPLET> tag. These two approaches illustrate the techniques of eager instantiation (load it in case it's needed) and lazy instantiation (wait until it's requested before you load it, as it may never be needed).
There are drawbacks to both approaches: On one hand, always loading a resource potentially wastes precious memory if the resource isn't used during that session; on the other hand, if it hasn't been loaded, you pay the price in terms of loading time when the resource is first required.
Lazy instantiation in Java falls into two categories:
Lazy class loading
The Java runtime has built-in lazy instantiation for classes. Classes load into memory only when they're first referenced. (They also may be loaded from a Web server via HTTP first.)