提交 bba66ba7 authored 作者: Thomas Mueller's avatar Thomas Mueller

Javadocs

上级 fd988701
......@@ -113,6 +113,11 @@ public class TestConcurrentUpdate extends TestBase {
conn.close();
}
/**
* Handle or ignore the exception.
*
* @param e the exception
*/
void handleException(SQLException e) throws SQLException {
switch (e.getErrorCode()) {
case ErrorCode.CONCURRENT_UPDATE_1:
......
......@@ -49,7 +49,13 @@ public class ShardedMap<K, V> extends AbstractMap<K, V>
shards = new Shard[0];
}
public static long getSize(Map<?, ?> map) {
/**
* Get the size of the map.
*
* @param map the map
* @return the size
*/
static long getSize(Map<?, ?> map) {
if (map instanceof LargeMap) {
return ((LargeMap) map).sizeAsLong();
}
......@@ -97,6 +103,11 @@ public class ShardedMap<K, V> extends AbstractMap<K, V>
return size > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) size;
}
/**
* The size of the map.
*
* @return the size
*/
public long sizeAsLong() {
Shard<K, V>[] copy = shards;
for (Shard<K, V> s : copy) {
......@@ -287,6 +298,12 @@ public class ShardedMap<K, V> extends AbstractMap<K, V>
* A large map.
*/
public interface LargeMap {
/**
* The size of the map.
*
* @return the size
*/
long sizeAsLong();
}
......@@ -295,7 +312,26 @@ public class ShardedMap<K, V> extends AbstractMap<K, V>
* given index.
*/
public interface CountedMap<K, V> {
/**
* Get the key at the given index.
*
* @param index the index
* @return the key
*/
K getKey(long index);
/**
* Get the index of the given key in the map.
* <p>
* If the key was found, the returned value is the index in the key
* array. If not found, the returned value is negative, where -1 means
* the provided key is smaller than any keys. See also
* Arrays.binarySearch.
*
* @param key the key
* @return the index
*/
long getKeyIndex(K key);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论