Class Cache.OriginThreadAwareFuture
- java.lang.Object
-
- org.glassfish.hk2.utilities.cache.Cache.OriginThreadAwareFuture
-
- All Implemented Interfaces:
java.util.concurrent.Future<V>
private class Cache.OriginThreadAwareFuture extends java.lang.Object implements java.util.concurrent.Future<V>
Helper class, that remembers the future task origin thread, so that cycles could be detected. If any thread starts computation for given key and the same thread requests the computed value before the computation stops, a cycle is detected and registered cycle handler is called.
-
-
Constructor Summary
Constructors Constructor Description OriginThreadAwareFuture(Cache<K,V> cache, K key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancel(boolean mayInterruptIfRunning)
boolean
equals(java.lang.Object obj)
V
get()
V
get(long timeout, java.util.concurrent.TimeUnit unit)
int
hashCode()
boolean
isCancelled()
boolean
isDone()
void
run()
-
-
-
Field Detail
-
threadId
private volatile long threadId
-
future
private final java.util.concurrent.FutureTask<V> future
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interfacejava.util.concurrent.Future<V>
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfacejava.util.concurrent.Future<V>
-
isDone
public boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<V>
-
get
public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
get
public V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
-
run
public void run()
-
-