java.lang.Object | |
↳ | com.atlassian.jira.util.cache.WeakInterner<T> |
Similar to a Guava WeakInterner
, but significantly lighter weight.
The Guava implementation of a weak interner has considerable overhead because it is implemented in terms of
the CustomConcurrentHashMap
grab bag of functionality with all its accompanying statistical tracking,
eviction policy, and so on. This implementation is based directly on the lighter ConcurrentHashMap
implementation that comes with the JDK.
Note: This assumes that your interned objects are sane for interning purposes, meaning that they are
immutable objects with stable hash codes that are consistent with equals and have a reasonably efficient
implementation for equals
. Violate these assumptions at your own risk.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Requests an explicit clean-up pass.
| |||||||||||
Weakly interns the specified non-null value.
| |||||||||||
Weakly interns the specified value, with
null values tolerated. | |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object |
Requests an explicit clean-up pass.
The clean-up is invoked implicitly on every call to intern(Object)
or internOrNull(Object)
(provided the argument is not in fact null
), so it should not normally be necessary to call this
method explicitly.
Weakly interns the specified non-null value.
Implicitly calls cleanUp()
.
value | the value to intern; must not be null |
---|
value
, or
value
itself if there is no previously interned instance available.IllegalArgumentException | if value is null
|
---|
Weakly interns the specified value, with null
values tolerated.
Implicitly calls cleanUp()
unless value
is null
.
value | the value to intern; may be null |
---|
value
or another instance of that object which was previously interned and is
semantically equal to value