A DESCRIPTION OF THE REQUEST :
For a more symetrical treatment of objects whose reference types need to be changed, it would be useful to have a StrongReference class to eliminate if statements to access such objects.
JUSTIFICATION :
Suppose I have a connection pool. Once a connection is captured from the pool, I change it's reference from strong to soft. As I iterate through the collection of connection in the pool, I need to keep testing for object type. If there was a StrongReference class, I could always treat the object as a Reference, and get its value through the get() method.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
StrongReference simply wraps an object so it can be treated as any other reference class.
ACTUAL -
No such class exists.
For a more symetrical treatment of objects whose reference types need to be changed, it would be useful to have a StrongReference class to eliminate if statements to access such objects.
JUSTIFICATION :
Suppose I have a connection pool. Once a connection is captured from the pool, I change it's reference from strong to soft. As I iterate through the collection of connection in the pool, I need to keep testing for object type. If there was a StrongReference class, I could always treat the object as a Reference, and get its value through the get() method.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
StrongReference simply wraps an object so it can be treated as any other reference class.
ACTUAL -
No such class exists.
- duplicates
-
JDK-4632244 (ref) Need for a StrongReference class for symmetry with WeakReference?
- Closed
- relates to
-
JDK-6177073 (ref) Addition of a new Reference-derived class to ease objects pooling
- Open
-
JDK-6493567 (ref) Add a java.lang.ref.ExclusiveStrongReference class
- Open