Java 类com.hazelcast.core.ReplicatedMap 实例源码

项目:bagri    文件:SchemaDocCleaner.java   
@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;
}
项目:ahome-tooling-server-hazelcast    文件:HazelcastContextInstance.java   
@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);
}
项目:bagri    文件:ClientManagementImpl.java   
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);
    }
 }
项目:xm-ms-entity    文件:WebConfigurerIntTest.java   
@Override
public <K, V> ReplicatedMap<K, V> getReplicatedMap(String s) {
    return null;
}
项目:Camel    文件:HazelcastReplicatedmapConsumer.java   
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);
}
项目:bagri    文件:QueryManagementImpl.java   
public void setQueryCache(ReplicatedMap<Integer, Query> cache) {
//public void setQueryCache(IMap<Integer, XDMQuery> cache) {
    this.xqCache = cache;
}
项目:bagri    文件:ClientManagementImpl.java   
public void setClientsCache(ReplicatedMap<String, Properties> clientsCache) {
    this.clientsCache = clientsCache;
    clientsCache.addEntryListener(this); 
}
项目:bagri    文件:IndexManagementImpl.java   
public void setIndexDictionary(ReplicatedMap<Integer, Index> idxDict) {
    this.idxDict = idxDict;
}
项目:bagri    文件:ClientManagementImpl.java   
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);
    }
 }
项目:ahome-tooling-server-hazelcast    文件:IHazelcastContext.java   
public <K, V> ReplicatedMap<K, V> getIReplicatedMap(String name);