use of com.hazelcast.client.impl.spi.ClientContext in project hazelcast by hazelcast.
the class ClientQueryCacheMemoryLeakTest method assertNoUserListenerLeft.
private static void assertNoUserListenerLeft(String mapName, HazelcastInstance client) {
ProxyManager proxyManager = ((HazelcastClientProxy) client).client.getProxyManager();
ClientContext context = proxyManager.getContext();
ClientQueryCacheContext queryCacheContext = context.getQueryCacheContext();
SubscriberContext subscriberContext = queryCacheContext.getSubscriberContext();
QueryCacheEventService eventService = subscriberContext.getEventService();
assertFalse(hasAnyListenerRegistered(eventService, mapName));
}
use of com.hazelcast.client.impl.spi.ClientContext in project hazelcast by hazelcast.
the class ClientMapInvalidationMetaDataFetcherTest method getRepairingTask.
private RepairingTask getRepairingTask(String mapName, int partition, long givenSequence, UUID givenUuid) {
Config config = getBaseConfig();
HazelcastInstance member = factory.newHazelcastInstance(config);
distortRandomPartitionSequence(mapName, partition, givenSequence, member);
distortRandomPartitionUuid(partition, givenUuid, member);
ClientConfig clientConfig = new ClientConfig().addNearCacheConfig(new NearCacheConfig(mapName));
HazelcastInstance client = factory.newHazelcastClient(clientConfig);
IMap<Integer, Integer> clientMap = client.getMap(mapName);
ClientContext clientContext = ((ClientProxy) clientMap).getContext();
return clientContext.getRepairingTask(SERVICE_NAME);
}
use of com.hazelcast.client.impl.spi.ClientContext in project hazelcast by hazelcast.
the class ClientStatisticsService method addNearCacheStats.
private void addNearCacheStats(final StringBuilder stats) {
ProxyManager proxyManager = client.getProxyManager();
ClientContext context = proxyManager.getContext();
if (context == null) {
return;
}
context.getNearCacheManagers().values().stream().flatMap(nearCacheManager -> nearCacheManager.listAllNearCaches().stream()).forEach(nearCache -> {
String nearCacheName = nearCache.getName();
StringBuilder nearCacheNameWithPrefix = getNameWithPrefix(nearCacheName);
nearCacheNameWithPrefix.append('.');
NearCacheStatsImpl nearCacheStats = (NearCacheStatsImpl) nearCache.getNearCacheStats();
String prefix = nearCacheNameWithPrefix.toString();
addStat(stats, prefix, "creationTime", nearCacheStats.getCreationTime());
addStat(stats, prefix, "evictions", nearCacheStats.getEvictions());
addStat(stats, prefix, "hits", nearCacheStats.getHits());
addStat(stats, prefix, "lastPersistenceDuration", nearCacheStats.getLastPersistenceDuration());
addStat(stats, prefix, "lastPersistenceKeyCount", nearCacheStats.getLastPersistenceKeyCount());
addStat(stats, prefix, "lastPersistenceTime", nearCacheStats.getLastPersistenceTime());
addStat(stats, prefix, "lastPersistenceWrittenBytes", nearCacheStats.getLastPersistenceWrittenBytes());
addStat(stats, prefix, "misses", nearCacheStats.getMisses());
addStat(stats, prefix, "ownedEntryCount", nearCacheStats.getOwnedEntryCount());
addStat(stats, prefix, "expirations", nearCacheStats.getExpirations());
addStat(stats, prefix, "invalidations", nearCacheStats.getInvalidations());
addStat(stats, prefix, "invalidationRequests", nearCacheStats.getInvalidationRequests());
addStat(stats, prefix, "ownedEntryMemoryCost", nearCacheStats.getOwnedEntryMemoryCost());
String persistenceFailure = nearCacheStats.getLastPersistenceFailure();
if (persistenceFailure != null && !persistenceFailure.isEmpty()) {
addStat(stats, prefix, "lastPersistenceFailure", persistenceFailure);
}
});
}
Aggregations