public void someMethod()  {
	Foo myFoo = myFooRef.get();
	If (myFoo == null)
		.....recreate myFoo, skip it, do whatever is right...
	else {
	UsefulData data = myFoo.getUsefulData();
		...
		MyFoo.doSomethingElseUseful();
	...
}
return;
}

Example 2: Caching the data object Foo, which is held via a SoftReference.

Back to Article