本文整理了Java中java.util.concurrent.ConcurrentSkipListMap.put()
方法的一些代码示例,展示了ConcurrentSkipListMap.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListMap.put()
方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListMap
类名称:ConcurrentSkipListMap
方法名:put
[英]Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
[中]将指定的值与此映射中的指定键相关联。如果映射以前包含键的映射,则替换旧值。
代码示例来源:origin: Alluxio/alluxio
public void addChild(String name, Long id) {
if (mChildren != null && mChildren.put(name, id) == null) {
mWeight.incrementAndGet();
}
}
代码示例来源:origin: neo4j/neo4j
private static void addAllocatedPointer( long pointer, long sizeInBytes )
{
if ( CHECK_NATIVE_ACCESS )
{
allocations.put( pointer, new Allocation( pointer, sizeInBytes, freeCounter.get() ) );
}
}
代码示例来源:origin: apache/hbase
public void addToOfflineRegions(final RegionStateNode regionNode) {
LOG.info("Added to offline, CURRENTLY NEVER CLEARED!!! " + regionNode);
regionOffline.put(regionNode.getRegionInfo(), regionNode);
}
代码示例来源:origin: spotbugs/spotbugs
@NoWarning("NP_NONNULL_PARAM_VIOLATION,NP_NULL_PARAM_DEREF_NONVIRTUAL")
public static void main(String args[]) {
Comparator<Integer> comparator = (Comparator<Integer>) null;
ConcurrentSkipListMap<Integer, String> map = new ConcurrentSkipListMap<Integer, String>(comparator);
for (int i = 0; i < 16; i++)
map.put(i, Integer.toString(i));
System.out.println(map);
}
代码示例来源:origin: robovm/robovm
public V put(K key, V value) {
checkKeyBounds(key);
return m.put(key, value);
}
代码示例来源:origin: lealone/Lealone
@Override
public V put(K key, V value) {
map.setMaxKey(key); // 更新最大key
return (V) buffer.put(key, value);
}
代码示例来源:origin: lealone/Lealone
@Override
public V put(K key, V value) {
setMaxKey(key);
return skipListMap.put(key, value);
}
代码示例来源:origin: apache/incubator-druid
@Override
public RemoteTaskRunnerWorkItem put(String s, RemoteTaskRunnerWorkItem taskRunnerWorkItem)
{
return super.put(s, taskRunnerWorkItem.withQueueInsertionTime(DateTimes.nowUtc()));
}
}
代码示例来源:origin: qunarcorp/qmq
private LogSegment allocSegment(final long baseOffset) {
final File nextSegmentFile = new File(logDir, StoreUtils.offset2FileName(baseOffset));
try {
final LogSegment segment = new LogSegment(nextSegmentFile, fileSize);
segments.put(baseOffset, segment);
LOG.info("alloc new segment file {}", segment);
return segment;
} catch (IOException e) {
LOG.error("Failed create new segment file. file: {}", nextSegmentFile.getAbsolutePath());
}
return null;
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public V put(K k, V v) {
A.notNull(k, "k", v, "v");
V ret = super.put(k, v);
onPut();
return ret;
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
@Override
public void update(long value) {
if (count.incrementAndGet() % TRIM_THRESHOLD == 0) {
trim();
}
measurements.put(getTick(), value);
}
代码示例来源:origin: apache/storm
private V load(K key) {
V val = map.get(key);
if (val == null) {
val = cacheLoader.load(key);
if (val == null) {
throw new NullPointerException("Null value for key " + key);
}
ensureCapacity();
map.put(key, val);
++size;
}
return val;
}
代码示例来源:origin: qunarcorp/qmq
private void loadSnapshotFile(final File file) {
try {
final long version = parseSnapshotVersion(file.getName());
final byte[] data = Files.toByteArray(file);
final Snapshot<T> snapshot = new Snapshot<>(version, serde.fromBytes(data));
snapshots.put(version, snapshot);
LOG.info("load snapshot file {} success.", file.getAbsolutePath());
} catch (Exception e) {
LOG.error("load snapshot file {} failed.", file.getAbsolutePath(), e);
}
}
代码示例来源:origin: lealone/Lealone
@Override
public K append(V value) {
K key = (K) ValueLong.get(map.incrementAndGetMaxKeyAsLong());
buffer.put(key, value);
return key;
}
代码示例来源:origin: apache/geode
@Override
public void put(Object key, Object value) {
map.put(toDeserializable(key), toDeserializable(value));
}
代码示例来源:origin: apache/ignite
/**
* @param node New node.
*/
void addNode(ZookeeperClusterNode node) {
assert node.id() != null : node;
assert node.order() > 0 : node;
ZookeeperClusterNode old = nodesById.put(node.id(), node);
assert old == null : old;
old = nodesByOrder.put(node.order(), node);
assert old == null : old;
old = nodesByInternalId.put(node.internalId(), node);
assert old == null : old;
}
代码示例来源:origin: apache/hbase
@Before
public void setUp() {
m = new CopyOnWriteArrayMap<>();
csm = new ConcurrentSkipListMap<>();
for ( long i = 0 ; i < 10000; i++ ) {
long o = ThreadLocalRandom.current().nextLong(MAX_RAND);
m.put(i, o);
csm.put(i,o);
}
long o = ThreadLocalRandom.current().nextLong(MAX_RAND);
m.put(0L, o);
csm.put(0L,o);
}
代码示例来源:origin: apache/geode
@Override
public void put(Object indexKey, Object regionKey, Object value) {
map.put(new Pair(toDeserializable(indexKey), toDeserializable(regionKey)),
toDeserializable(value));
}
代码示例来源:origin: apache/incubator-druid
@Override
public void dropSegment(DataSegment segment, LoadPeonCallback callback)
{
synchronized (lock) {
if (stopped) {
log.warn(
"Server[%s] cannot drop segment[%s] because load queue peon is stopped.",
serverId,
segment.getId()
);
callback.execute();
return;
}
SegmentHolder holder = segmentsToDrop.get(segment);
if (holder == null) {
log.debug("Server[%s] to drop segment[%s] queued.", serverId, segment.getId());
segmentsToDrop.put(segment, new DropSegmentHolder(segment, callback));
processingExecutor.execute(this::doSegmentManagement);
} else {
holder.addCallback(callback);
}
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void loadSegment(DataSegment segment, LoadPeonCallback callback)
{
synchronized (lock) {
if (stopped) {
log.warn(
"Server[%s] cannot load segment[%s] because load queue peon is stopped.",
serverId,
segment.getId()
);
callback.execute();
return;
}
SegmentHolder holder = segmentsToLoad.get(segment);
if (holder == null) {
log.debug("Server[%s] to load segment[%s] queued.", serverId, segment.getId());
segmentsToLoad.put(segment, new LoadSegmentHolder(segment, callback));
processingExecutor.execute(this::doSegmentManagement);
} else {
holder.addCallback(callback);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!