[
https://issues.apache.org/jira/browse/HBASE-5388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206572#comment-13206572
]
ronghai.ma commented on HBASE-5388:
-----------------------------------
rename the method SoftValueSortedMap#getLower to
SoftValueSortedMap#getLowerValueByKey
{code}
public synchronized V getLowerValueByKey(K key) {
checkReferences();
if(!(this.internalMap instanceof java.util.NavigableMap)){
SortedMap<K,SoftValue<K,V>> sortedMap = this.internalMap.headMap(key);
if(sortedMap==null){
return null;
}
SoftValue<K,V> value = sortedMap.get(sortedMap.lastKey());
if(value==null){
return null;
}
if (value.get() == null) {
this.internalMap.remove(key);
return null;
}
return value.get();
}
Map.Entry<K,SoftValue<K,V>> entry = ((TreeMap<K,
SoftValue<K,V>>)this.internalMap).lowerEntry(key);
if(entry==null){
return null;
}
SoftValue<K,V> value=entry.getValue();
if(value==null){
return null;
}
if (value.get() == null) {
this.internalMap.remove(key);
return null;
}
return value.get();
}
{code}
> Tuning HConnectionManager#getCachedLocation method
> --------------------------------------------------
>
> Key: HBASE-5388
> URL: https://issues.apache.org/jira/browse/HBASE-5388
> Project: HBase
> Issue Type: Improvement
> Affects Versions: 0.90.5
> Reporter: ronghai.ma
> Assignee: ronghai.ma
> Labels: patch
> Fix For: 0.94.0
>
> Attachments: HConnectionManager.java, SoftValueSortedMap.java
>
>
> About 75% improvement in execution time.
> 1. Add the following method in SoftValueSortedMap:
> {code}
> public synchronized <K, V> Entry<K, V> lowerEntry(K key) {
> return ((TreeMap) this.internalMap).lowerEntry(key);
> }
> {code}
> 2. Modify getCachedLocation:
> {code}
> Map.Entry<byte[], HRegionLocation> tEntry = tableLocations.lowerEntry(row);
> if (tEntry != null) {
> HRegionLocation possibleRegion = tEntry.getValue();
> //other code
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira