CacheService: update to c3 compat

This commit is contained in:
Calle Wilund 2016-08-17 08:38:55 +00:00
parent 85e1b07544
commit 3a4adcb676
2 changed files with 28 additions and 218 deletions

View File

@ -70,11 +70,13 @@ public class CacheService implements CacheServiceMBean {
counterCache = new CacheMetrics("CounterCache", null);
}
@Override
public int getRowCacheSavePeriodInSeconds() {
log(" getRowCacheSavePeriodInSeconds()");
return c.getIntValue("cache_service/row_cache_save_period");
}
@Override
public void setRowCacheSavePeriodInSeconds(int rcspis) {
log(" setRowCacheSavePeriodInSeconds(int rcspis)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -82,11 +84,13 @@ public class CacheService implements CacheServiceMBean {
c.post("cache_service/row_cache_save_period", queryParams);
}
@Override
public int getKeyCacheSavePeriodInSeconds() {
log(" getKeyCacheSavePeriodInSeconds()");
return c.getIntValue("cache_service/key_cache_save_period");
}
@Override
public void setKeyCacheSavePeriodInSeconds(int kcspis) {
log(" setKeyCacheSavePeriodInSeconds(int kcspis)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -94,11 +98,13 @@ public class CacheService implements CacheServiceMBean {
c.post("cache_service/key_cache_save_period", queryParams);
}
@Override
public int getCounterCacheSavePeriodInSeconds() {
log(" getCounterCacheSavePeriodInSeconds()");
return c.getIntValue("cache_service/counter_cache_save_period");
}
@Override
public void setCounterCacheSavePeriodInSeconds(int ccspis) {
log(" setCounterCacheSavePeriodInSeconds(int ccspis)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -106,11 +112,13 @@ public class CacheService implements CacheServiceMBean {
c.post("cache_service/counter_cache_save_period", queryParams);
}
@Override
public int getRowCacheKeysToSave() {
log(" getRowCacheKeysToSave()");
return c.getIntValue("cache_service/row_cache_keys_to_save");
}
@Override
public void setRowCacheKeysToSave(int rckts) {
log(" setRowCacheKeysToSave(int rckts)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -118,11 +126,13 @@ public class CacheService implements CacheServiceMBean {
c.post("cache_service/row_cache_keys_to_save", queryParams);
}
@Override
public int getKeyCacheKeysToSave() {
log(" getKeyCacheKeysToSave()");
return c.getIntValue("cache_service/key_cache_keys_to_save");
}
@Override
public void setKeyCacheKeysToSave(int kckts) {
log(" setKeyCacheKeysToSave(int kckts)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -130,11 +140,13 @@ public class CacheService implements CacheServiceMBean {
c.post("cache_service/key_cache_keys_to_save", queryParams);
}
@Override
public int getCounterCacheKeysToSave() {
log(" getCounterCacheKeysToSave()");
return c.getIntValue("cache_service/counter_cache_keys_to_save");
}
@Override
public void setCounterCacheKeysToSave(int cckts) {
log(" setCounterCacheKeysToSave(int cckts)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -145,6 +157,7 @@ public class CacheService implements CacheServiceMBean {
/**
* invalidate the key cache; for use after invalidating row cache
*/
@Override
public void invalidateKeyCache() {
log(" invalidateKeyCache()");
c.post("cache_service/invalidate_key_cache");
@ -153,16 +166,19 @@ public class CacheService implements CacheServiceMBean {
/**
* invalidate the row cache; for use after bulk loading via BinaryMemtable
*/
@Override
public void invalidateRowCache() {
log(" invalidateRowCache()");
c.post("cache_service/invalidate_row_cache");
}
@Override
public void invalidateCounterCache() {
log(" invalidateCounterCache()");
c.post("cache_service/invalidate_counter_cache");
}
@Override
public void setRowCacheCapacityInMB(long capacity) {
log(" setRowCacheCapacityInMB(long capacity)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -170,6 +186,7 @@ public class CacheService implements CacheServiceMBean {
c.post("cache_service/row_cache_capacity", queryParams);
}
@Override
public void setKeyCacheCapacityInMB(long capacity) {
log(" setKeyCacheCapacityInMB(long capacity)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -177,6 +194,7 @@ public class CacheService implements CacheServiceMBean {
c.post("cache_service/key_cache_capacity", queryParams);
}
@Override
public void setCounterCacheCapacityInMB(long capacity) {
log(" setCounterCacheCapacityInMB(long capacity)");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
@ -195,139 +213,9 @@ public class CacheService implements CacheServiceMBean {
* and the thread is interrupted, either before or during the
* activity.
*/
@Override
public void saveCaches() throws ExecutionException, InterruptedException {
log(" saveCaches() throws ExecutionException, InterruptedException");
c.post("cache_service/save_caches");
}
//
// remaining methods are provided for backwards compatibility; modern
// clients should use CacheMetrics instead
//
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hits
*/
@Deprecated
public long getKeyCacheHits() {
log(" getKeyCacheHits()");
return keyCache.hits.count();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hits
*/
@Deprecated
public long getRowCacheHits() {
log(" getRowCacheHits()");
return rowCache.hits.count();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#requests
*/
@Deprecated
public long getKeyCacheRequests() {
log(" getKeyCacheRequests()");
return keyCache.requests.count();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#requests
*/
@Deprecated
public long getRowCacheRequests() {
log(" getRowCacheRequests()");
return rowCache.requests.count();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hitRate
*/
@Deprecated
public double getKeyCacheRecentHitRate() {
log(" getKeyCacheRecentHitRate()");
return keyCache.getRecentHitRate();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hitRate
*/
@Deprecated
public double getRowCacheRecentHitRate() {
log(" getRowCacheRecentHitRate()");
return rowCache.getRecentHitRate();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getRowCacheCapacityInMB() {
log(" getRowCacheCapacityInMB()");
return getRowCacheCapacityInBytes() / 1024 / 1024;
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getRowCacheCapacityInBytes() {
log(" getRowCacheCapacityInBytes()");
return rowCache.capacity.value();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getKeyCacheCapacityInMB() {
log(" getKeyCacheCapacityInMB()");
return getKeyCacheCapacityInBytes() / 1024 / 1024;
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getKeyCacheCapacityInBytes() {
log(" getKeyCacheCapacityInBytes()");
return keyCache.capacity.value();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#size
*/
@Deprecated
public long getRowCacheSize() {
log(" getRowCacheSize()");
return rowCache.size.value();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#entries
*/
@Deprecated
public long getRowCacheEntries() {
log(" getRowCacheEntries()");
return rowCache.size.value();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#size
*/
@Deprecated
public long getKeyCacheSize() {
log(" getKeyCacheSize()");
return keyCache.size.value();
}
/**
* @see org.apache.cassandra.metrics.CacheMetrics#entries
*/
@Deprecated
public long getKeyCacheEntries() {
log(" getKeyCacheEntries()");
return keyCache.size.value();
}
}

View File

@ -15,6 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2015 Cloudius Systems
*
* Modified by Cloudius Systems
*/
package org.apache.cassandra.service;
import java.util.concurrent.ExecutionException;
@ -31,7 +40,6 @@ public interface CacheServiceMBean
public void setCounterCacheSavePeriodInSeconds(int ccspis);
public int getRowCacheKeysToSave();
public void setRowCacheKeysToSave(int rckts);
public int getKeyCacheKeysToSave();
@ -65,90 +73,4 @@ public interface CacheServiceMBean
* @throws InterruptedException when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.
*/
public void saveCaches() throws ExecutionException, InterruptedException;
//
// remaining methods are provided for backwards compatibility; modern clients should use CacheMetrics instead
//
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hits
*/
@Deprecated
public long getKeyCacheHits();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hits
*/
@Deprecated
public long getRowCacheHits();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#requests
*/
@Deprecated
public long getKeyCacheRequests();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#requests
*/
@Deprecated
public long getRowCacheRequests();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hitRate
*/
@Deprecated
public double getKeyCacheRecentHitRate();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#hitRate
*/
@Deprecated
public double getRowCacheRecentHitRate();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getRowCacheCapacityInMB();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getRowCacheCapacityInBytes();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getKeyCacheCapacityInMB();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#capacity
*/
@Deprecated
public long getKeyCacheCapacityInBytes();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#size
*/
@Deprecated
public long getRowCacheSize();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#entries
*/
@Deprecated
public long getRowCacheEntries();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#size
*/
@Deprecated
public long getKeyCacheSize();
/**
* @see org.apache.cassandra.metrics.CacheMetrics#entries
*/
@Deprecated
public long getKeyCacheEntries();
}