public class FastFutureStore extends Object
ConcurrentHashMap in certain circumstance.
When the underlying array runs out of space, FastFutureStore will downgrade to #ConcurrentHashMap
Created by wanghongfei on 2018/11/19.
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
FastFutureStore.StoreWalker |
| 构造器和说明 |
|---|
FastFutureStore(int cap) |
| 限定符和类型 | 方法和说明 |
|---|---|
RpcFuture |
get(long id)
Retrieve object identified by id
|
RpcFuture |
getAndRemove(long id)
Retrieve and remove object identified by id
|
static FastFutureStore |
getInstance(int cap)
Obtain singleton object
|
long |
put(RpcFuture fut)
Add an object.
|
int |
size()
Return the count of the objects.
|
void |
traverse(FastFutureStore.StoreWalker walker)
Traverse and invoke #
FastFutureStore.StoreWalker on every element. |
public static FastFutureStore getInstance(int cap)
cap - Capacity of the internal arraypublic long put(RpcFuture fut)
public RpcFuture get(long id)
id - Identifier returned by #put(RpcFuture)public RpcFuture getAndRemove(long id)
id - Identifier returned by #put(RpcFuture)public int size()
public void traverse(FastFutureStore.StoreWalker walker)
FastFutureStore.StoreWalker on every element.walker - Define the action needed to be performed for elementsCopyright © 2019 Baidu, Inc.. All rights reserved.