我发现很多java线程的状态是 java.lang.Thread.State:WAITING(停车), jsatck指令是加载guava缓存。
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000007c0e65bb8> (a com.google.common.util.concurrent.SettableFuture)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:445)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:143)
at com.google.common.cache.LocalCache$LoadingValueReference.waitForValue(LocalCache.java:3573)
at com.google.common.cache.LocalCache$Segment.waitForLoadingValue(LocalCache.java:2306)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3953)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3957)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4875)
guava cache config
CacheLoader<K, CacheValue<V>> loader = new CacheLoader<K, CacheValue<V>>() {
@Override
public CacheValue<V> load(final K key) throws Exception {
try {
return new CacheValue<V>(loadFromRemoting(key));
} catch (Exception ex) {
LogUtil.warn(LOGGER, ex)
throw ex;
}
}
@Override
public ListenableFuture<CacheValue<V>> reload(final K key, final CacheValue<V> oldValue)
throws Exception {
// asynchronous refresh cache.
ListenableFutureTask<CacheValue<V>> task = ListenableFutureTask
.create(new Callable<CacheValue<V>>() {
@Override
public CacheValue<V> call() {
try
return load(key);
} catch (Exception e) {
LogUtil.error(LOGGER, e)
}
return oldValue;
}
});
refreshExecutor.submit(task);
return task;
}
};
loadingCache = CacheBuilder.newBuilder().maximumSize(20000)
.refreshAfterWrite(getDuration(), TimeUnit.MINUTES).build(loader);
** jdk版本6
和番石榴版19.0 **
任何关于gauva缓存设计的文档或代码中的错误。