Search in sources :

Example 1 with Stats

use of com.hazelcast.internal.ascii.memcache.Stats in project hazelcast by hazelcast.

the class TextCommandServiceImpl method getStats.

@Override
public Stats getStats() {
    Stats stats = new Stats();
    stats.setUptime((int) ((Clock.currentTimeMillis() - startTime) / MILLIS_TO_SECONDS));
    stats.setCmdGet(getMisses.get() + getHits.get());
    stats.setCmdSet(sets.get());
    stats.setCmdTouch(touches.get());
    stats.setGetHits(getHits.get());
    stats.setGetMisses(getMisses.get());
    stats.setDeleteHits(deleteHits.get());
    stats.setDeleteMisses(deleteMisses.get());
    stats.setIncrHits(incrementHits.get());
    stats.setIncrMisses(incrementMisses.get());
    stats.setDecrHits(decrementHits.get());
    stats.setDecrMisses(decrementMisses.get());
    Server server = node.getServer();
    ServerConnectionManager cm = server.getConnectionManager(MEMCACHE);
    int memcachedCount = cm == null ? 0 : cm.connectionCount(c -> Protocols.MEMCACHE.equals(c.getConnectionType()));
    stats.setCurrConnections(memcachedCount);
    stats.setTotalConnections(server.connectionCount());
    return stats;
}
Also used : Clock(com.hazelcast.internal.util.Clock) ADD(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.ADD) RestCallCollector(com.hazelcast.internal.ascii.rest.RestCallCollector) TextEncoder(com.hazelcast.internal.nio.ascii.TextEncoder) Thread.currentThread(java.lang.Thread.currentThread) StatsCommandProcessor(com.hazelcast.internal.ascii.memcache.StatsCommandProcessor) HttpPostCommandProcessor(com.hazelcast.internal.ascii.rest.HttpPostCommandProcessor) ByteBuffer(java.nio.ByteBuffer) GET_END(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.GET_END) UNKNOWN(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.UNKNOWN) OutOfMemoryErrorDispatcher(com.hazelcast.instance.impl.OutOfMemoryErrorDispatcher) HTTP_POST(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_POST) EmptyStatement.ignore(com.hazelcast.internal.util.EmptyStatement.ignore) GetCommandProcessor(com.hazelcast.internal.ascii.memcache.GetCommandProcessor) Map(java.util.Map) HTTP_GET(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_GET) BULK_GET(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.BULK_GET) TouchCommandProcessor(com.hazelcast.internal.ascii.memcache.TouchCommandProcessor) Set(java.util.Set) Server(com.hazelcast.internal.server.Server) BlockingQueue(java.util.concurrent.BlockingQueue) ThreadUtil.createThreadName(com.hazelcast.internal.util.ThreadUtil.createThreadName) Node(com.hazelcast.instance.impl.Node) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) ERROR_CLIENT(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.ERROR_CLIENT) HttpDeleteCommandProcessor(com.hazelcast.internal.ascii.rest.HttpDeleteCommandProcessor) TOUCH(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.TOUCH) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) BulkGetCommandProcessor(com.hazelcast.internal.ascii.memcache.BulkGetCommandProcessor) REPLACE(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.REPLACE) INCREMENT(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.INCREMENT) VersionCommandProcessor(com.hazelcast.internal.ascii.memcache.VersionCommandProcessor) APPEND(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.APPEND) SET(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.SET) SimpleCommandProcessor(com.hazelcast.internal.ascii.memcache.SimpleCommandProcessor) ERROR_SERVER(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.ERROR_SERVER) Protocols(com.hazelcast.internal.nio.Protocols) PREPEND(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.PREPEND) DeleteCommandProcessor(com.hazelcast.internal.ascii.memcache.DeleteCommandProcessor) ILogger(com.hazelcast.logging.ILogger) STATS(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.STATS) Stats(com.hazelcast.internal.ascii.memcache.Stats) HTTP_HEAD(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_HEAD) HTTP_PUT(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_PUT) EntryConverter(com.hazelcast.internal.ascii.memcache.EntryConverter) SetCommandProcessor(com.hazelcast.internal.ascii.memcache.SetCommandProcessor) ServerConnectionManager(com.hazelcast.internal.server.ServerConnectionManager) HazelcastInstance(com.hazelcast.core.HazelcastInstance) HttpHeadCommandProcessor(com.hazelcast.internal.ascii.rest.HttpHeadCommandProcessor) Data(com.hazelcast.internal.serialization.Data) QUIT(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.QUIT) VERSION(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.VERSION) NO_OP(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.NO_OP) DECREMENT(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.DECREMENT) TimeUnit(java.util.concurrent.TimeUnit) MEMCACHE(com.hazelcast.instance.EndpointQualifier.MEMCACHE) AtomicLong(java.util.concurrent.atomic.AtomicLong) GET(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.GET) ErrorCommandProcessor(com.hazelcast.internal.ascii.memcache.ErrorCommandProcessor) RestValue(com.hazelcast.internal.ascii.rest.RestValue) HttpGetCommandProcessor(com.hazelcast.internal.ascii.rest.HttpGetCommandProcessor) IncrementCommandProcessor(com.hazelcast.internal.ascii.memcache.IncrementCommandProcessor) HTTP_DELETE(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_DELETE) DELETE(com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.DELETE) IMap(com.hazelcast.map.IMap) Server(com.hazelcast.internal.server.Server) ServerConnectionManager(com.hazelcast.internal.server.ServerConnectionManager) Stats(com.hazelcast.internal.ascii.memcache.Stats)

Aggregations

HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 MEMCACHE (com.hazelcast.instance.EndpointQualifier.MEMCACHE)1 Node (com.hazelcast.instance.impl.Node)1 OutOfMemoryErrorDispatcher (com.hazelcast.instance.impl.OutOfMemoryErrorDispatcher)1 ADD (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.ADD)1 APPEND (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.APPEND)1 BULK_GET (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.BULK_GET)1 DECREMENT (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.DECREMENT)1 DELETE (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.DELETE)1 ERROR_CLIENT (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.ERROR_CLIENT)1 ERROR_SERVER (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.ERROR_SERVER)1 GET (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.GET)1 GET_END (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.GET_END)1 HTTP_DELETE (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_DELETE)1 HTTP_GET (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_GET)1 HTTP_HEAD (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_HEAD)1 HTTP_POST (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_POST)1 HTTP_PUT (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.HTTP_PUT)1 INCREMENT (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.INCREMENT)1 NO_OP (com.hazelcast.internal.ascii.TextCommandConstants.TextCommandType.NO_OP)1