MessagingService: Add the depricated getRecentTimeoutsPerHost and

getRecentTotalTimeouts

This patch adds the impelementation for the depricated method
getRecentTimeoutsPerHost and getRecentTotalTimeouts.

The implementatin is based on origin, the recent version of the method,
return the delta from the last call to the method.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This commit is contained in:
Amnon Heiman 2015-11-17 11:57:07 +02:00
parent db7aad26f5
commit 1292bd9ba4
1 changed files with 17 additions and 3 deletions

View File

@ -42,8 +42,10 @@ public final class MessagingService implements MessagingServiceMBean {
.getLogger(MessagingService.class.getName());
Map<String, DroppedMessageMetrics> dropped;
private APIClient c = new APIClient();
Map<String, Long> resent_timeout = new HashMap<String, Long>();
private final ObjectName jmxObjectName;
private long recentTimeoutCount;
/* All verb handler identifiers */
public enum Verb
{
@ -230,7 +232,10 @@ public final class MessagingService implements MessagingServiceMBean {
*/
public long getRecentTotalTimouts() {
log(" getRecentTotalTimouts()");
return c.getLongValue("");
long timeoutCount = getTotalTimeouts();
long recent = timeoutCount - recentTimeoutCount;
recentTimeoutCount = timeoutCount;
return recent;
}
/**
@ -238,7 +243,16 @@ public final class MessagingService implements MessagingServiceMBean {
*/
public Map<String, Long> getRecentTimeoutsPerHost() {
log(" getRecentTimeoutsPerHost()");
return c.getMapStringLongValue("");
Map<String, Long> timeouts = getTimeoutsPerHost();
Map<String, Long> result = new HashMap<String, Long>();
for ( Entry<String, Long> e : timeouts.entrySet()) {
long res = e.getValue().longValue() -
((resent_timeout.containsKey(e.getKey()))? (resent_timeout.get(e.getKey())).longValue()
: 0);
resent_timeout.put(e.getKey(), e.getValue());
result.put(e.getKey(),res);
}
return result;
}
public int getVersion(String address) throws UnknownHostException {