com.atlassian.plugin.servlet.util
Class LazyLoadedReference<V>
java.lang.Object
java.lang.ref.Reference<T>
java.lang.ref.WeakReference<T>
com.atlassian.util.concurrent.LazyReference<V>
com.atlassian.plugin.servlet.util.LazyLoadedReference<V>
- All Implemented Interfaces:
- com.google.common.base.Supplier<V>
Deprecated. since 2.5.0 use LazyReference directly instead.
@Deprecated
public abstract class LazyLoadedReference<V>
- extends com.atlassian.util.concurrent.LazyReference<V>
Thread-safe lock-less (see note) reference that is not constructed until
required. This class is used to maintain a reference to an object that is
expensive to create and must be constructed once and once only. Therefore
this reference behaves as though the final keyword has been used
(you cannot reset it once it has been constructed).
When using this class you need to implement the LazyReference.create() method to
return the object this reference will hold.
For instance:
final LazyLoadedReference ref = new LazyLoadedReference()
{
protected Object create() throws Exception
{
// Do some useful object construction here
return new MyObject();
}
};
Then call to get a reference to the object:
MyObject myLazyLoadedObject = (MyObject) ref.get()
Note: Copied from JIRA
com.atlassian.jira.util.concurrent.ThreadsafeLazyLoadedReference and modified
to use generics and java.util.concurrent.
- Since:
- 2.1.0
| Nested classes/interfaces inherited from class com.atlassian.util.concurrent.LazyReference |
com.atlassian.util.concurrent.LazyReference.InitializationException |
| Methods inherited from class com.atlassian.util.concurrent.LazyReference |
cancel, create, get, getInterruptibly, isInitialized |
| Methods inherited from class java.lang.ref.Reference |
clear, enqueue, isEnqueued |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LazyLoadedReference
public LazyLoadedReference()
- Deprecated.
Copyright © 2012 Atlassian. All Rights Reserved.