All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bagri.server.hazelcast.stats.QueryStatistics Maven / Gradle / Ivy

The newest version!
package com.bagri.server.hazelcast.stats;

import java.util.Map;

import com.bagri.support.stats.StatisticsEvent;


public class QueryStatistics extends UsageStatistics {

	private int results;
	private int hits;
	private int miss;

	public QueryStatistics(String name) {
		super(name);
	}

	@Override
	public String getDescription() {
		return "Query Usage Statistics";
	}

	@Override
	public String getHeader() {
		return "Query";
	}

	@Override
	public String getName() {
		return "Query Statistics";
	}

	@Override
	public Map toMap() {
		Map result = super.toMap();
   		result.put("Cached Results", results);
   		result.put("Result Hits", hits);
   		result.put("Result Miss", miss);
		return result;
	}

	@Override
	public void update(StatisticsEvent event) {
		Object[]  params = event.getParams();
		if (params.length > 1) {
			results += (Integer) params[0];
			if (event.isSuccess()) {
				hits++;
			} else {
				miss++;
			}
		} else {
			super.update(event);
		}
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy