@Override public InternalSerializationService getSerializationService() { return getOriginal().getSerializationService(); }
@Override public InternalSerializationService getSerializationService() { return getOriginal().getSerializationService(); }
@Override protected void init(@Nonnull Context context) { serializationService = ((HazelcastInstanceImpl) context.jetInstance().getHazelcastInstance()).getSerializationService(); }
UpdateMapContext( HazelcastInstance instance, String mapName, @Nonnull DistributedFunction<? super T, ? extends K> toKeyFn, @Nonnull DistributedBiFunction<? super V, ? super T, ? extends V> updateFn, boolean isLocal) { this.toKeyFn = toKeyFn; this.updateFn = updateFn; this.isLocal = isLocal; map = instance.getMap(mapName); int partitionCount; if (isLocal) { HazelcastInstanceImpl castedInstance = (HazelcastInstanceImpl) instance; clientPartitionService = null; memberPartitionService = castedInstance.node.nodeEngine.getPartitionService(); serializationService = castedInstance.getSerializationService(); partitionCount = memberPartitionService.getPartitionCount(); } else { HazelcastClientProxy clientProxy = (HazelcastClientProxy) instance; clientPartitionService = clientProxy.client.getClientPartitionService(); memberPartitionService = null; serializationService = clientProxy.getSerializationService(); partitionCount = clientPartitionService.getPartitionCount(); } tmpMaps = new Map[partitionCount]; for (int i = 0; i < partitionCount; i++) { tmpMaps[i] = new HashMap<>(); } }
@Override public void writeResponse(ManagementCenterService mcs, JsonObject root) { InternalSerializationService serializationService = mcs.getHazelcastInstance().getSerializationService(); HazelcastInstanceCacheManager cacheManager = mcs.getHazelcastInstance().getCacheManager(); ICache<Object, Object> cache = cacheManager.getCache(cacheName); CacheEntryView cacheEntry = null; if ("string".equals(type)) { cacheEntry = cache.invoke(key, ENTRY_PROCESSOR); } else if ("long".equals(type)) { cacheEntry = cache.invoke(Long.valueOf(key), ENTRY_PROCESSOR); } else if ("integer".equals(type)) { cacheEntry = cache.invoke(Integer.valueOf(key), ENTRY_PROCESSOR); } JsonObject result = new JsonObject(); if (cacheEntry != null) { Object value = serializationService.toObject(cacheEntry.getValue()); result.add("cacheBrowse_value", value != null ? value.toString() : "null"); result.add("cacheBrowse_class", value != null ? value.getClass().getName() : "null"); result.add("date_cache_creation_time", Long.toString(cacheEntry.getCreationTime())); result.add("date_cache_expiration_time", Long.toString(cacheEntry.getExpirationTime())); result.add("cacheBrowse_hits", Long.toString(cacheEntry.getAccessHit())); result.add("date_cache_access_time", Long.toString(cacheEntry.getLastAccessTime())); } root.add("result", result); }
@Override public void writeResponse(ManagementCenterService mcs, JsonObject root) { InternalSerializationService serializationService = mcs.getHazelcastInstance().getSerializationService(); HazelcastInstanceCacheManager cacheManager = mcs.getHazelcastInstance().getCacheManager(); ICache<Object, Object> cache = cacheManager.getCache(cacheName); CacheEntryView cacheEntry = null; if ("string".equals(type)) { cacheEntry = cache.invoke(key, ENTRY_PROCESSOR); } else if ("long".equals(type)) { cacheEntry = cache.invoke(Long.valueOf(key), ENTRY_PROCESSOR); } else if ("integer".equals(type)) { cacheEntry = cache.invoke(Integer.valueOf(key), ENTRY_PROCESSOR); } JsonObject result = new JsonObject(); if (cacheEntry != null) { Object value = serializationService.toObject(cacheEntry.getValue()); result.add("cacheBrowse_value", value != null ? value.toString() : "null"); result.add("cacheBrowse_class", value != null ? value.getClass().getName() : "null"); result.add("date_cache_creation_time", Long.toString(cacheEntry.getCreationTime())); result.add("date_cache_expiration_time", Long.toString(cacheEntry.getExpirationTime())); result.add("cacheBrowse_hits", Long.toString(cacheEntry.getAccessHit())); result.add("date_cache_access_time", Long.toString(cacheEntry.getLastAccessTime())); } root.add("result", result); }