@Override public Boolean call() throws Exception { logger.trace("call.enter; schema: {}", schemaName); boolean result = false; HazelcastInstance hz = findSchemaInstance(schemaName); if (hz != null) { // get docs caches and clean them cleanCache(hz, CN_XDM_CONTENT); cleanCache(hz, CN_XDM_DOCUMENT); cleanCache(hz, CN_XDM_ELEMENT); cleanCache(hz, CN_XDM_INDEX); cleanCache(hz, CN_XDM_RESULT); //cleanCache(hz, CN_XDM_QUERY); ReplicatedMap<Integer, Query> xqCache = hz.getReplicatedMap(CN_XDM_QUERY); xqCache.clear(); hMgr.clearState(); System.gc(); result = true; } logger.trace("call.exit; schema {} cleaned: {}", schemaName, result); return result; }
@Override @SuppressWarnings("unchecked") public <K, V> ReplicatedMap<K, V> getIReplicatedMap(String name) { name = Objects.requireNonNull(name); final ReplicatedMap<K, V> valu = getBeanSafely(name, ReplicatedMap.class); if (null != valu) { return valu; } return hz().getReplicatedMap(name); }
private void addClient(final ClientContainer cc, final String clientId, Properties props) { HazelcastInstance hzClient = cc.hzInstance; if (cc.addClient(clientId)) { ReplicatedMap<String, Properties> clientProps = hzClient.getReplicatedMap(CN_XDM_CLIENT); com.hazelcast.client.impl.HazelcastClientProxy proxy = (com.hazelcast.client.impl.HazelcastClientProxy) hzClient; props.setProperty(pn_client_memberId, proxy.client.getClientClusterService().getLocalClient().getUuid()); props.setProperty(pn_client_connectedAt, new java.util.Date(proxy.getCluster().getClusterTime()).toString()); //clientId = proxy.getLocalEndpoint().getUuid(); clientProps.put(clientId, props); logger.debug("addClient; got new connection for clientId: {}", clientId); } else { logger.trace("addClient; got existing connection for clientId: {}", clientId); } }
@Override public <K, V> ReplicatedMap<K, V> getReplicatedMap(String s) { return null; }
public HazelcastReplicatedmapConsumer(HazelcastInstance hazelcastInstance, Endpoint endpoint, Processor processor, String cacheName) { super(hazelcastInstance, endpoint, processor, cacheName); ReplicatedMap<Object, Object> cache = hazelcastInstance.getReplicatedMap(cacheName); cache.addEntryListener(new CamelEntryListener(this, cacheName), true); }
public void setQueryCache(ReplicatedMap<Integer, Query> cache) { //public void setQueryCache(IMap<Integer, XDMQuery> cache) { this.xqCache = cache; }
public void setClientsCache(ReplicatedMap<String, Properties> clientsCache) { this.clientsCache = clientsCache; clientsCache.addEntryListener(this); }
public void setIndexDictionary(ReplicatedMap<Integer, Index> idxDict) { this.idxDict = idxDict; }
public static void disconnect(final String clientId) { ClientContainer found = null; synchronized (clients) { Iterator<ClientContainer> itr = clients.values().iterator(); while (itr.hasNext()) { ClientContainer cc = itr.next(); if (cc.removeClient(clientId)) { found = cc; logger.trace("disconnect; client: {}; clients left in container: {}", clientId, found.getSize()); try { ReplicatedMap<String, Properties> clientProps = cc.hzInstance.getReplicatedMap(CN_XDM_CLIENT); clientProps.remove(clientId); } catch (Exception ex) { logger.info("disconnect; it seems the server has been stopped already"); } break; } } } if (found != null) { if (found.isEmpty()) { if (clients.remove(found.clientKey) != null) { logger.debug("disconnect; client container is empty, disposed"); } else { logger.info("disconnect; can't remove container for found key: {}", found.clientKey); } if (found.hzInstance.getLifecycleService().isRunning()) { logger.info("disconnect; shuting down HZ instance: {}", found.hzInstance); // probably, should do something like this: //execService.awaitTermination(100, TimeUnit.SECONDS); found.hzInstance.shutdown(); logger.trace("disconnect; instance disconnected"); } else { logger.info("disconnect; attempted to shutdown not-running client!"); } } else { logger.debug("disconnect; disconnected client: {}; remaining clients: {}", clientId, found.getSize()); } } else { logger.info("disconnect; can't find container for client: {}; clients: {}", clientId, clients); } }
public <K, V> ReplicatedMap<K, V> getIReplicatedMap(String name);