下面列出了java.util.concurrent.ConcurrentNavigableMap#get ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* get(null) of nonempty map throws NPE
*/
public void testGet_NullPointerException() {
try {
ConcurrentNavigableMap c = map5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* get(null) of empty map throws NPE
*/
public void testDescendingGet_NullPointerException() {
try {
ConcurrentNavigableMap c = dmap5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* get(null) of nonempty map throws NPE
*/
public void testGet_NullPointerException() {
try {
ConcurrentNavigableMap c = map5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* get(null) of nonempty map throws NPE
*/
public void testGet_NullPointerException() {
try {
ConcurrentNavigableMap c = map5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* get(null) of empty map throws NPE
*/
public void testDescendingGet_NullPointerException() {
try {
ConcurrentNavigableMap c = dmap5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* get(null) of nonempty map throws NPE
*/
public void testGet_NullPointerException() {
try {
ConcurrentNavigableMap c = map5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* get(null) of empty map throws NPE
*/
public void testDescendingGet_NullPointerException() {
try {
ConcurrentNavigableMap c = dmap5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
private void addPathPrefix(
ConcurrentNavigableMap<String, ConcurrentNavigableMap<String, Collection<Class<?>>>> map,
String suffix, String prefix, Class<?> role) {
ConcurrentNavigableMap<String, Collection<Class<?>>> m, o;
m = map.get(suffix);
if (m == null) {
m = new ConcurrentSkipListMap<String, Collection<Class<?>>>();
o = map.putIfAbsent(suffix, m);
if (o != null) {
m = o;
}
}
add(m, prefix, role);
}
private void addPath(
ConcurrentNavigableMap<String, ConcurrentMap<String, Collection<Class<?>>>> map,
String suffix, String prefix, Class<?> role) {
ConcurrentMap<String, Collection<Class<?>>> m, o;
m = map.get(suffix);
if (m == null) {
m = new ConcurrentHashMap<String, Collection<Class<?>>>();
o = map.putIfAbsent(suffix, m);
if (o != null) {
m = o;
}
}
add(m, prefix, role);
}
private static WaveletDeltaRecord getDelta(WaveletDeltaRecordReader reader,
ConcurrentNavigableMap<HashedVersion, WaveletDeltaRecord> cachedDeltas,
HashedVersion version) throws IOException {
WaveletDeltaRecord delta = null;
// try cache first!
if (cachedDeltas != null)
delta = cachedDeltas.get(version);
if (delta == null) delta = reader.getDelta(version.getVersion());
return delta;
}
/**
* get(null) of nonempty map throws NPE
*/
public void testGet_NullPointerException() {
try {
ConcurrentNavigableMap c = map5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* get(null) of empty map throws NPE
*/
public void testDescendingGet_NullPointerException() {
try {
ConcurrentNavigableMap c = dmap5();
c.get(null);
shouldThrow();
} catch (NullPointerException success) {}
}
/**
* Updates last flushed sequence Ids for the regions on server sn
* @param sn
* @param hsl
*/
private void updateLastFlushedSequenceIds(ServerName sn, ServerMetrics hsl) {
for (Entry<byte[], RegionMetrics> entry : hsl.getRegionMetrics().entrySet()) {
byte[] encodedRegionName = Bytes.toBytes(RegionInfo.encodeRegionName(entry.getKey()));
Long existingValue = flushedSequenceIdByRegion.get(encodedRegionName);
long l = entry.getValue().getCompletedSequenceId();
// Don't let smaller sequence ids override greater sequence ids.
if (LOG.isTraceEnabled()) {
LOG.trace(Bytes.toString(encodedRegionName) + ", existingValue=" + existingValue +
", completeSequenceId=" + l);
}
if (existingValue == null || (l != HConstants.NO_SEQNUM && l > existingValue)) {
flushedSequenceIdByRegion.put(encodedRegionName, l);
} else if (l != HConstants.NO_SEQNUM && l < existingValue) {
LOG.warn("RegionServer " + sn + " indicates a last flushed sequence id ("
+ l + ") that is less than the previous last flushed sequence id ("
+ existingValue + ") for region " + Bytes.toString(entry.getKey()) + " Ignoring.");
}
ConcurrentNavigableMap<byte[], Long> storeFlushedSequenceId =
computeIfAbsent(storeFlushedSequenceIdsByRegion, encodedRegionName,
() -> new ConcurrentSkipListMap<>(Bytes.BYTES_COMPARATOR));
for (Entry<byte[], Long> storeSeqId : entry.getValue().getStoreSequenceId().entrySet()) {
byte[] family = storeSeqId.getKey();
existingValue = storeFlushedSequenceId.get(family);
l = storeSeqId.getValue();
if (LOG.isTraceEnabled()) {
LOG.trace(Bytes.toString(encodedRegionName) + ", family=" + Bytes.toString(family) +
", existingValue=" + existingValue + ", completeSequenceId=" + l);
}
// Don't let smaller sequence ids override greater sequence ids.
if (existingValue == null || (l != HConstants.NO_SEQNUM && l > existingValue.longValue())) {
storeFlushedSequenceId.put(family, l);
}
}
}
}
private static WaveletDeltaRecord getDelta(WaveletDeltaRecordReader reader,
ConcurrentNavigableMap<HashedVersion, WaveletDeltaRecord> cachedDeltas,
HashedVersion version) throws IOException {
WaveletDeltaRecord delta = reader.getDelta(version.getVersion());
if (delta == null && cachedDeltas != null) {
delta = cachedDeltas.get(version);
}
return delta;
}
public SeaCloudsApplicationData getSeaCloudsApplicationDataById(String id) {
ConcurrentNavigableMap<String, SeaCloudsApplicationData> treeMap = dataStore.getTreeMap(SEACLOUDS_APPLICATION_DATA_COLLECTION_TAG);
SeaCloudsApplicationData seaCloudsApplicationData = treeMap.get(id);
return seaCloudsApplicationData;
}